From: Christoph Sommer Date: Wed, 7 Mar 2007 23:27:32 +0000 (+0000) Subject: svn merge -c-4932 . X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=fcf21b831a16275cee70886492a5037519c6c863;p=supertux.git svn merge -c-4932 . SVN-Revision: 4934 --- diff --git a/src/object/player.cpp b/src/object/player.cpp index c3d76f212..d070c2952 100644 --- a/src/object/player.cpp +++ b/src/object/player.cpp @@ -572,7 +572,7 @@ void Player::handle_vertical_input() { // Press jump key - if(controller->hold(Controller::JUMP) && (on_ground()) && (can_jump)) { + if(controller->pressed(Controller::JUMP) && (can_jump)) { if (duck) { // when running, only jump a little bit; else do a backflip if ((physic.get_velocity_x() != 0) || (controller->hold(Controller::LEFT)) || (controller->hold(Controller::RIGHT))) do_jump(-300); else do_backflip(); @@ -638,7 +638,8 @@ Player::handle_input() if (!backflipping) handle_horizontal_input(); /* Jump/jumping? */ - if (!controller->hold(Controller::JUMP)) can_jump = true; + if (on_ground() && !controller->hold(Controller::JUMP)) + can_jump = true; /* Handle vertical movement: */ handle_vertical_input(); @@ -1080,7 +1081,6 @@ Player::collision(GameObject& other, const CollisionHit& hit) BadGuy* badguy = dynamic_cast (&other); if(badguy != NULL) { - if (hit.bottom) on_ground_flag = true; if(safe_timer.started() || invincible_timer.started()) return FORCE_MOVE; @@ -1228,9 +1228,9 @@ Player::add_velocity(const Vector& velocity, const Vector& end_speed) void Player::bounce(BadGuy& ) { - //if(controller->hold(Controller::JUMP)) - // physic.set_velocity_y(-520); - //else + if(controller->hold(Controller::JUMP)) + physic.set_velocity_y(-520); + else physic.set_velocity_y(-300); } diff --git a/src/object/trampoline.cpp b/src/object/trampoline.cpp index bed8a1d0b..4871cf639 100644 --- a/src/object/trampoline.cpp +++ b/src/object/trampoline.cpp @@ -79,7 +79,6 @@ Trampoline::collision(GameObject& other, const CollisionHit& hit) vy = VY_INITIAL; } player->physic.set_velocity_y(vy); - player->can_jump = false; sound_manager->play(TRAMPOLINE_SOUND); sprite->set_action("swinging", 1); return FORCE_MOVE;