argh, clean out copy
[supertux.git] / src / object / invisible_block.cpp
index 73ccf56..2e802fc 100644 (file)
@@ -43,19 +43,26 @@ InvisibleBlock::draw(DrawingContext& context)
     sprite->draw(context, get_pos(), LAYER_OBJECTS);
 }
 
-HitResponse
-InvisibleBlock::collision(GameObject& other, const CollisionHit& hit)
+bool
+InvisibleBlock::collides(GameObject& other, const CollisionHit& )
 {
-  if(!visible) {
-    Player* player = dynamic_cast<Player*> (&other);
-    if(player) {
-      if(player->get_movement().y > 0 ||
-          player->get_bbox().get_top() <= get_bbox().get_bottom() - 7.0) {
-        return PASSTHROUGH;
-      }
-    }
+  if(visible)
+    return true;
+
+  // if we're not visible, only register a collision if this will make us visible
+  Player* player = dynamic_cast<Player*> (&other);
+  if ((player) 
+          && (player->get_movement().y <= 0)
+          && (player->get_bbox().get_top() > get_bbox().get_bottom() - 7.0)) {
+    return true;
   }
 
+  return false;
+}
+
+HitResponse
+InvisibleBlock::collision(GameObject& other, const CollisionHit& hit)
+{
   return Block::collision(other, hit);
 }
 
@@ -69,7 +76,6 @@ InvisibleBlock::hit(Player& )
 
   sprite->set_action("empty");
   start_bounce();
-  flags |= FLAG_SOLID;
   set_group(COLGROUP_STATIC);
   visible = true;
 }