Skip to content

Commit cada00f

Browse files
authored
Merge pull request #1772 from mrkubax10/high_jump
Jump higher on trampoline when groundpounding
2 parents 3c8f878 + c495249 commit cada00f

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

src/object/trampoline.cpp

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,29 @@ Trampoline::collision(GameObject& other, const CollisionHit& hit)
8585
auto player = dynamic_cast<Player*> (&other);
8686
//Trampoline works for player
8787
if (player) {
88+
if (player->m_does_buttjump)
89+
player->m_does_buttjump = false;
8890
float vy = player->get_physic().get_velocity_y();
8991
//player is falling down on trampoline
9092
if (hit.top && vy >= 0) {
9193
if (!(player->get_status().bonus == AIR_BONUS))
92-
vy = player->get_controller().hold(Control::JUMP) ? VY_MIN : VY_INITIAL;
94+
{
95+
if (player->get_controller().hold(Control::JUMP))
96+
vy = VY_MIN;
97+
else if (player->get_controller().hold(Control::DOWN))
98+
vy = VY_MIN + 100;
99+
else
100+
vy = VY_INITIAL;
101+
}
93102
else
94-
vy = player->get_controller().hold(Control::JUMP) ? VY_MIN - 300 : VY_INITIAL - 40;
103+
{
104+
if (player->get_controller().hold(Control::JUMP))
105+
vy = VY_MIN - 300;
106+
else if (player->get_controller().hold(Control::DOWN))
107+
vy = VY_MIN - 200;
108+
else
109+
vy = VY_INITIAL - 40;
110+
}
95111
player->get_physic().set_velocity_y(vy);
96112
SoundManager::current()->play(TRAMPOLINE_SOUND, get_pos());
97113
m_sprite->set_action("swinging", 1);

0 commit comments

Comments
 (0)