els jugadors ara es dibuixen al fondo de la resta de elements
modificat la veu de 'thankyou' per a que incloga el sonido de començar a jugar clasic els globos ja son ells qui fan el seu propi so
This commit is contained in:
@@ -38,7 +38,8 @@ Balloon::Balloon(float x, float y, BalloonType type, BalloonSize size, float vel
|
||||
power_ = BALLOON_POWER[index];
|
||||
menace_ = BALLOON_MENACE[index];
|
||||
score_ = BALLOON_SCORE[index];
|
||||
sound_ = BALLOON_SOUND[index];
|
||||
bouncing_sound_ = BALLOON_BOUNCING_SOUND[index];
|
||||
popping_sound_ = BALLOON_POPPING_SOUND[index];
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -53,7 +54,8 @@ Balloon::Balloon(float x, float y, BalloonType type, BalloonSize size, float vel
|
||||
power_ = BALLOON_POWER[index];
|
||||
menace_ = BALLOON_MENACE[index];
|
||||
score_ = BALLOON_SCORE[index];
|
||||
sound_ = BALLOON_SOUND[index];
|
||||
bouncing_sound_ = BALLOON_BOUNCING_SOUND[index];
|
||||
popping_sound_ = BALLOON_POPPING_SOUND[index];
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -62,7 +64,7 @@ Balloon::Balloon(float x, float y, BalloonType type, BalloonSize size, float vel
|
||||
{
|
||||
constexpr int index = 3;
|
||||
h_ = w_ = BALLOON_SIZE[4];
|
||||
sound_ = BALLOON_SOUND[3];
|
||||
bouncing_sound_ = BALLOON_BOUNCING_SOUND[3];
|
||||
power_ = score_ = menace_ = 0;
|
||||
|
||||
vy_ = 0;
|
||||
@@ -162,7 +164,8 @@ void Balloon::move()
|
||||
const float max_x = play_area_.x + play_area_.w - w_ + clip;
|
||||
if (x_ < min_x || x_ > max_x)
|
||||
{
|
||||
playSound();
|
||||
if (bouncing_sound_enabled_)
|
||||
playSound(bouncing_sound_);
|
||||
x_ = std::clamp(x_, min_x, max_x);
|
||||
vx_ = -vx_;
|
||||
// Activa el efecto de rebote o invierte la rotación
|
||||
@@ -185,7 +188,8 @@ void Balloon::move()
|
||||
const int min_y = play_area_.y;
|
||||
if (y_ < min_y)
|
||||
{
|
||||
playSound();
|
||||
if (bouncing_sound_enabled_)
|
||||
playSound(bouncing_sound_);
|
||||
y_ = min_y;
|
||||
vy_ = -vy_;
|
||||
enableBounce();
|
||||
@@ -196,7 +200,8 @@ void Balloon::move()
|
||||
const int max_y = play_area_.y + play_area_.h - h_;
|
||||
if (y_ > max_y)
|
||||
{
|
||||
playSound();
|
||||
if (bouncing_sound_enabled_)
|
||||
playSound(bouncing_sound_);
|
||||
y_ = max_y;
|
||||
vy_ = -default_vy_;
|
||||
if (type_ != BalloonType::POWERBALL)
|
||||
@@ -409,11 +414,24 @@ void Balloon::useNormalColor()
|
||||
setAnimation();
|
||||
}
|
||||
|
||||
// Reproduce el sonido al rebotar
|
||||
void Balloon::playSound()
|
||||
// Reproduce sonido
|
||||
void Balloon::playSound(const std::string &name)
|
||||
{
|
||||
if (sound_enabled_)
|
||||
if (!sound_enabled_)
|
||||
return;
|
||||
|
||||
static auto audio = Audio::get();
|
||||
audio->playSound(name);
|
||||
}
|
||||
|
||||
// Explota el globo
|
||||
void Balloon::pop(bool should_sound)
|
||||
{
|
||||
if (should_sound)
|
||||
{
|
||||
Audio::get()->playSound(sound_);
|
||||
if (poping_sound_enabled_)
|
||||
playSound(popping_sound_);
|
||||
}
|
||||
|
||||
enabled_ = false;
|
||||
}
|
||||
Reference in New Issue
Block a user