Açò ja no hi ha Cristo que ho pete

This commit is contained in:
2024-10-10 13:48:53 +02:00
parent fc8fdc5fe5
commit 9e5f41644e
7 changed files with 27 additions and 23 deletions

View File

@@ -510,8 +510,11 @@ void AnimatedSprite::setCurrentAnimation(int index)
// Actualiza las variables del objeto // Actualiza las variables del objeto
void AnimatedSprite::update() void AnimatedSprite::update()
{ {
animate(); if (enabled_)
MovingSprite::update(); {
animate();
MovingSprite::update();
}
} }
// Establece el rectangulo para un frame de una animación // Establece el rectangulo para un frame de una animación

View File

@@ -1049,7 +1049,7 @@ void Game::updateBalloonSpeed()
} }
// Explosiona un globo. Lo destruye y crea otros dos si es el caso // Explosiona un globo. Lo destruye y crea otros dos si es el caso
void Game::popBalloon(std::shared_ptr<Balloon> &balloon) void Game::popBalloon(std::shared_ptr<Balloon> balloon)
{ {
// Aumenta el poder de la fase // Aumenta el poder de la fase
increaseStageCurrentPower(1); increaseStageCurrentPower(1);
@@ -1072,11 +1072,11 @@ void Game::popBalloon(std::shared_ptr<Balloon> &balloon)
} }
else else
{ // En cualquier otro caso, crea dos globos de un tipo inferior { // En cualquier otro caso, crea dos globos de un tipo inferior
const auto bLeft = createBalloon(0, balloon->getPosY(), balloon->getKind() - 1, BALLOON_VELX_NEGATIVE, enemySpeed, 0); auto bLeft = createBalloon(0, balloon->getPosY(), balloon->getKind() - 1, BALLOON_VELX_NEGATIVE, enemySpeed, 0);
bLeft->allignTo(balloon->getPosX() + (balloon->getWidth() / 2)); bLeft->allignTo(balloon->getPosX() + (balloon->getWidth() / 2));
bLeft->setVelY(bLeft->getClass() == BALLOON_CLASS ? -2.50f : BALLOON_VELX_NEGATIVE); bLeft->setVelY(bLeft->getClass() == BALLOON_CLASS ? -2.50f : BALLOON_VELX_NEGATIVE);
const auto bRight = createBalloon(0, balloon->getPosY(), balloon->getKind() - 1, BALLOON_VELX_POSITIVE, enemySpeed, 0); auto bRight = createBalloon(0, balloon->getPosY(), balloon->getKind() - 1, BALLOON_VELX_POSITIVE, enemySpeed, 0);
bRight->allignTo(balloon->getPosX() + (balloon->getWidth() / 2)); bRight->allignTo(balloon->getPosX() + (balloon->getWidth() / 2));
bRight->setVelY(bRight->getClass() == BALLOON_CLASS ? -2.50f : BALLOON_VELX_NEGATIVE); bRight->setVelY(bRight->getClass() == BALLOON_CLASS ? -2.50f : BALLOON_VELX_NEGATIVE);

View File

@@ -277,7 +277,7 @@ private:
void updateBalloonSpeed(); void updateBalloonSpeed();
// Explosiona un globo. Lo destruye y crea otros dos si es el caso // Explosiona un globo. Lo destruye y crea otros dos si es el caso
void popBalloon(std::shared_ptr<Balloon> &balloon); void popBalloon(std::shared_ptr<Balloon> balloon);
// Explosiona un globo. Lo destruye // Explosiona un globo. Lo destruye
void destroyBalloon(std::shared_ptr<Balloon> &balloon); void destroyBalloon(std::shared_ptr<Balloon> &balloon);

View File

@@ -68,7 +68,10 @@ void MovingSprite::move()
// Muestra el sprite por pantalla // Muestra el sprite por pantalla
void MovingSprite::render() void MovingSprite::render()
{ {
texture_->render((int)x_, (int)y_, &spriteClip_, zoomW_, zoomH_, angle_, center_, currentFlip_); if (enabled_)
{
texture_->render((int)x_, (int)y_, &spriteClip_, zoomW_, zoomH_, angle_, center_, currentFlip_);
}
} }
// Obtiene el valor de la variable // Obtiene el valor de la variable
@@ -259,9 +262,12 @@ void MovingSprite::disableRotate()
// Actualiza las variables internas del objeto // Actualiza las variables internas del objeto
void MovingSprite::update() void MovingSprite::update()
{ {
move(); if (enabled_)
rotate(); {
++counter_ %= 60000; move();
rotate();
++counter_ %= 60000;
}
} }
// Cambia el sentido de la rotación // Cambia el sentido de la rotación

View File

@@ -232,7 +232,7 @@ void Screen::setVideoMode(ScreenVideoMode videoMode)
// Reinicia los shaders // Reinicia los shaders
if (options.video.shaders) if (options.video.shaders)
{ {
#ifdef SHADERS #ifndef NO_SHADERS
std::ifstream f(asset->get("crtpi.glsl").c_str()); std::ifstream f(asset->get("crtpi.glsl").c_str());
std::string source((std::istreambuf_iterator<char>(f)), std::istreambuf_iterator<char>()); std::string source((std::istreambuf_iterator<char>(f)), std::istreambuf_iterator<char>());

View File

@@ -19,20 +19,18 @@ void SmartSprite::init()
destX_ = 0; destX_ = 0;
destY_ = 0; destY_ = 0;
finished_ = false; finished_ = false;
enabled_ = false;
} }
// Actualiza la posición y comprueba si ha llegado a su destino // Actualiza la posición y comprueba si ha llegado a su destino
void SmartSprite::update() void SmartSprite::update()
{ {
MovingSprite::update(); if (enabled_)
checkMove(); {
checkFinished(); MovingSprite::update();
} checkMove();
checkFinished();
// Pinta el objeto en pantalla }
void SmartSprite::render()
{
MovingSprite::render();
} }
// Establece el valor de la variable // Establece el valor de la variable

View File

@@ -34,9 +34,6 @@ public:
// Actualiza la posición y comprueba si ha llegado a su destino // Actualiza la posición y comprueba si ha llegado a su destino
void update(); void update();
// Pinta el objeto en pantalla
void render();
// Establece el valor de la variable // Establece el valor de la variable
void setFinishedCounter(int value); void setFinishedCounter(int value);