Ya baja por las rampas
This commit is contained in:
@@ -271,6 +271,12 @@ void Player::move()
|
||||
setState(s_standing);
|
||||
}
|
||||
}
|
||||
|
||||
// Si está bajando la rampa, recoloca al jugador
|
||||
if (isOnDownSlope())
|
||||
{
|
||||
y += 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Se mueve hacia la derecha
|
||||
@@ -307,6 +313,12 @@ void Player::move()
|
||||
setState(s_standing);
|
||||
}
|
||||
}
|
||||
|
||||
// Si está bajando la rampa, recoloca al jugador
|
||||
if (isOnDownSlope())
|
||||
{
|
||||
y += 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Si ha salido del suelo, el jugador cae
|
||||
@@ -557,6 +569,30 @@ bool Player::isOnFloor()
|
||||
return onFloor;
|
||||
}
|
||||
|
||||
// Comprueba si el jugador está sobre una rampa hacia abajo
|
||||
bool Player::isOnDownSlope()
|
||||
{
|
||||
bool onSlope = false;
|
||||
|
||||
updateFeet();
|
||||
|
||||
// Cuando el jugador baja una escalera, se queda volando
|
||||
// Hay que mirar otro pixel más por debajo
|
||||
underFeet[0].y += 1;
|
||||
underFeet[1].y += 1;
|
||||
|
||||
// Comprueba las rampas
|
||||
onSlope |= room->checkLeftSlopes(&underFeet[0]);
|
||||
onSlope |= room->checkRightSlopes(&underFeet[1]);
|
||||
|
||||
if (onSlope)
|
||||
{
|
||||
debug->add("ONSLOPE");
|
||||
}
|
||||
|
||||
return onSlope;
|
||||
}
|
||||
|
||||
// Comprueba que el jugador no atraviese ninguna pared
|
||||
bool Player::checkWalls()
|
||||
{
|
||||
|
||||
@@ -91,6 +91,9 @@ public:
|
||||
// Comprueba si el jugador tiene suelo debajo de los pies
|
||||
bool isOnFloor();
|
||||
|
||||
// Comprueba si el jugador está sobre una rampa hacia abajo
|
||||
bool isOnDownSlope();
|
||||
|
||||
// Comprueba que el jugador no atraviese ninguna pared
|
||||
bool checkWalls();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user