vauhtivakiot isommiksi, walk kuntoon
authorekku
Thu, 04 Dec 2008 17:07:07 +0000
changeset 194 36048d3250d0
parent 193 0c8f0547a423
child 195 53feb13a3d1c
vauhtivakiot isommiksi, walk kuntoon
src/Config.hh
src/Physics.cc
src/Physics.hh
--- a/src/Config.hh	Thu Dec 04 16:58:05 2008 +0000
+++ b/src/Config.hh	Thu Dec 04 17:07:07 2008 +0000
@@ -31,8 +31,8 @@
 const float PLAYER_INITIAL_Y = 300.0;
 const float CROSSHAIR_ANGLE_SPEED = PI/40;
 
-const float PLAYER_MAX_SPEED = 70;
-const float PLAYER_WALK_SPEED = 65;
+const float PLAYER_MAX_SPEED = 130;
+const float PLAYER_WALK_SPEED = 130;
 
 const float PLAYER_COLLISION_ELASTICITY = 0.3; // TODO: This could be
                                         // different for different
--- a/src/Physics.cc	Thu Dec 04 16:58:05 2008 +0000
+++ b/src/Physics.cc	Thu Dec 04 17:07:07 2008 +0000
@@ -110,17 +110,15 @@
     // And we return where we got
     return reached;
 }
-Vector PhysicsObject::walk (TimeMS dt, bool right) {
+void PhysicsObject::walk (TimeMS dt, bool right) {
     float velocity = PLAYER_WALK_SPEED;
     float walkAmount = (velocity*dt)/1000;
     Vector reached = this->position;
     while(walkAmount > 0 && !this->inAir) {
-        reached = walk_one_step((1 < walkAmount ? 1 : walkAmount), right);
+        this->position = walk_one_step((1 < walkAmount ? 1 : walkAmount), right);
         walkAmount--;
-        this->position = reached;
     }
     // TODO: Should the remaining walkAmount be handled somehow?
-    return reached;
 }
 
 /**
@@ -206,7 +204,7 @@
         // It walks only if there's some vertical force
         if (total.x != 0) {
             std::cout << "Succeeding to walk" << std::endl;
-            this->position = walk(PHYSICS_TICK_MS, total.x > 0);
+            walk(PHYSICS_TICK_MS, total.x > 0);
             this->velocity = Vector(0,0);
         }
     }
--- a/src/Physics.hh	Thu Dec 04 16:58:05 2008 +0000
+++ b/src/Physics.hh	Thu Dec 04 17:07:07 2008 +0000
@@ -201,7 +201,7 @@
      * @param right Boolean describing the movement direction.
      * @return New position
      */
-    Vector walk(TimeMS, bool right);
+    void walk(TimeMS, bool right);
     Vector walk_one_step(float, bool);
 
     /*