src/PhysicsObject.cc
changeset 205 905028e58ed1
parent 200 2dbf40661580
child 210 501b5a1918b5
--- a/src/PhysicsObject.cc	Thu Dec 04 22:59:13 2008 +0000
+++ b/src/PhysicsObject.cc	Thu Dec 04 23:28:52 2008 +0000
@@ -111,10 +111,10 @@
  * Updates object speed and position. This function organises force
  * integration and collision detection.
  */   
-void PhysicsObject::updatePosition () {
+void PhysicsObject::updatePosition (TimeMS dt) {
 
     // Reloads weapon if not reloaded
-    reloadTimer -= PHYSICS_TICK_MS;
+    reloadTimer -= dt;
     if(reloadTimer < 0)
         reloadTimer = 0;
 
@@ -154,7 +154,7 @@
         // It walks only if there's some vertical force
         if (total.x != 0) {
             std::cout << "Succeeding to walk" << std::endl;
-            walk(PHYSICS_TICK_MS, total.x > 0);
+            walk(dt, total.x > 0);
             this->velocity = Vector(0,0);
         }
     }
@@ -166,7 +166,7 @@
     Vector newPosition;
     Vector velAfterTick;
     // Calculate new position and velocity to the given references
-    integrate(total, PHYSICS_TICK_MS, newPosition, velAfterTick);
+    integrate(total, dt, newPosition, velAfterTick);
     this->velocity = velAfterTick;
 
    
@@ -334,8 +334,8 @@
     this->shape = shape;
 }
 
-void PhysicsObject::tick () {
-    this->updatePosition();
+void PhysicsObject::tick (TimeMS tick_length) {
+    this->updatePosition(tick_length);
 }
 
 bool PhysicsObject::canShoot() {