Trabajando en las colisiones con plataformas moviles
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user