Eliminat "const.h"

This commit is contained in:
2024-09-28 10:16:35 +02:00
parent 8d263931b2
commit f2cc0dc352
28 changed files with 74 additions and 91 deletions

View File

@@ -1,5 +1,5 @@
#include "const.h"
#include "item.h"
#include "param.h"
// Constructor
Item::Item(int kind, float x, float y, SDL_Rect *playArea, Texture *texture, std::vector<std::string> *animation)
@@ -52,9 +52,9 @@ void Item::allignTo(int x)
{
posX = float(x - (width / 2));
if (posX < PLAY_AREA_LEFT)
if (posX < param.game.playArea.rect.x)
{
posX = PLAY_AREA_LEFT + 1;
posX = param.game.playArea.rect.x + 1;
}
else if ((posX + width) > playArea->w)
{
@@ -99,7 +99,7 @@ void Item::move()
velY += accelY;
// Si queda fuera de pantalla, corregimos su posición y cambiamos su sentido
if ((posX < PLAY_AREA_LEFT) || (posX + width > playArea->w))
if ((posX < param.game.playArea.rect.x) || (posX + width > playArea->w))
{
// Corregir posición
posX -= velX;
@@ -109,10 +109,10 @@ void Item::move()
}
// Si se sale por arriba rebota (excepto la maquina de café)
if ((posY < PLAY_AREA_TOP) && !(kind == ITEM_COFFEE_MACHINE))
if ((posY < param.game.playArea.rect.y) && !(kind == ITEM_COFFEE_MACHINE))
{
// Corrige
posY = PLAY_AREA_TOP;
posY = param.game.playArea.rect.y;
// Invierte el sentido
velY = -velY;