The first weapon now has a recoil so that you can fly. There is a bug with facing when you are flying with recoil.
authorsaiam
Sun, 07 Dec 2008 20:29:20 +0000
changeset 258 833ad8d7db8b
parent 257 549783d71e51
child 259 4964438840f5
The first weapon now has a recoil so that you can fly. There is a bug with facing when you are flying with recoil.
src/Config.hh
src/Player.cc
src/Weapon.hh
src/Weapons.cc
--- a/src/Config.hh	Sun Dec 07 20:25:57 2008 +0000
+++ b/src/Config.hh	Sun Dec 07 20:29:20 2008 +0000
@@ -28,7 +28,7 @@
 const float PLAYER_MOVE_FORCE = 1100.0;
 const float PLAYER_MIN_SPEED = 10.0;
 const float PLAYER_JUMP_MIN_DISTANCE = 5.0;
-const float PLAYER_AIM_MIN = -KG_PI/4; 
+const float PLAYER_AIM_MIN = -3*KG_PI/8; 
 const float PLAYER_AIM_MAX = KG_PI/2;
 const float PLAYER_INITIAL_X = 400.0;
 const float PLAYER_INITIAL_Y = 300.0;
--- a/src/Player.cc	Sun Dec 07 20:25:57 2008 +0000
+++ b/src/Player.cc	Sun Dec 07 20:29:20 2008 +0000
@@ -86,6 +86,10 @@
     // calculate new position and velocity
     Vector shotPosition = position + getDirection() * PROJECTILE_START_DISTANCE;
     Vector shotVelocity = velocity + getDirection() * weapon->getSpeed();
+    
+    // Recoil
+    Vector recoilForce =  (getDirection() * weapon->getRecoil())*(-1);
+    applyForce(recoilForce);
 
     // execute
     handleCreateProjectile(weapon, shotPosition, shotVelocity);
--- a/src/Weapon.hh	Sun Dec 07 20:25:57 2008 +0000
+++ b/src/Weapon.hh	Sun Dec 07 20:29:20 2008 +0000
@@ -35,6 +35,7 @@
     // get weapon parameters
     std::string getName (void) { return name; }
     float getSpeed (void) { return velocity; }
+    float getRecoil (void) { return recoil; }
     float getExplosionRadius (void) { return explosionRadius; }
     TickCount getExpireTicks (void) { return age; }
     
--- a/src/Weapons.cc	Sun Dec 07 20:25:57 2008 +0000
+++ b/src/Weapons.cc	Sun Dec 07 20:29:20 2008 +0000
@@ -10,7 +10,7 @@
     std::string name;
 } WEAPON_PARAMS[] = {
     /*  age     speed        recoil   expRadius   reloadTime      name        */
-    {   10000,  5 * 80 + 50, 0 * 5 + 5,   0 * 6 + 5,  0 * 100 + 50,   "Weapon 1"  },
+    {   10000,  5 * 80 + 50, 0 * 5 + 4000,   0 * 6 + 5,  0 * 100 + 50,   "Weapon 1"  },
     {   10000,  4 * 80 + 50, 2 * 5 + 5,   1 * 6 + 5,  1 * 100 + 50,   "Weapon 2"  },
     {   10000,  3 * 80 + 50, 3 * 5 + 5,   2 * 6 + 5,  2 * 100 + 50,   "Weapon 3"  },
     {   10000,  2 * 80 + 50, 4 * 5 + 5,   3 * 6 + 5,  3 * 100 + 50,   "Weapon 4"  },