Afegits efectes de audio nous

Retocats alguns efectes de audio al afagar items per a no solapar dos audios
This commit is contained in:
2025-01-25 18:11:24 +01:00
parent e60938cb19
commit 60302004f4
6 changed files with 27 additions and 3 deletions

BIN
data/sound/debian_drop.wav Normal file

Binary file not shown.

BIN
data/sound/debian_pick.wav Normal file

Binary file not shown.

BIN
data/sound/tabe_hit.wav Normal file

Binary file not shown.

View File

@@ -415,6 +415,9 @@ void Director::setFileList()
Asset::get()->add(prefix + "/data/sound/voice_no.wav", AssetType::SOUND); Asset::get()->add(prefix + "/data/sound/voice_no.wav", AssetType::SOUND);
Asset::get()->add(prefix + "/data/sound/voice_power_up.wav", AssetType::SOUND); Asset::get()->add(prefix + "/data/sound/voice_power_up.wav", AssetType::SOUND);
Asset::get()->add(prefix + "/data/sound/walk.wav", AssetType::SOUND); Asset::get()->add(prefix + "/data/sound/walk.wav", AssetType::SOUND);
Asset::get()->add(prefix + "/data/sound/debian_drop.wav", AssetType::SOUND);
Asset::get()->add(prefix + "/data/sound/debian_pick.wav", AssetType::SOUND);
Asset::get()->add(prefix + "/data/sound/tabe_hit.wav", AssetType::SOUND);
// Shaders // Shaders
Asset::get()->add(prefix + "/data/shaders/crtpi_256.glsl", AssetType::DATA); Asset::get()->add(prefix + "/data/shaders/crtpi_256.glsl", AssetType::DATA);

View File

@@ -467,6 +467,7 @@ void Game::checkPlayerItemCollision(std::shared_ptr<Player> &player)
player->addScore(1000); player->addScore(1000);
const auto x = item->getPosX() + (item->getWidth() - game_text_textures_.at(0)->getWidth()) / 2; const auto x = item->getPosX() + (item->getWidth() - game_text_textures_.at(0)->getWidth()) / 2;
createItemText(x, game_text_textures_.at(0)); createItemText(x, game_text_textures_.at(0));
JA_PlaySound(Resource::get()->getSound("itempickup.wav"));
break; break;
} }
case ItemType::GAVINA: case ItemType::GAVINA:
@@ -474,6 +475,7 @@ void Game::checkPlayerItemCollision(std::shared_ptr<Player> &player)
player->addScore(2500); player->addScore(2500);
const auto x = item->getPosX() + (item->getWidth() - game_text_textures_.at(1)->getWidth()) / 2; const auto x = item->getPosX() + (item->getWidth() - game_text_textures_.at(1)->getWidth()) / 2;
createItemText(x, game_text_textures_.at(1)); createItemText(x, game_text_textures_.at(1));
JA_PlaySound(Resource::get()->getSound("itempickup.wav"));
break; break;
} }
case ItemType::PACMAR: case ItemType::PACMAR:
@@ -481,6 +483,7 @@ void Game::checkPlayerItemCollision(std::shared_ptr<Player> &player)
player->addScore(5000); player->addScore(5000);
const auto x = item->getPosX() + (item->getWidth() - game_text_textures_.at(2)->getWidth()) / 2; const auto x = item->getPosX() + (item->getWidth() - game_text_textures_.at(2)->getWidth()) / 2;
createItemText(x, game_text_textures_.at(2)); createItemText(x, game_text_textures_.at(2));
JA_PlaySound(Resource::get()->getSound("itempickup.wav"));
break; break;
} }
case ItemType::DEBIAN: case ItemType::DEBIAN:
@@ -488,6 +491,7 @@ void Game::checkPlayerItemCollision(std::shared_ptr<Player> &player)
player->addScore(100000); player->addScore(100000);
const auto x = item->getPosX() + (item->getWidth() - game_text_textures_.at(6)->getWidth()) / 2; const auto x = item->getPosX() + (item->getWidth() - game_text_textures_.at(6)->getWidth()) / 2;
createItemText(x, game_text_textures_.at(6)); createItemText(x, game_text_textures_.at(6));
JA_PlaySound(Resource::get()->getSound("debian_pick.wav"));
break; break;
} }
case ItemType::CLOCK: case ItemType::CLOCK:
@@ -495,6 +499,7 @@ void Game::checkPlayerItemCollision(std::shared_ptr<Player> &player)
enableTimeStopItem(); enableTimeStopItem();
const auto x = item->getPosX() + (item->getWidth() - game_text_textures_.at(5)->getWidth()) / 2; const auto x = item->getPosX() + (item->getWidth() - game_text_textures_.at(5)->getWidth()) / 2;
createItemText(x, game_text_textures_.at(5)); createItemText(x, game_text_textures_.at(5));
JA_PlaySound(Resource::get()->getSound("itempickup.wav"));
break; break;
} }
case ItemType::COFFEE: case ItemType::COFFEE:
@@ -528,7 +533,6 @@ void Game::checkPlayerItemCollision(std::shared_ptr<Player> &player)
} }
updateHiScore(); updateHiScore();
JA_PlaySound(Resource::get()->getSound("itempickup.wav"));
item->disable(); item->disable();
} }
} }
@@ -547,7 +551,24 @@ void Game::checkBulletCollision()
tabe_->setState(TabeState::HIT); tabe_->setState(TabeState::HIT);
bullet->disable(); bullet->disable();
auto pos = tabe_->getCollider(); auto pos = tabe_->getCollider();
createItem(tabe_->tryToGetBonus() ? ItemType::DEBIAN : ItemType::COFFEE, pos.x, pos.y); if (tabe_->tryToGetBonus())
{
createItem(ItemType::DEBIAN, pos.x, pos.y);
JA_PlaySound(Resource::get()->getSound("debian_drop.wav"));
}
else
{
if (rand() % 3 == 0)
{
createItem(ItemType::COFFEE, pos.x, pos.y);
// JA_PlaySound(Resource::get()->getSound("itemdrop.wav"));
}
else
{
// JA_PlaySound(Resource::get()->getSound("tabe_hit.wav"));
}
JA_PlaySound(Resource::get()->getSound("tabe_hit.wav"));
}
break; break;
} }

View File

@@ -189,7 +189,7 @@ void Tabe::updateState()
// Intenta obtener el bonus // Intenta obtener el bonus
bool Tabe::tryToGetBonus() bool Tabe::tryToGetBonus()
{ {
if (has_bonus_ && rand() % 10 == 0) if (has_bonus_ && rand() % 8 == 0)
{ {
has_bonus_ = false; has_bonus_ = false;
return true; return true;