Cambiados muchos DEFINEs por variables de param
This commit is contained in:
@@ -2,8 +2,10 @@
|
||||
#include "bullet.h"
|
||||
|
||||
// Constructor
|
||||
Bullet::Bullet(int x, int y, int kind, bool poweredUp, int owner, Texture *texture)
|
||||
Bullet::Bullet(int x, int y, int kind, bool poweredUp, int owner, SDL_Rect *playArea, Texture *texture)
|
||||
{
|
||||
// Rectangulo con la zona de juego
|
||||
this->playArea = playArea;
|
||||
|
||||
// Posición inicial del objeto
|
||||
posX = x;
|
||||
@@ -15,7 +17,7 @@ Bullet::Bullet(int x, int y, int kind, bool poweredUp, int owner, Texture *textu
|
||||
|
||||
// Crea el sprite
|
||||
sprite = new Sprite({x, y, width, height}, texture);
|
||||
|
||||
|
||||
// Velocidad inicial en el eje Y
|
||||
velY = -3;
|
||||
|
||||
@@ -106,7 +108,7 @@ Uint8 Bullet::move()
|
||||
posX += velX;
|
||||
|
||||
// Si el objeto se sale del area de juego por los laterales
|
||||
if ((posX < PLAY_AREA_LEFT - width) || (posX > PLAY_AREA_RIGHT))
|
||||
if ((posX < PLAY_AREA_LEFT - width) || (posX > playArea->w))
|
||||
{
|
||||
// Se deshabilita
|
||||
kind = NO_KIND;
|
||||
|
||||
Reference in New Issue
Block a user