// 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;
backflipping = true;
do_jump(-580);
sound_manager->play("sounds/flip.wav");
- backflip_timer.start(0.15f);
+ backflip_timer.start(TUX_BACKFLIP_TIME);
}
void
}
/* stop backflipping at will */
- if( backflipping && ( !controller->hold(Controller::JUMP) ) ){
+ if( backflipping && ( !controller->hold(Controller::JUMP) && !backflip_timer.started()) ){
backflipping = false;
backflip_direction = 0;
}
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;