This commit is contained in:
2026-04-17 22:20:37 +02:00
parent 513eacf356
commit 20b9a95619
38 changed files with 310 additions and 622 deletions

View File

@@ -8,7 +8,7 @@
#include "game/defaults.hpp" // for PLAY_AREA_LEFT, PLAY_AREA_RIGHT
// Constructor
Player::Player(float x, int y, SDL_Renderer *renderer, std::vector<Texture *> texture, std::vector<std::vector<std::string> *> animations) {
Player::Player(float x, int y, SDL_Renderer *renderer, const std::vector<Texture *> &texture, const std::vector<std::vector<std::string> *> &animations) {
// Copia los punteros
this->renderer = renderer;
@@ -189,19 +189,12 @@ void Player::render() {
// Establece el estado del jugador cuando camina
void Player::setWalkingStatus(Uint8 status) {
// Si cambiamos de estado, reiniciamos la animación
if (statusWalking != status) {
statusWalking = status;
// legsSprite->setCurrentFrame(0);
}
statusWalking = status;
}
// Establece el estado del jugador cuando dispara
void Player::setFiringStatus(Uint8 status) {
// Si cambiamos de estado, reiniciamos la animación
if (statusFiring != status) {
statusFiring = status;
}
statusFiring = status;
}
// Establece la animación correspondiente al estado
@@ -521,7 +514,7 @@ void Player::updatePowerUpHeadOffset() {
}
// Pone las texturas del jugador
void Player::setPlayerTextures(std::vector<Texture *> texture) {
void Player::setPlayerTextures(const std::vector<Texture *> &texture) {
headSprite->setTexture(texture[0]);
bodySprite->setTexture(texture[1]);
legsSprite->setTexture(texture[2]);