This commit is contained in:
2026-04-11 16:25:56 +02:00
parent 5b2f986d32
commit bb38600aac
57 changed files with 371 additions and 347 deletions

View File

@@ -540,18 +540,10 @@ void Player::transitionToState(State state) {
switch (state) {
case State::ON_GROUND:
vy_ = 0;
// Clamp vx al aterrizar (el salto puede dar un boost extra)
if (vx_ > HORIZONTAL_VELOCITY) { vx_ = HORIZONTAL_VELOCITY; }
if (vx_ < -HORIZONTAL_VELOCITY) { vx_ = -HORIZONTAL_VELOCITY; }
if (previous_state_ == State::ON_AIR) {
Audio::get()->playSound(land_sound_, Audio::Group::GAME);
}
break;
case State::ON_SLOPE:
vy_ = 0;
if (vx_ > HORIZONTAL_VELOCITY) { vx_ = HORIZONTAL_VELOCITY; }
if (vx_ < -HORIZONTAL_VELOCITY) { vx_ = -HORIZONTAL_VELOCITY; }
// Clamp vx al aterrizar (el salto puede dar un boost extra)
vx_ = std::clamp(vx_, -HORIZONTAL_VELOCITY, HORIZONTAL_VELOCITY);
if (previous_state_ == State::ON_AIR) {
Audio::get()->playSound(land_sound_, Audio::Group::GAME);
}