Añadido campo ID al jugador

Las balas y los mandos utilizan ahora este ID
This commit is contained in:
2024-09-11 12:15:18 +02:00
parent 1e2f121d82
commit ecf34558f4
6 changed files with 98 additions and 26 deletions

View File

@@ -35,6 +35,7 @@ private:
SDL_Rect *playArea; // Rectangulo con la zona de juego
// Variables
int id; // Numero de identificación para el jugador
float posX; // Posicion en el eje X
int posY; // Posicion en el eje Y
float defaultPosX; // Posición inicial para el jugador
@@ -63,6 +64,7 @@ private:
Uint32 continueTicks; // Variable para poder cambiar el contador de continue en función del tiempo
int scoreBoardPanel; // Panel del marcador asociado al jugador
std::string name; // Nombre del jugador
int controllerIndex; // Indice del array de mandos que utilizará para moverse
// Actualiza el circulo de colisión a la posición del jugador
void shiftColliders();
@@ -75,7 +77,7 @@ private:
public:
// Constructor
Player(float x, int y, SDL_Rect *playArea, std::vector<Texture *> texture, std::vector<std::vector<std::string> *> animations);
Player(int id, float x, int y, SDL_Rect *playArea, std::vector<Texture *> texture, std::vector<std::vector<std::string> *> animations);
// Destructor
~Player();
@@ -229,4 +231,13 @@ public:
// Obtiene el nombre del jugador
std::string getName();
// Establece el mando que usará para ser controlado
void setController(int index);
// Obtiene el mando que usa para ser controlado
int getController();
// Obtiene el "id" del jugador
int getId();
};