From: LMH Date: Fri, 6 Sep 2013 00:02:01 +0000 (-1000) Subject: Stalactites break free when disturbed by fire and ice bullets X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=828e79c58148875fd627572b3cec3800cef4a69e;p=supertux.git Stalactites break free when disturbed by fire and ice bullets --- diff --git a/src/badguy/stalactite.cpp b/src/badguy/stalactite.cpp index a5f688a90..791cdc955 100644 --- a/src/badguy/stalactite.cpp +++ b/src/badguy/stalactite.cpp @@ -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() { diff --git a/src/badguy/stalactite.hpp b/src/badguy/stalactite.hpp index 1835d936b..bb08c9f28 100644 --- a/src/badguy/stalactite.hpp +++ b/src/badguy/stalactite.hpp @@ -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);