From 4618c9b1aae8cd5f35cd50681724673a741ea286 Mon Sep 17 00:00:00 2001 From: LMH Date: Sun, 1 Sep 2013 22:10:35 -1000 Subject: [PATCH] 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. --- src/object/player.cpp | 6 +++--- src/object/player.hpp | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/object/player.cpp b/src/object/player.cpp index 61b6bc14d16..0fc10531465 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 b54a294ec35..2e702d5149c 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;