flapping = false;
can_jump = true;
can_flap = false;
+ falling_from_flap = false;
enable_hover = false;
butt_jump = false;
physic.set_velocity_y(0);
jumped_in_solid = true;
jumping = false;
+ flapping = false;
}
}
else
{
/* Make sure jumping is off. */
jumping = false;
+ flapping = false;
}
}
}
void
Player::handle_vertical_input()
{
+
// set fall mode...
if(on_ground()) {
fall_mode = ON_GROUND;
SoundManager::get()->play_sound(IDToSound(SND_BIGJUMP));
}
// Let go of jump key
- else if(input.up == UP && jumping && physic.get_velocity_y() > 0)
+ else if(input.up == UP)
{
- if (!flapping && !duck)
+ if (!flapping && !duck && !falling_from_flap && !on_ground())
{
can_flap = true;
}
- jumping = false;
- physic.set_velocity_y(0);
+ if (jumping && physic.get_velocity_y() > 0)
+ {
+ jumping = false;
+ physic.set_velocity_y(0);
+ }
}
-
+
// Flapping
if (input.up == DOWN && can_flap)
{
if (!flapping_timer.started()) {flapping_timer.start(TUX_FLAPPING_TIME);}
- if (!flapping_timer.check()) {can_flap = false;}
+ if (!flapping_timer.check())
+ {
+ can_flap = false;
+ falling_from_flap = true;
+ }
jumping = true;
flapping = true;
if (flapping_timer.get_gone() <= TUX_FLAPPING_TIME)
}
if(on_ground()) /* Make sure jumping is off. */
- jumping = false;
+ {
+ jumping = false;
+ flapping = false;
+ falling_from_flap = false;
+ }
input.old_up = input.up;
}