some cleanups in the sprite class, increased delta for collision response
[supertux.git] / src / object / block.cpp
index c75c990..0dcc549 100644 (file)
@@ -13,6 +13,8 @@
 #include "flower.h"
 #include "oneup.h"
 #include "star.h"
+#include "badguy/badguy.h"
+#include "coin.h"
 
 static const float BOUNCY_BRICK_MAX_OFFSET=8;
 static const float BOUNCY_BRICK_SPEED=90;
@@ -35,8 +37,6 @@ Block::~Block()
 HitResponse
 Block::collision(GameObject& other, const CollisionHit& hitdata)
 {
-  // TODO kill badguys when bumping them...
-  
   Player* player = dynamic_cast<Player*> (&other);
   if(player) {
     // collided from below?
@@ -45,6 +45,17 @@ Block::collision(GameObject& other, const CollisionHit& hitdata)
     }
   }
 
+  if(bouncing) {
+    BadGuy* badguy = dynamic_cast<BadGuy*> (&other);
+    if(badguy) {
+      badguy->kill_fall();
+    }
+    Coin* coin = dynamic_cast<Coin*> (&other);
+    if(coin) {
+      coin->collect();
+    }
+  }
+
   return FORCE_MOVE;
 }