diff --git a/data/sound/debian_drop.wav b/data/sound/debian_drop.wav new file mode 100644 index 0000000..75a3390 Binary files /dev/null and b/data/sound/debian_drop.wav differ diff --git a/data/sound/debian_pick.wav b/data/sound/debian_pick.wav new file mode 100644 index 0000000..1ef21e8 Binary files /dev/null and b/data/sound/debian_pick.wav differ diff --git a/data/sound/tabe_hit.wav b/data/sound/tabe_hit.wav new file mode 100644 index 0000000..f4c1581 Binary files /dev/null and b/data/sound/tabe_hit.wav differ diff --git a/source/director.cpp b/source/director.cpp index ffed3d6..aed8ab0 100644 --- a/source/director.cpp +++ b/source/director.cpp @@ -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_power_up.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 Asset::get()->add(prefix + "/data/shaders/crtpi_256.glsl", AssetType::DATA); diff --git a/source/game.cpp b/source/game.cpp index 480fde6..56811cf 100644 --- a/source/game.cpp +++ b/source/game.cpp @@ -467,6 +467,7 @@ void Game::checkPlayerItemCollision(std::shared_ptr &player) player->addScore(1000); const auto x = item->getPosX() + (item->getWidth() - game_text_textures_.at(0)->getWidth()) / 2; createItemText(x, game_text_textures_.at(0)); + JA_PlaySound(Resource::get()->getSound("itempickup.wav")); break; } case ItemType::GAVINA: @@ -474,6 +475,7 @@ void Game::checkPlayerItemCollision(std::shared_ptr &player) player->addScore(2500); const auto x = item->getPosX() + (item->getWidth() - game_text_textures_.at(1)->getWidth()) / 2; createItemText(x, game_text_textures_.at(1)); + JA_PlaySound(Resource::get()->getSound("itempickup.wav")); break; } case ItemType::PACMAR: @@ -481,6 +483,7 @@ void Game::checkPlayerItemCollision(std::shared_ptr &player) player->addScore(5000); const auto x = item->getPosX() + (item->getWidth() - game_text_textures_.at(2)->getWidth()) / 2; createItemText(x, game_text_textures_.at(2)); + JA_PlaySound(Resource::get()->getSound("itempickup.wav")); break; } case ItemType::DEBIAN: @@ -488,6 +491,7 @@ void Game::checkPlayerItemCollision(std::shared_ptr &player) player->addScore(100000); const auto x = item->getPosX() + (item->getWidth() - game_text_textures_.at(6)->getWidth()) / 2; createItemText(x, game_text_textures_.at(6)); + JA_PlaySound(Resource::get()->getSound("debian_pick.wav")); break; } case ItemType::CLOCK: @@ -495,6 +499,7 @@ void Game::checkPlayerItemCollision(std::shared_ptr &player) enableTimeStopItem(); const auto x = item->getPosX() + (item->getWidth() - game_text_textures_.at(5)->getWidth()) / 2; createItemText(x, game_text_textures_.at(5)); + JA_PlaySound(Resource::get()->getSound("itempickup.wav")); break; } case ItemType::COFFEE: @@ -528,7 +533,6 @@ void Game::checkPlayerItemCollision(std::shared_ptr &player) } updateHiScore(); - JA_PlaySound(Resource::get()->getSound("itempickup.wav")); item->disable(); } } @@ -547,7 +551,24 @@ void Game::checkBulletCollision() tabe_->setState(TabeState::HIT); bullet->disable(); 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; } diff --git a/source/tabe.cpp b/source/tabe.cpp index 3e00fc0..08bcbc1 100644 --- a/source/tabe.cpp +++ b/source/tabe.cpp @@ -189,7 +189,7 @@ void Tabe::updateState() // Intenta obtener el bonus bool Tabe::tryToGetBonus() { - if (has_bonus_ && rand() % 10 == 0) + if (has_bonus_ && rand() % 8 == 0) { has_bonus_ = false; return true;