Changed Yeti behaviour. You must stun him (jump on him) when is under a falling stala...
[supertux.git] / src / badguy / bomb.cpp
index 2897e68..e6dd34d 100644 (file)
@@ -41,15 +41,21 @@ Bomb::collision_player(Player& player, const CollisionHit& )
   return ABORT_MOVE;
 }
 
+HitResponse
+Bomb::collision_badguy(BadGuy& badguy, const CollisionHit& )
+{
+  if(state == 1)
+    badguy.kill_fall();
+  return ABORT_MOVE;
+}
+
 void
 Bomb::active_action(float )
 {
   switch(state) {
     case 0:
       if(timer.check()) {
-        state = 1;
-        sprite->set_action("explosion");
-        timer.start(EXPLOSIONTIME);
+        explode();
       }
       break;
     case 1:
@@ -61,6 +67,18 @@ Bomb::active_action(float )
 }
 
 void
+Bomb::explode()
+{
+  state = 1;
+  sprite->set_action("explosion");
+  SoundManager::get()->play_sound(IDToSound(SND_EXPLODE), get_pos(),
+      Sector::current()->player->get_pos());
+  timer.start(EXPLOSIONTIME);
+}
+
+void
 Bomb::kill_fall()
 {
+  explode();
 }
+