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