Skip to content

Commit 8e01ebd

Browse files
Made Tux swim jump higher when boosting.
1 parent 2a9956b commit 8e01ebd

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/object/player.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@ const float SWIM_ACCEL = 600.f;
144144
const float SWIM_BOOST_ACCEL = 2400.f;
145145
const float TURN_MAGNITUDE = 0.15f;
146146
const float TURN_MAGNITUDE_BOOST = 0.2f;
147+
const float SWIM_JUMP_SPEED = 450.f;
148+
const float SWIM_BOOST_JUMP_SPEED = 600.f;
147149

148150
/* Buttjump variables */
149151

@@ -458,8 +460,12 @@ Player::update(float dt_sec)
458460
if (m_swimming)
459461
{
460462
m_water_jump = true;
461-
if (m_physic.get_velocity_y() > -350.f && m_controller->hold(Control::UP))
462-
m_physic.set_velocity_y(-350.f);
463+
if (m_controller->hold(Control::UP)) {
464+
if (m_physic.get_velocity_y() > -SWIM_JUMP_SPEED && !m_swimboosting)
465+
m_physic.set_velocity_y(-SWIM_JUMP_SPEED);
466+
else if (m_physic.get_velocity_y() > -SWIM_BOOST_JUMP_SPEED && m_swimboosting) // Bigger jump if boosting
467+
m_physic.set_velocity_y(-SWIM_BOOST_JUMP_SPEED);
468+
}
463469
}
464470
m_swimming = false;
465471
}

0 commit comments

Comments
 (0)