Now the player dies when reaching the bottom of the level, even in Y-scrolling levels.
[supertux.git] / src / player.cpp
index a00560e..e0fd003 100644 (file)
@@ -184,6 +184,14 @@ Player::action(double frame_ratio)
 
       collision_swept_object_map(&old_base, &base);
 
+      if (!invincible_timer.started()
+          && (isspike(base.x, base.y) || isspike(base.x + base.width, base.y)
+          ||  isspike(base.x, base.y + base.height)
+          ||  isspike(base.x + base.width, base.y + base.height)))
+      {
+         kill(SHRINK);
+      }
+
       // Don't accelerate Tux if he is running against a wall
       if (target.x != base.x)
         {
@@ -701,7 +709,7 @@ Player::collision(void* p_c_object, int c_object)
       ptramp_c = (Trampoline*) p_c_object;
       
       // Pick up trampoline
-      if (ptramp_c->mode != Trampoline::M_HELD && input.fire == DOWN && !holding_something)
+      if (ptramp_c->mode != Trampoline::M_HELD && input.fire == DOWN && !holding_something && on_ground())
       {
         holding_something = true;
         ptramp_c->mode = Trampoline::M_HELD;
@@ -788,7 +796,8 @@ Player::is_dying()
 
 bool Player::is_dead()
 {
-  if(base.y > screen->h || base.x < scroll_x - AUTOSCROLL_DEAD_INTERVAL)  // last condition can happen in auto-scrolling
+  if(base.y > screen->h + scroll_y ||
+      base.x < scroll_x - AUTOSCROLL_DEAD_INTERVAL)  // can happen in auto-scrolling
     return true;
   else
     return false;
@@ -814,7 +823,7 @@ Player::check_bounds(bool back_scrolling, bool hor_autoscroll)
     }
 
   /* Keep in-bounds, vertically: */
-  if (base.y > screen->h)
+  if (base.y > World::current()->get_level()->height * /*TILE_HEIGHT*/ 32)
     {
       kill(KILL);
     }