create lisp code on the fly (still no enemies showing up in editor, no idea why....
[supertux.git] / src / badguy / bomb.cpp
index 6f884f1..9495abc 100644 (file)
@@ -9,7 +9,7 @@ Bomb::Bomb(const Vector& pos, Direction dir)
 {
   start_position = pos;
   bbox.set_pos(pos);
-  bbox.set_size(32, 32);
+  bbox.set_size(31.8, 31.8);
   sprite = sprite_manager->create("bomb");
   state = 0;
   timer.start(TICKINGTIME);
@@ -18,7 +18,7 @@ Bomb::Bomb(const Vector& pos, Direction dir)
 }
 
 void
-Bomb::write(LispWriter& )
+Bomb::write(lisp::Writer& )
 {
   // bombs are only temporarily so don't write them out...
 }
@@ -41,6 +41,14 @@ 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 )
 {
@@ -49,6 +57,8 @@ Bomb::active_action(float )
       if(timer.check()) {
         state = 1;
         sprite->set_action("explosion");
+        SoundManager::get()->play_sound(IDToSound(SND_EXPLODE), get_pos(),
+            Sector::current()->player->get_pos());
         timer.start(EXPLOSIONTIME);
       }
       break;
@@ -64,3 +74,4 @@ void
 Bomb::kill_fall()
 {
 }
+