From: LMH Date: Mon, 2 Sep 2013 08:10:35 +0000 (-1000) Subject: Tweaked the backflip timer so that Tux cannot cancel backflip after an arbitrarily... X-Git-Url: https://git.octo.it/?p=supertux.git;a=commitdiff_plain;h=ad4642dacbeb1241bbf6abe18a5f6fa507bdd764 Tweaked the backflip timer so that Tux cannot cancel backflip after an arbitrarily short time. This preserves the original backflip mechanics, while still allowing the fix for bug 1008 to be in effect. --- diff --git a/src/object/player.cpp b/src/object/player.cpp index 61b6bc14d..0fc105314 100644 --- a/src/object/player.cpp +++ b/src/object/player.cpp @@ -384,7 +384,7 @@ Player::update(float elapsed_time) // check if we landed if(on_ground()) { jumping = false; - if (backflipping && (!backflip_timer.started())) { + if (backflipping && (backflip_timer.get_timegone() > 0.15f)) { backflipping = false; backflip_direction = 0; @@ -636,7 +636,7 @@ Player::do_backflip() { backflipping = true; do_jump(-580); sound_manager->play("sounds/flip.wav"); - backflip_timer.start(0.15f); + backflip_timer.start(TUX_BACKFLIP_TIME); } void @@ -831,7 +831,7 @@ Player::handle_input() } /* stop backflipping at will */ - if( backflipping && ( !controller->hold(Controller::JUMP) ) ){ + if( backflipping && ( !controller->hold(Controller::JUMP) && !backflip_timer.started()) ){ backflipping = false; backflip_direction = 0; } diff --git a/src/object/player.hpp b/src/object/player.hpp index b54a294ec..2e702d514 100644 --- a/src/object/player.hpp +++ b/src/object/player.hpp @@ -40,6 +40,7 @@ static const float TUX_INVINCIBLE_TIME = 14.0f; static const float TUX_INVINCIBLE_TIME_WARNING = 2.0f; static const float GROWING_TIME = 0.35f; static const int GROWING_FRAMES = 7; +static const float TUX_BACKFLIP_TIME = 2.1f; // minimum air time that backflip results in a loss of control class Camera; class PlayerStatus;