src/Projectile.cc
changeset 255 99431fdb0dc8
parent 252 25054ce94d07
child 257 549783d71e51
--- a/src/Projectile.cc	Sun Dec 07 19:59:25 2008 +0000
+++ b/src/Projectile.cc	Sun Dec 07 20:07:28 2008 +0000
@@ -13,7 +13,6 @@
     shape[3] = Vector(1, -1);
     setShape(shape);
 
-    target_visible = false;
     collision_elasticity = 0.9; // = shotType.elasticity
     state.addProjectile(this);
 }
@@ -43,36 +42,20 @@
     PhysicsObject::tick(dt);
 }
 
-void Projectile::draw(Graphics *g, Vector cam) const {
+void Projectile::draw(Graphics *g, PixelCoordinate camera) const {
     CL_GraphicContext *gc = g->get_gc();
 
     if (visible) {
-  
+        PixelCoordinate pos = state.world.getPixelCoordinate(position) - camera;
+
         CL_Quad projectile(
-                           (int)((position).x+1-cam.x), (int)((position).y+1-cam.y),
-                           (int)((position).x-1-cam.x), (int)((position).y+1-cam.y),
-                           (int)((position).x+1-cam.x), (int)((position).y-1-cam.y),
-                           (int)((position).x-1-cam.x), (int)((position).y-1-cam.y)
-                           );
+                pos.x + 1, pos.y + 1,
+                pos.x - 1, pos.y + 1,
+                pos.x + 1, pos.y - 1,
+                pos.x - 1, pos.y - 1
+        );
         
         gc->fill_quad(projectile, CL_Color::green);
-        
-        const uint16_t chlen = 10;
-        int x = projectile.center().x -cam.x;
-        int y = projectile.center().y -cam.y;
-        if (target_visible) {
-            if (facingRight) {
-                gc->draw_line(x, y,
-                              x + std::cos(aim)*chlen,
-                              y - std::sin(aim)*chlen,
-                              CL_Color::black);
-            } else {
-                gc->draw_line(x, y,
-                              x - std::cos(aim)*chlen,
-                              y - std::sin(aim)*chlen,
-                              CL_Color::black);
-            }
-        }
     }
 }