corregido un bug en la caída del personaje
This commit is contained in:
@@ -219,7 +219,6 @@ void Player::move()
|
||||
vx = 0.0f;
|
||||
}
|
||||
|
||||
|
||||
// Mueve en el eje Y y comprueba colisiones con muros
|
||||
y += vy;
|
||||
if (checkMapCollisions())
|
||||
@@ -238,8 +237,8 @@ void Player::move()
|
||||
vy = 0.0f;
|
||||
}
|
||||
|
||||
// Si no hay colisiones con los muros en el eje Y, comprueba no haya atravesado
|
||||
// el suelo de un tile atravesble
|
||||
// Si no hay colisiones con los muros en el eje Y, comprueba
|
||||
// no haya atravesado el suelo de un tile atravesble
|
||||
else
|
||||
{
|
||||
const int a = (lastPosition.y + h) / tileSize;
|
||||
@@ -265,15 +264,21 @@ void Player::move()
|
||||
}
|
||||
}
|
||||
|
||||
const bool going_down2 = vy >= 0.0f;
|
||||
const bool tile_aligned2 = ((int)y + h) % tileSize == 0;
|
||||
// Si está cayendo
|
||||
if (vy >= 0.0f)
|
||||
if (going_down2)
|
||||
{
|
||||
state = falling;
|
||||
|
||||
// Si está alineado con el tile mira el suelo (para que no lo mire si está
|
||||
// dentro de un tile atravesable y lo deje a medias)
|
||||
if (tile_aligned2)
|
||||
{
|
||||
if (isOnFloor())
|
||||
{
|
||||
state = standing;
|
||||
}
|
||||
}
|
||||
|
||||
// Si no esta enganchado a una plataforma
|
||||
if (hookedOnMovingPlatform == -1)
|
||||
|
||||
Reference in New Issue
Block a user