src/PhysicsObject.cc
changeset 223 2fcaf54ed37b
parent 222 293ddf4c067d
child 225 22ecb9cb9245
equal deleted inserted replaced
222:293ddf4c067d 223:2fcaf54ed37b
     9 {
     9 {
    10     world.addPhysicsObject(this);
    10     world.addPhysicsObject(this);
    11 }
    11 }
    12 
    12 
    13 PhysicsObject::~PhysicsObject (void) {
    13 PhysicsObject::~PhysicsObject (void) {
    14     Engine::log(DEBUG, "PhysicsObject.destructor") << this /* << ": objects.size=" << ((int) world.objects.size()) */;
    14     // Engine::log(DEBUG, "PhysicsObject.destructor") << this /* << ": objects.size=" << ((int) world.objects.size()) */;
    15 
       
    16     // world.objects.remove(this);
       
    17 
       
    18     Engine::log(DEBUG, "PhysicsObject.destructor") << this /* << ": objects.size=" << ((int) world.objects.size()) */;
       
    19 }
    15 }
    20 
    16 
    21 /**
    17 /**
    22  * Player walks on floor.
    18  * Player walks on floor.
    23  */
    19  */
   144     }
   140     }
   145 
   141 
   146     // If the worm is not in the air make it walk,
   142     // If the worm is not in the air make it walk,
   147     // otherwise integrate the new position and velocity
   143     // otherwise integrate the new position and velocity
   148     if (!this->inAir) {
   144     if (!this->inAir) {
   149         //std::cout << "Tryin to walk" << std::endl;
       
   150         // It walks only if there's some vertical force
   145         // It walks only if there's some vertical force
   151         if (total.x != 0) {
   146         if (total.x != 0) {
   152             std::cout << "Succeeding to walk" << std::endl;
       
   153             walk(dt, total.x > 0);
   147             walk(dt, total.x > 0);
   154             this->velocity = Vector(0,0);
   148             this->velocity = Vector(0,0);
   155         }
   149         }
   156     }
   150     }
   157 
   151