From: Ryan Flegel Date: Tue, 11 May 2004 17:50:48 +0000 (+0000) Subject: - added butt-jump X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=940d0aaf383540495e729285bd6e4d1862524de4;p=supertux.git - added butt-jump SVN-Revision: 1106 --- diff --git a/src/player.cpp b/src/player.cpp index 3e8bde098..1288c6658 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -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)) diff --git a/src/player.h b/src/player.h index cfccd4006..0f87dba64 100644 --- a/src/player.h +++ b/src/player.h @@ -121,6 +121,7 @@ public: bool jumping; bool can_jump; + bool butt_jump; int frame_; int frame_main;