Trabajando en las colisiones con plataformas moviles

This commit is contained in:
2022-08-26 21:25:51 +02:00
parent dda1e049c6
commit 6b7c49aecd
7 changed files with 49 additions and 3 deletions

View File

@@ -255,6 +255,13 @@ void Player::move()
vy = 0.0f;
y -= ((int)y + h) % tileSize;
}
// Tiene uno de los pies sobre una plataforma móvil
else if (isOnMovingPlatform())
{
state = standing;
vy = 0.0f;
y = SDKJSGHK - h-1;
}
// Tiene ambos pies sobre el vacío
else
{
@@ -308,12 +315,17 @@ bool Player::isOnFloor()
bool Player::isOnMovingPlatform()
{
bool onMovingPlatform = false;
SDKJSGHK = 0;
updateFeet();
for (auto f : underFeet)
{
onMovingPlatform |= (map->getActorName(map->actorCollision(f)) == a_moving_platform);
if (onMovingPlatform)
{
SDKJSGHK = map->getActorCollider(map->actorCollision(f));
}
}
return onMovingPlatform;
}