try to fix badguys walking on water
authorMatthias Braun <matze@braunis.de>
Sun, 18 Sep 2005 09:19:51 +0000 (09:19 +0000)
committerMatthias Braun <matze@braunis.de>
Sun, 18 Sep 2005 09:19:51 +0000 (09:19 +0000)
SVN-Revision: 2770

src/badguy/badguy.cpp
src/object/player.cpp

index 8af3885..308e3e9 100644 (file)
@@ -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<TileMap*> (&other);
+      if(tilemap != 0) {
+        const TilemapCollisionHit* thit 
+          = static_cast<const TilemapCollisionHit*> (&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<BadGuy*> (&other);
       if(badguy && badguy->state == STATE_ACTIVE)
index 9b370c5..5892164 100644 (file)
@@ -767,7 +767,6 @@ Player::collision(GameObject& other, const CollisionHit& hit)
     if(tilemap) {
       const TilemapCollisionHit* thit = 
         static_cast<const TilemapCollisionHit*> (&hit);
-      printf("Tileattrs. %d\n", thit->tileflags);
       if(thit->tileflags & Tile::SPIKE)
         kill(SHRINK);