La powerball ja no es pot destruir fins que no ha fet un rebot

This commit is contained in:
2025-01-04 16:57:50 +01:00
parent 7b6d429bed
commit b53ee12f56
5 changed files with 28 additions and 23 deletions

View File

@@ -1,9 +1,9 @@
frame_width=46
frame_height=46
frame_width=49
frame_height=49
[animation]
name=powerball
speed=10
loop=-1
frames=0
frames=1
[/animation]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -107,15 +107,27 @@ void Balloon::render()
{
if (type_ == BalloonType::POWERBALL)
{
// Renderizado para la PowerBall
SDL_Point p = {24, 24};
sprite_->setRotatingCenter(&p);
sprite_->render();
// Renderiza el fondo azul
{
auto sp = std::make_unique<Sprite>(sprite_->getTexture(), sprite_->getPosition());
sp->setSpriteClip(0, 0, BALLOON_SIZE[4], BALLOON_SIZE[4]);
sp->render();
}
// Renderiza la estrella
if (!invulnerable_)
{
SDL_Point p = {24, 24};
sprite_->setRotatingCenter(&p);
sprite_->render();
}
// Añade la máscara del borde y los reflejos
auto sp = std::make_unique<Sprite>(sprite_->getTexture(), sprite_->getPosition());
sp->setSpriteClip(BALLOON_SIZE[4], 0, BALLOON_SIZE[4], BALLOON_SIZE[4]);
sp->render();
{
auto sp = std::make_unique<Sprite>(sprite_->getTexture(), sprite_->getPosition());
sp->setSpriteClip(BALLOON_SIZE[4] * 2, 0, BALLOON_SIZE[4], BALLOON_SIZE[4]);
sp->render();
}
}
else
{
@@ -167,18 +179,6 @@ void Balloon::move()
// Mueve el globo en vertical
y_ += vy_ * speed_;
// Colisión en la parte superior de la zona de juego excepto para la PowerBall
/*if (type_ != BalloonType::POWERBALL)
{
const int min_y = play_area_.y;
if (y_ < min_y)
{
y_ = min_y;
vy_ = -vy_;
enableBounce();
}
}*/
// Colisión en la parte superior solo si el globo va de subida
if (vy_ < 0)
{
@@ -203,6 +203,10 @@ void Balloon::move()
{
enableBounce();
}
else
{
setInvulnerable(false);
}
}
/*

View File

@@ -220,6 +220,7 @@ void BalloonManager::createPowerBall()
const float vx[values] = {BALLOON_VELX_POSITIVE, BALLOON_VELX_POSITIVE, BALLOON_VELX_POSITIVE, BALLOON_VELX_NEGATIVE, BALLOON_VELX_NEGATIVE, BALLOON_VELX_NEGATIVE};
balloons_.emplace_back(std::make_unique<Balloon>(x[luck], pos_y, BalloonType::POWERBALL, BalloonSize::SIZE4, vx[luck], balloon_speed_, creation_time, play_area_, balloon_textures_[4], balloon_animations_[4]));
balloons_.back()->setInvulnerable(true);
power_ball_enabled_ = true;
power_ball_counter_ = POWERBALL_COUNTER;

View File

@@ -54,7 +54,7 @@ Director::Director(int argc, const char *argv[])
section::name = section::Name::GAME;
section::options = section::Options::GAME_PLAY_1P;
#elif DEBUG
section::name = section::Name::CREDITS;
section::name = section::Name::GAME;
#else // NORMAL GAME
section::name = section::Name::LOGO;
section::attract_mode = section::AttractMode::TITLE_TO_DEMO;