Lekki refactor

This commit is contained in:
2024-11-22 12:52:50 +01:00
parent c4a3203153
commit d0e29b36b8
2 changed files with 2 additions and 4 deletions

View File

@@ -43,11 +43,8 @@ int main()
// Tu są handlowane eventy
sf::Event event{};
while (mainWindow.pollEvent(event)) {
if(event.type == sf::Event::Closed)
if(event.type == sf::Event::Closed || sf::Keyboard::isKeyPressed(sf::Keyboard::Escape))
mainWindow.close();
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Escape)) {
mainWindow.close();
}
}
// poruszanie się statkiem

View File

@@ -10,6 +10,7 @@ void Player::shoot() {
}
}
// TODO: Czy strzał prawym musi mieć osobną tablicę z pociskami?
void Player::alternate_shoot() {
auto now = std::chrono::steady_clock::now();
if (std::chrono::duration_cast<std::chrono::milliseconds>(now - lastShotTime).count() >= firerate) {