Solo sube las rampas desde el principio. Las atraviesa al saltar

This commit is contained in:
2022-09-10 18:31:28 +02:00
parent edaa59af7d
commit 0b405e4f99
2 changed files with 19 additions and 13 deletions

View File

@@ -260,8 +260,10 @@ void Player::move()
x = pos + 1; x = pos + 1;
} }
// Si ha tocado alguna rampa, asciende // Si ha tocado alguna rampa mientras camina (sin saltar), asciende
v_line_t leftSide = {(int)x, (int)y, (int)y + h - 1}; if (state != s_jumping)
{
v_line_t leftSide = {(int)x, (int)y + h - 2, (int)y + h - 1};
const int ly = room->checkLeftSlopes(&leftSide); const int ly = room->checkLeftSlopes(&leftSide);
if (ly > -1) if (ly > -1)
{ {
@@ -269,6 +271,7 @@ void Player::move()
setState(s_standing); setState(s_standing);
} }
} }
}
// Se mueve hacia la derecha // Se mueve hacia la derecha
else if (vx > 0.0f) else if (vx > 0.0f)
@@ -293,8 +296,10 @@ void Player::move()
x = pos - w; x = pos - w;
} }
// Si ha tocado alguna rampa, asciende // Si ha tocado alguna rampa mientras camina (sin saltar), asciende
v_line_t rightSide = {(int)x + w - 1, (int)y, (int)y + h - 1}; if (state != s_jumping)
{
v_line_t rightSide = {(int)x + w - 1, (int)y + h - 2, (int)y + h - 1};
const int ry = room->checkRightSlopes(&rightSide); const int ry = room->checkRightSlopes(&rightSide);
if (ry > -1) if (ry > -1)
{ {
@@ -302,6 +307,7 @@ void Player::move()
setState(s_standing); setState(s_standing);
} }
} }
}
// Si ha salido del suelo, el jugador cae // Si ha salido del suelo, el jugador cae
if (state == s_standing && !isOnFloor()) if (state == s_standing && !isOnFloor())

View File

@@ -488,7 +488,7 @@ void Room::fillMapTexture()
} }
// LeftSlopes // LeftSlopes
if (false) if (true)
{ {
for (auto l : leftSlopes) for (auto l : leftSlopes)
{ {