Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/object/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1459,6 +1459,15 @@ Player::do_jump(float yspeed) {
}
}

void

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put a simple little comment (not too large) above this function explaining the original problem too, this way its justification makes sense in the future for future readers.

Player::clear_jump_state_for_bounce()
{
m_jumping = false;
m_is_slidejump_falling = false;
m_jump_early_apex = false;
m_physic.set_gravity_modifier(1.f);
}

void
Player::early_jump_apex()
{
Expand Down
2 changes: 2 additions & 0 deletions src/object/player.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,8 @@ class Player final : public MovingSprite
*/
void do_jump(float yspeed);

void clear_jump_state_for_bounce();

/** Adds velocity to the player (be careful when using this) */
void add_velocity(const Vector& velocity);

Expand Down
2 changes: 2 additions & 0 deletions src/object/rusty_trampoline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ RustyTrampoline::collision(MovingObject& other, const CollisionHit& hit)
float vy = player->get_physic().get_velocity_y();
//player is falling down on trampoline
if (hit.top && vy >= 0) {
player->clear_jump_state_for_bounce();

if (player->get_controller().hold(Control::JUMP)) {
vy = VY_TRIGGER;
} else {
Expand Down
2 changes: 2 additions & 0 deletions src/object/trampoline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ Trampoline::collision(MovingObject& other, const CollisionHit& hit)
//player is falling down on trampoline
if (hit.top && vy >= 0)
{
player->clear_jump_state_for_bounce();

if (!(player->get_status().bonus[player->get_id()] == BONUS_AIR))
{
if (player->get_controller().hold(Control::JUMP))
Expand Down