bug fix: en el modo demo la powerball feia ruido.

Resol #84
This commit is contained in:
2025-08-24 14:57:08 +02:00
parent 6e81b6e60c
commit fe950e6f17
2 changed files with 18 additions and 26 deletions

View File

@@ -209,6 +209,9 @@ void BalloonManager::createPowerBall() {
balloons_.emplace_back(std::make_unique<Balloon>(POS_X[LUCK], POS_Y, Balloon::Type::POWERBALL, Balloon::Size::EXTRALARGE, VEL_X[LUCK], balloon_speed_, CREATION_TIME, play_area_, balloon_textures_[4], balloon_animations_[4]));
balloons_.back()->setInvulnerable(true);
balloons_.back()->setSound(sound_enabled_);
balloons_.back()->setBouncingSound(bouncing_sound_enabled_);
balloons_.back()->setPoppingSound(poping_sound_enabled_);
power_ball_enabled_ = true;
power_ball_counter_ = Balloon::POWERBALL_COUNTER;

View File

@@ -1463,20 +1463,16 @@ void Game::initDemo(Player::Id player_id) {
setState(State::PLAYING);
// Aleatoriza la asignación del fichero con los datos del modo demostracion
{
const auto DEMO1 = rand() % 2;
const auto DEMO2 = (DEMO1 == 0) ? 1 : 0;
demo_.data.emplace_back(Resource::get()->getDemoData(DEMO1));
demo_.data.emplace_back(Resource::get()->getDemoData(DEMO2));
}
// Selecciona una pantalla al azar
{
constexpr auto NUM_DEMOS = 3;
const auto DEMO = rand() % NUM_DEMOS;
constexpr std::array<int, NUM_DEMOS> STAGES = {0, 3, 5};
stage_manager_->jumpToStage(STAGES.at(DEMO));
}
// Activa o no al otro jugador
if (rand() % 3 != 0) {
@@ -1879,20 +1875,17 @@ void Game::handleDebugEvents(const SDL_Event &event) {
static int formation_id_ = 0;
if (event.type == SDL_EVENT_KEY_DOWN && static_cast<int>(event.key.repeat) == 0) {
switch (event.key.key) {
case SDLK_1: // Crea una powerball
{
case SDLK_1: { // Crea una powerball
balloon_manager_->createPowerBall();
break;
}
case SDLK_2: // Activa o desactiva la aparición de globos
{
case SDLK_2: { // Activa o desactiva la aparición de globos
static bool deploy_balloons_ = true;
deploy_balloons_ = !deploy_balloons_;
balloon_manager_->enableBalloonDeployment(deploy_balloons_);
break;
}
case SDLK_3: // Activa el modo para pasar el juego automaticamente
{
case SDLK_3: { // Activa el modo para pasar el juego automaticamente
auto_pop_balloons_ = !auto_pop_balloons_;
Notifier::get()->show({"auto advance: " + boolToString(auto_pop_balloons_)});
if (auto_pop_balloons_) {
@@ -1902,24 +1895,20 @@ void Game::handleDebugEvents(const SDL_Event &event) {
balloon_manager_->enableBalloonDeployment(!auto_pop_balloons_);
break;
}
case SDLK_4: // Suelta un item
{
case SDLK_4: { // Suelta un item
createItem(ItemType::CLOCK, players_.at(0)->getPosX(), players_.at(0)->getPosY() - 40);
break;
}
case SDLK_5: // 5.000
{
case SDLK_5: { // 5.000
const int X = players_.at(0)->getPosX() + ((Player::WIDTH - game_text_textures_[3]->getWidth()) / 2);
createItemText(X, game_text_textures_.at(2));
break;
}
case SDLK_6: // Crea un mensaje
{
case SDLK_6: { // Crea un mensaje
createMessage({paths_.at(0), paths_.at(1)}, Resource::get()->getTexture("game_text_get_ready"));
break;
}
case SDLK_7: // 100.000
{
case SDLK_7: { // 100.000
const int X = players_.at(0)->getPosX() + ((Player::WIDTH - game_text_textures_[3]->getWidth()) / 2);
createItemText(X, game_text_textures_.at(6));
break;