slopes solides i a cagar
This commit is contained in:
@@ -181,14 +181,6 @@ void Player::handleJumpAndDrop() {
|
||||
return;
|
||||
}
|
||||
|
||||
// Drop-through: slope
|
||||
if (wanna_down_ && state_ == State::ON_SLOPE) {
|
||||
y_ += 1.0F;
|
||||
vy_ = 0.0F;
|
||||
transitionToState(State::ON_AIR);
|
||||
return;
|
||||
}
|
||||
|
||||
// Drop-through: plataforma passable
|
||||
if (wanna_down_ && state_ == State::ON_GROUND) {
|
||||
auto [tc, ox, oy] = getCollisionContext();
|
||||
@@ -399,6 +391,17 @@ void Player::checkFalling() {
|
||||
// ON_GROUND: comprobar si sigue habiendo suelo
|
||||
float foot_y = (y_ + oy) + HEIGHT;
|
||||
if (!tc.hasGroundBelow(x_ + ox, foot_y, WIDTH)) {
|
||||
// Sticking: si no hay suelo pero hay slope debajo, snapear a ella
|
||||
// para transición suave suelo→slope (bajada de rampas sin caer)
|
||||
auto slope = tc.checkSlopeBelow(x_ + ox, foot_y, WIDTH);
|
||||
if (slope.on_slope) {
|
||||
y_ = slope.surface_y - HEIGHT - oy;
|
||||
slope_tile_x_ = slope.tile_x;
|
||||
slope_tile_y_ = slope.tile_y;
|
||||
slope_type_ = slope.type;
|
||||
transitionToState(State::ON_SLOPE);
|
||||
return;
|
||||
}
|
||||
vy_ = 0.0F;
|
||||
transitionToState(State::ON_AIR);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user