X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fbadguy%2Fbadguy.cpp;h=308e3e9b3c63b9c3db8cb39b7fb8b1fbc4f0ee7d;hb=4609eed50c3e363e0131f90d3c42f2689bc4cebf;hp=65b299789e0fa1b4cade82e8c669b864b9369804;hpb=0540d5db4c57c585615a78ccf33603ff3628db95;p=supertux.git diff --git a/src/badguy/badguy.cpp b/src/badguy/badguy.cpp index 65b299789..308e3e9b3 100644 --- a/src/badguy/badguy.cpp +++ b/src/badguy/badguy.cpp @@ -21,6 +21,8 @@ #include "badguy.hpp" #include "object/camera.hpp" +#include "object/tilemap.hpp" +#include "tile.hpp" #include "statistics.hpp" static const float SQUISH_TIME = 2; @@ -116,8 +118,16 @@ BadGuy::collision(GameObject& other, const CollisionHit& hit) case STATE_INACTIVE: return ABORT_MOVE; case STATE_ACTIVE: { - if(other.get_flags() & FLAG_SOLID) - return collision_solid(other, hit); + TileMap* tilemap = dynamic_cast (&other); + if(tilemap != 0) { + const TilemapCollisionHit* thit + = static_cast (&hit); + if(thit->tileflags & Tile::SPIKE) + kill_fall(); + if(thit->tileflags & Tile::SOLID) + return collision_solid(other, hit); + return FORCE_MOVE; + } BadGuy* badguy = dynamic_cast (&other); if(badguy && badguy->state == STATE_ACTIVE) @@ -181,7 +191,7 @@ BadGuy::collision_squished(Player& ) void BadGuy::kill_squished(Player& player) { - sound_manager->play("sounds/squish.ogg", get_pos()); + sound_manager->play("sounds/squish.wav", get_pos()); physic.enable_gravity(true); physic.set_velocity_x(0); physic.set_velocity_y(0); @@ -193,7 +203,7 @@ BadGuy::kill_squished(Player& player) void BadGuy::kill_fall() { - sound_manager->play("sounds/fall.ogg", get_pos()); + sound_manager->play("sounds/fall.wav", get_pos()); global_stats.add_points(BADGUYS_KILLED_STAT, 1); physic.set_velocity_y(0); physic.enable_gravity(true);