fixed digging, now bugs differently. Changed image_drawing to draw image 1:1
authornireco
Sun, 07 Dec 2008 19:14:42 +0000
changeset 250 84c553d61291
parent 249 5647f58e37cd
child 251 6a6208e5c7a1
fixed digging, now bugs differently. Changed image_drawing to draw image 1:1
src/Player.cc
--- a/src/Player.cc	Sun Dec 07 19:02:45 2008 +0000
+++ b/src/Player.cc	Sun Dec 07 19:14:42 2008 +0000
@@ -42,11 +42,10 @@
 
 void Player::handleDig (Vector position, float radius) {
     // XXX: clean this bit up
-    float shotspeed = 1; //0*PHYSICS_TICK_MS;
-
-    Vector shotVelocity = getDirection() * shotspeed;
-
-    new Projectile(state, position, shotVelocity, false, radius, 1);
+    // calculate new position and velocity
+    Vector shotPosition = position + getDirection() * PROJECTILE_START_DISTANCE;
+    // execute
+    new Projectile(state, shotPosition, Vector(0, 0), false, radius, 1);
 }
 
 void Player::handleCreateProjectile (Weapon *weapon, Vector position, Vector velocity) {
@@ -196,10 +195,10 @@
     }
     
     // XXX: this logic looks weird
-    CL_Rectf destination(position.x - 4 -cx, position.y - 4 -cy, position.x + 5 -cx, position.y + 4 -cy);
+    CL_Rectf destination(position.x - img_width/2 -cx, position.y - img_height/2 -cy, position.x + img_width/2 -cx, position.y + img_height/2 -cy);
 
     if (!getFacing()) {
-        destination = CL_Rect(position.x + 5 -cx, position.y - 4 -cy, position.x - 4 -cx, position.y + 4 -cy);
+        destination = CL_Rect(position.x + img_width/2 -cx, position.y - img_height/2 -cy, position.x - img_width/2 -cx, position.y + img_height/2 -cy);
     }
 
     skin_surface.draw_subpixel(