Navigation Menu

Skip to content

Commit

Permalink
Tweaked the backflip timer so that Tux cannot cancel backflip after a…
Browse files Browse the repository at this point in the history
…n arbitrarily short time. This preserves the original backflip mechanics, while still allowing the fix for bug 1008 to be in effect.
  • Loading branch information
LMH0013 authored and tobbi committed Oct 26, 2013
1 parent d221747 commit 4618c9b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/object/player.cpp
Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions src/object/player.hpp
Expand Up @@ -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;
Expand Down

0 comments on commit 4618c9b

Please sign in to comment.