Dźwięk wybuchu przy trafieniu w meteoryt
This commit is contained in:
BIN
assets/sounds/explosion.mp3
Normal file
BIN
assets/sounds/explosion.mp3
Normal file
Binary file not shown.
2
main.cpp
2
main.cpp
@@ -31,6 +31,7 @@ int main()
|
|||||||
audioManager.loadSoundEffect("shoot", "../assets/sounds/shoot.ogg");
|
audioManager.loadSoundEffect("shoot", "../assets/sounds/shoot.ogg");
|
||||||
audioManager.loadSoundEffect("shoot_alt", "../assets/sounds/shoot_alt.ogg");
|
audioManager.loadSoundEffect("shoot_alt", "../assets/sounds/shoot_alt.ogg");
|
||||||
audioManager.loadSoundEffect("fail", "../assets/sounds/fail.mp3");
|
audioManager.loadSoundEffect("fail", "../assets/sounds/fail.mp3");
|
||||||
|
audioManager.loadSoundEffect("explosion", "../assets/sounds/explosion.mp3");
|
||||||
|
|
||||||
// TODO: Przenieść tworzenie statku wewnątrz klasy Plansza
|
// TODO: Przenieść tworzenie statku wewnątrz klasy Plansza
|
||||||
Player ship(mainWindow.getSize().x / 2, mainWindow.getSize().y - 100, "../assets/ship/Dreadnought-Base.png"); // tworzenie statku
|
Player ship(mainWindow.getSize().x / 2, mainWindow.getSize().y - 100, "../assets/ship/Dreadnought-Base.png"); // tworzenie statku
|
||||||
@@ -145,6 +146,7 @@ int main()
|
|||||||
bool meteorHit = false;
|
bool meteorHit = false;
|
||||||
for (auto bulletIt = ship.getBullets().begin(); bulletIt != ship.getBullets().end(); ) {
|
for (auto bulletIt = ship.getBullets().begin(); bulletIt != ship.getBullets().end(); ) {
|
||||||
if (meteorIt->getSprite().getGlobalBounds().intersects(bulletIt->getSprite().getGlobalBounds())) {
|
if (meteorIt->getSprite().getGlobalBounds().intersects(bulletIt->getSprite().getGlobalBounds())) {
|
||||||
|
audioManager.playSoundEffect("explosion");
|
||||||
bulletIt = ship.getBullets().erase(bulletIt);
|
bulletIt = ship.getBullets().erase(bulletIt);
|
||||||
meteorIt = plansza.getMeteors().erase(meteorIt);
|
meteorIt = plansza.getMeteors().erase(meteorIt);
|
||||||
meteorHit = true;
|
meteorHit = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user