From 4609eed50c3e363e0131f90d3c42f2689bc4cebf Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Sun, 18 Sep 2005 09:19:51 +0000 Subject: [PATCH] try to fix badguys walking on water SVN-Revision: 2770 --- src/badguy/badguy.cpp | 14 ++++++++++++-- src/object/player.cpp | 1 - 2 files changed, 12 insertions(+), 3 deletions(-) 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); -- 2.11.0