From: Matthias Braun Date: Sun, 18 Sep 2005 09:19:51 +0000 (+0000) Subject: try to fix badguys walking on water X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=4609eed50c3e363e0131f90d3c42f2689bc4cebf;p=supertux.git try to fix badguys walking on water SVN-Revision: 2770 --- diff --git a/src/badguy/badguy.cpp b/src/badguy/badguy.cpp index 8af388562..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) diff --git a/src/object/player.cpp b/src/object/player.cpp index 9b370c5a7..5892164d7 100644 --- a/src/object/player.cpp +++ b/src/object/player.cpp @@ -767,7 +767,6 @@ Player::collision(GameObject& other, const CollisionHit& hit) if(tilemap) { const TilemapCollisionHit* thit = static_cast (&hit); - printf("Tileattrs. %d\n", thit->tileflags); if(thit->tileflags & Tile::SPIKE) kill(SHRINK);