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

@@ -261,15 +261,13 @@ Balloon::Balloon(float x, float y, Uint8 kind, float velx, float speed, Uint16 c
stoppedCounter = 0;
blinking = false;
visible = true;
invulnerable = true;
beingCreated = true;
creationCounter = creationtimer;
creationCounterIni = creationtimer;
popping = false;
// Actualiza valores
beingCreated = creationCounter == 0 ? false : true;
invulnerable = beingCreated == false ? false : true;
// Valores iniciales dependentes del timer
beingCreated = creationCounter != 0;
invulnerable = beingCreated;
counter = 0;
travelY = 1.0f;

View File

@@ -107,9 +107,6 @@ void Item::move() {
// Si el objeto se sale por la parte inferior
if (posY + height > PLAY_AREA_BOTTOM) {
// Corrige
posY -= velY;
// Detiene el objeto
velY = 0;
velX = 0;

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]);

View File

@@ -81,7 +81,7 @@ class Player {
public:
// Constructor
Player(float x, int y, SDL_Renderer *renderer, std::vector<Texture *> texture, std::vector<std::vector<std::string> *> animations);
Player(float x, int y, SDL_Renderer *renderer, const std::vector<Texture *> &texture, const std::vector<std::vector<std::string> *> &animations);
// Destructor
~Player();
@@ -96,7 +96,7 @@ class Player {
void render();
// Pone las texturas del jugador
void setPlayerTextures(std::vector<Texture *> texture);
void setPlayerTextures(const std::vector<Texture *> &texture);
// Actua en consecuencia de la entrada recibida
void setInput(Uint8 input);