- added butt-jump
authorRyan Flegel <rflegel@gmail.com>
Tue, 11 May 2004 17:50:48 +0000 (17:50 +0000)
committerRyan Flegel <rflegel@gmail.com>
Tue, 11 May 2004 17:50:48 +0000 (17:50 +0000)
SVN-Revision: 1106

src/player.cpp
src/player.h

index 3e8bde0..1288c66 100644 (file)
@@ -86,6 +86,7 @@ Player::init()
   dying   = DYING_NOT;
   jumping = false;
   can_jump = true;
+  butt_jump = false;
 
   frame_main = 0;
   frame_ = 0;
@@ -405,6 +406,22 @@ Player::handle_vertical_input()
       }
     }
 
+  if (input.down == DOWN && !on_ground() && !duck)
+    butt_jump = true;
+  else if (input.down == UP)
+    butt_jump = false;
+  if (input.down == DOWN && butt_jump && on_ground())
+  {
+    // FIXME: Currently only breaks the block if his middle is on top of it
+    if (isbrick(base.x + base.width/2, base.y + base.height))
+    {
+      World::current()->trybreakbrick(base.x + base.width/2, base.y + base.height, false);
+      bumpbrick(base.x, base.y);
+    }
+    butt_jump = false;
+  }
+
+
   if ( (issolid(base.x + base.width / 2, base.y + base.height + 64) ||
         issolid(base.x + 1, base.y + base.height + 64) ||
         issolid(base.x + base.width - 1, base.y + base.height + 64))
index cfccd40..0f87dba 100644 (file)
@@ -121,6 +121,7 @@ public:
 
   bool jumping;
   bool can_jump;
+  bool butt_jump;
   int frame_;
   int frame_main;