Compare commits
2 Commits
aa195b8cf4
...
04a80392d8
| Author | SHA1 | Date | |
|---|---|---|---|
| 04a80392d8 | |||
| 6329283124 |
@@ -1,5 +1,5 @@
|
||||
frame_width=46
|
||||
frame_height=46
|
||||
frame_width=48
|
||||
frame_height=48
|
||||
|
||||
[animation]
|
||||
name=default
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
@@ -65,6 +65,7 @@ Balloon::Balloon(float x, float y, BalloonType type, BalloonSize size, float vel
|
||||
constexpr int index = 3;
|
||||
h_ = w_ = BALLOON_SIZE[4];
|
||||
bouncing_sound_ = BALLOON_BOUNCING_SOUND[3];
|
||||
popping_sound_ = "power_ball_explosion.wav";
|
||||
power_ = score_ = menace_ = 0;
|
||||
|
||||
vy_ = 0;
|
||||
|
||||
@@ -46,10 +46,10 @@ void BalloonManager::init()
|
||||
explosions_animations_.emplace_back(Resource::get()->getAnimation("explosion4.ani"));
|
||||
|
||||
// Añade texturas
|
||||
explosions_->addTexture(1, explosions_textures_[0], explosions_animations_[0]);
|
||||
explosions_->addTexture(2, explosions_textures_[1], explosions_animations_[1]);
|
||||
explosions_->addTexture(3, explosions_textures_[2], explosions_animations_[2]);
|
||||
explosions_->addTexture(4, explosions_textures_[3], explosions_animations_[3]);
|
||||
explosions_->addTexture(0, explosions_textures_[0], explosions_animations_[0]);
|
||||
explosions_->addTexture(1, explosions_textures_[1], explosions_animations_[1]);
|
||||
explosions_->addTexture(2, explosions_textures_[2], explosions_animations_[2]);
|
||||
explosions_->addTexture(3, explosions_textures_[3], explosions_animations_[3]);
|
||||
}
|
||||
|
||||
// Actualiza
|
||||
@@ -196,12 +196,22 @@ void BalloonManager::createChildBalloon(const std::shared_ptr<Balloon> &balloon,
|
||||
{
|
||||
if (can_deploy_balloons_)
|
||||
{
|
||||
const float vx = direction == "LEFT" ? BALLOON_VELX_NEGATIVE : BALLOON_VELX_POSITIVE;
|
||||
const auto lower_size = static_cast<BalloonSize>(static_cast<int>(balloon->getSize()) - 1);
|
||||
auto b = createBalloon(0, balloon->getPosY(), balloon->getType(), lower_size, vx, balloon_speed_, 0);
|
||||
const int x = direction == "LEFT" ? balloon->getPosX() + (balloon->getWidth() / 3) : balloon->getPosX() + 2 * (balloon->getWidth() / 3);
|
||||
b->alignTo(x);
|
||||
// Calcula parametros
|
||||
const float VX = direction == "LEFT" ? BALLOON_VELX_NEGATIVE : BALLOON_VELX_POSITIVE;
|
||||
const auto SIZE = static_cast<BalloonSize>(static_cast<int>(balloon->getSize()) - 1);
|
||||
const int PARENT_HEIGHT = balloon->getHeight();
|
||||
const int CHILD_HEIGHT = BALLOON_SIZE[static_cast<int>(balloon->getSize()) - 1];
|
||||
const int Y = balloon->getPosY() + (PARENT_HEIGHT - CHILD_HEIGHT) / 2;
|
||||
const int X = direction == "LEFT" ? balloon->getPosX() + (balloon->getWidth() / 3) : balloon->getPosX() + 2 * (balloon->getWidth() / 3);
|
||||
|
||||
// Crea el globo
|
||||
auto b = createBalloon(0, Y, balloon->getType(), SIZE, VX, balloon_speed_, 0);
|
||||
|
||||
// Establece parametros
|
||||
b->alignTo(X);
|
||||
b->setVelY(b->getType() == BalloonType::BALLOON ? -2.50f : BALLOON_VELX_NEGATIVE * 2.0f);
|
||||
|
||||
// Herencia de estados
|
||||
if (balloon->isStopped())
|
||||
{
|
||||
b->stop();
|
||||
@@ -256,6 +266,7 @@ int BalloonManager::popBalloon(std::shared_ptr<Balloon> balloon)
|
||||
|
||||
if (balloon->getType() == BalloonType::POWERBALL)
|
||||
{
|
||||
balloon->pop(true);
|
||||
score = destroyAllBalloons();
|
||||
power_ball_enabled_ = false;
|
||||
balloon_deploy_counter_ = 20;
|
||||
@@ -408,7 +419,7 @@ void BalloonManager::setSounds(bool value)
|
||||
}
|
||||
}
|
||||
|
||||
// Activa o desactiva los sonidos de rebote los globos
|
||||
// Activa o desactiva los sonidos de rebote los globos
|
||||
void BalloonManager::setBouncingSounds(bool value)
|
||||
{
|
||||
bouncing_sound_enabled_ = value;
|
||||
@@ -417,12 +428,12 @@ void BalloonManager::setBouncingSounds(bool value)
|
||||
balloon->setBouncingSound(value);
|
||||
}
|
||||
}
|
||||
// Activa o desactiva los sonidos de los globos al explotar
|
||||
// Activa o desactiva los sonidos de los globos al explotar
|
||||
void BalloonManager::setPoppingSounds(bool value)
|
||||
{
|
||||
poping_sound_enabled_ = value;
|
||||
poping_sound_enabled_ = value;
|
||||
for (auto &balloon : balloons_)
|
||||
{
|
||||
balloon->setPoppingSound(value);
|
||||
balloon->setPoppingSound(value);
|
||||
}
|
||||
}
|
||||
@@ -49,7 +49,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::LOGO;
|
||||
Section::options = Section::Options::GAME_PLAY_1P;
|
||||
#else // NORMAL GAME
|
||||
Section::name = Section::Name::LOGO;
|
||||
|
||||
@@ -32,8 +32,8 @@ void Explosions::addTexture(int size, std::shared_ptr<Texture> texture, const st
|
||||
// Añade una explosión
|
||||
void Explosions::add(int x, int y, int size)
|
||||
{
|
||||
const auto index = getIndexBySize(size);
|
||||
explosions_.emplace_back(std::make_unique<AnimatedSprite>(textures_[index].texture, textures_[index].animation));
|
||||
const auto INDEX = getIndexBySize(size);
|
||||
explosions_.emplace_back(std::make_unique<AnimatedSprite>(textures_[INDEX].texture, textures_[INDEX].animation));
|
||||
explosions_.back()->setPos(x, y);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user