diff --git a/main.cpp b/main.cpp index 51ec2c8..d855c25 100644 --- a/main.cpp +++ b/main.cpp @@ -69,14 +69,18 @@ int main() } } + // TODO: Przerobić tak aby strzelanie odbywało się bez użycia warunku zewnętrzenego + // Ale w tym przypadku trzeba będzie przenieść obiekt dźwięku wewnątrz klasy Bullet // strzelanie ze statku - if(sf::Mouse::isButtonPressed(sf::Mouse::Left)) { - ship.shoot(); - audioManager.playSoundEffect("shoot", 70.f); // Odtworzenie dźwięku wystrzału - } - if(sf::Mouse::isButtonPressed(sf::Mouse::Right)) { - ship.alternate_shoot(); - audioManager.playSoundEffect("shoot_alt", 70.f); // Odtworzenie dźwięku dla alternatywnego strzału + if(event.type == sf::Event::MouseButtonPressed) { + if (sf::Mouse::isButtonPressed(sf::Mouse::Left)) { + ship.shoot(); + audioManager.playSoundEffect("shoot", 70.f); // Odtworzenie dźwięku wystrzału + } + if (sf::Mouse::isButtonPressed(sf::Mouse::Right)) { + ship.alternate_shoot(); + audioManager.playSoundEffect("shoot_alt", 70.f); // Odtworzenie dźwięku dla alternatywnego strzału + } } // generowanie nowego meteoru