diff options
-rw-r--r-- | src/game/base/spacemine.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/game/base/spacemine.cc b/src/game/base/spacemine.cc index 32d4798..865deb0 100644 --- a/src/game/base/spacemine.cc +++ b/src/game/base/spacemine.cc @@ -92,11 +92,11 @@ void SpaceMine::collision(core::Entity *other) const float force = math::max(entity->mass(), entity->radius() * 100.0f); entity->body()->applyCentralImpulse(math::to_btVector3(explosion_direction * force )); - entity->body()->applyTorqueImpulse(math::to_btVector3(explosion_torque * force * 0.1f)); - - spacemine_detonated_timestamp = core::game()->time(); + entity->body()->applyTorqueImpulse(math::to_btVector3(explosion_torque * force * 0.1f)); } + spacemine_detonated_timestamp = core::game()->time(); + set_state(core::Entity::Destroyed); // this method is a bullet callback, we can not reset() here } @@ -111,7 +111,7 @@ void SpaceMine::frame(const unsigned long elapsed) reset(); } - if (core::game()->time() - spacemine_detonated_timestamp > 5) { + if (spacemine_detonated_timestamp + 5.0f < core::game()->time()) { die(); } } |