not anything big
authornireco
Mon, 01 Dec 2008 17:46:52 +0000
changeset 160 ba0b6f421a3c
parent 159 109c7612ae2d
child 161 ea2f295c279f
not anything big
src/proto2/Config.hh
src/proto2/GameState.cc
src/proto2/Physics.cc
src/proto2/Terrain.cc
--- a/src/proto2/Config.hh	Mon Dec 01 17:23:28 2008 +0000
+++ b/src/proto2/Config.hh	Mon Dec 01 17:46:52 2008 +0000
@@ -34,6 +34,8 @@
 const float PLAYER_INITIAL_Y = 300.0;
 const float CROSSHAIR_ANGLE_SPEED = PI/40;
 
+const float PLAYER_MAX_SPEED = 70;
+
 // Graphical properties
 const CL_Color COLOR_EMPTY(86, 41, 0);
 const CL_Color COLOR_DIRT(144, 82, 23);
--- a/src/proto2/GameState.cc	Mon Dec 01 17:23:28 2008 +0000
+++ b/src/proto2/GameState.cc	Mon Dec 01 17:46:52 2008 +0000
@@ -7,10 +7,10 @@
     float da = 0; // Crosshair angle
 
     // handle left/right
-    if (input & INPUT_MOVE_LEFT)
+    if ((input & INPUT_MOVE_LEFT) && (velocity.x > -PLAYER_MAX_SPEED))
         fx -= PLAYER_MOVE_FORCE;
 
-    if (input & INPUT_MOVE_RIGHT)
+    if ((input & INPUT_MOVE_RIGHT) && (velocity.x < PLAYER_MAX_SPEED))
         fx += PLAYER_MOVE_FORCE;
 
     if (input & INPUT_MOVE_UP)
--- a/src/proto2/Physics.cc	Mon Dec 01 17:23:28 2008 +0000
+++ b/src/proto2/Physics.cc	Mon Dec 01 17:46:52 2008 +0000
@@ -294,8 +294,10 @@
         // Engine::log(DEBUG, "PhysicsObject.bounce") << "Velocity: " << velocity;
         Vector nvel = velocity;
         //        Engine::log(DEBUG, "PhysicsObject.bounce") << "New Velocity: " << nvel;
-        nvel = nvel - (2*((nvel*normal)/(normal*normal))*normal);
-        //        Engine::log(DEBUG, "PhysicsObject.bounce") << "Projection: " << nvel;
+//        nvel = nvel - ((1+COLLISION_ELASTICITY)*((nvel*normal)/(normal*normal))*normal);
+        
+        nvel = nvel - ((2)*((nvel*normal)/(normal*normal))*normal);
+//        Engine::log(DEBUG, "PhysicsObject.bounce") << "Projection: " << nvel;
         velocity = nvel;
         this->velocity *= COLLISION_ELASTICITY;
     }
--- a/src/proto2/Terrain.cc	Mon Dec 01 17:23:28 2008 +0000
+++ b/src/proto2/Terrain.cc	Mon Dec 01 17:46:52 2008 +0000
@@ -258,7 +258,11 @@
                     y < std::min((int32_t)MAP_HEIGHT, midy+range);
                     y++) {
                 
-                terrain[x][y] = type;
+                //terrain[x][y] = type;
+
+                if ((x-midx)*(x-midx)+(y-midy)*(y-midy) < range*range) {
+                    terrain[x][y] = type;
+                }
             }
             
         }