Stalactites break free when disturbed by fire and ice bullets
authorLMH <lmh.0013@gmail.com>
Fri, 6 Sep 2013 00:02:01 +0000 (14:02 -1000)
committerLMH <lmh.0013@gmail.com>
Fri, 6 Sep 2013 00:02:01 +0000 (14:02 -1000)
src/badguy/stalactite.cpp
src/badguy/stalactite.hpp

index a5f688a..791cdc9 100644 (file)
@@ -17,6 +17,7 @@
 #include "badguy/stalactite.hpp"
 
 #include "math/random_generator.hpp"
+#include "object/bullet.hpp"
 #include "object/player.hpp"
 #include "sprite/sprite.hpp"
 #include "supertux/object_factory.hpp"
@@ -114,6 +115,18 @@ Stalactite::collision_badguy(BadGuy& other, const CollisionHit& hit)
   return FORCE_MOVE;
 }
 
+HitResponse
+Stalactite::collision_bullet(Bullet& bullet, const CollisionHit& )
+{
+  if(state == STALACTITE_HANGING) {
+    timer.start(SHAKE_TIME);
+    state = STALACTITE_SHAKING;
+    bullet.remove_me();
+  }
+
+  return FORCE_MOVE;
+}
+
 void
 Stalactite::kill_fall()
 {
index 1835d93..bb08c9f 100644 (file)
@@ -28,6 +28,7 @@ public:
   void collision_solid(const CollisionHit& hit);
   HitResponse collision_player(Player& player, const CollisionHit& hit);
   HitResponse collision_badguy(BadGuy& other, const CollisionHit& hit);
+  HitResponse collision_bullet(Bullet& bullet, const CollisionHit& );
 
   void kill_fall();
   void draw(DrawingContext& context);