From 1af2ae3914a3be41a15c966b23dfb59853bc59ed Mon Sep 17 00:00:00 2001 From: Ingo Ruhnke Date: Fri, 30 Apr 2004 09:48:34 +0000 Subject: [PATCH] - reduced jump tolleranze to two tiles SVN-Revision: 860 --- src/player.cpp | 16 ++++++++++++++-- src/player.h | 1 + 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/player.cpp b/src/player.cpp index 4ff4db4aa..785860ba5 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -18,7 +18,6 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include - #include "gameloop.h" #include "globals.h" #include "player.h" @@ -57,6 +56,7 @@ void player_input_init(player_input_type* pplayer_input) pplayer_input->old_fire = UP; pplayer_input->right = UP; pplayer_input->up = UP; + pplayer_input->old_up = UP; } void @@ -396,11 +396,23 @@ Player::handle_vertical_input() else if(input.up == UP && jumping) { jumping = false; - can_jump = true; if(physic.get_velocity_y() > 0) { physic.set_velocity_y(0); } } + + 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)) + && jumping == false + && can_jump == false + && input.up == DOWN + && input.old_up == UP) + { + can_jump = true; + } + + input.old_up = input.up; } void diff --git a/src/player.h b/src/player.h index c734ff70a..3b0eabced 100644 --- a/src/player.h +++ b/src/player.h @@ -66,6 +66,7 @@ struct player_input_type int right; int left; int up; + int old_up; int down; int fire; int old_fire; -- 2.11.0