Corregido bug en el movimiento de los enemigos
This commit is contained in:
@@ -64,7 +64,20 @@ void Enemy::checkPath()
|
||||
{
|
||||
if (sprite->getPosX() > x2 || sprite->getPosX() < x1)
|
||||
{
|
||||
// Recoloca
|
||||
if (sprite->getPosX() > x2)
|
||||
{
|
||||
sprite->setPosX(x2);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprite->setPosX(x1);
|
||||
}
|
||||
|
||||
// Cambia el sentido
|
||||
sprite->setVelX(sprite->getVelX() * (-1));
|
||||
|
||||
// Invierte el sprite
|
||||
if (doFlip)
|
||||
{
|
||||
sprite->flipH();
|
||||
@@ -73,7 +86,20 @@ void Enemy::checkPath()
|
||||
|
||||
if (sprite->getPosY() > y2 || sprite->getPosY() < y1)
|
||||
{
|
||||
// Recoloca
|
||||
if (sprite->getPosY() > y2)
|
||||
{
|
||||
sprite->setPosY(y2);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprite->setPosY(y1);
|
||||
}
|
||||
|
||||
// Cambia el sentido
|
||||
sprite->setVelY(sprite->getVelY() * (-1));
|
||||
|
||||
// Invierte el sprite
|
||||
if (doFlip)
|
||||
{
|
||||
sprite->flipH();
|
||||
|
||||
Reference in New Issue
Block a user