Cambiados muchos DEFINEs por variables de param

This commit is contained in:
2024-09-06 08:41:10 +02:00
parent c5bab7019c
commit 62b1ba84ac
23 changed files with 215 additions and 158 deletions

View File

@@ -285,9 +285,9 @@ void Balloon::allignTo(int x)
{
posX = PLAY_AREA_LEFT + 1;
}
else if ((posX + width) > PLAY_AREA_RIGHT)
else if ((posX + width) > param->game.playArea.rect.w)
{
posX = float(PLAY_AREA_RIGHT - width - 1);
posX = float(param->game.playArea.rect.w - width - 1);
}
// Posición X,Y del sprite
@@ -347,7 +347,7 @@ void Balloon::move()
posX += (velX * speed);
// Si queda fuera de pantalla, corregimos su posición y cambiamos su sentido
if ((posX < PLAY_AREA_LEFT) || (posX + width > PLAY_AREA_RIGHT))
if ((posX < PLAY_AREA_LEFT) || (posX + width > param->game.playArea.rect.w))
{
// Corrige posición
posX -= (velX * speed);
@@ -385,10 +385,10 @@ void Balloon::move()
}
// Si el globo se sale por la parte inferior
if (posY + height > PLAY_AREA_BOTTOM)
if (posY + height > param->game.playArea.rect.h)
{
// Corrige
posY = PLAY_AREA_BOTTOM - height;
posY = param->game.playArea.rect.h - height;
// Invierte colocando una velocidad por defecto
velY = -defaultVelY;
@@ -508,7 +508,7 @@ void Balloon::updateState()
posX += velX;
// Comprueba no se salga por los laterales
if ((posX < PLAY_AREA_LEFT) || (posX > (PLAY_AREA_RIGHT - width)))
if ((posX < PLAY_AREA_LEFT) || (posX > (param->game.playArea.rect.w - width)))
{
// Corrige y cambia el sentido de la velocidad
posX -= velX;