Meteoryty są spawnowane automatycznie co 1 sekunde, max 5 meteorytów na plansze
This commit is contained in:
10
main.cpp
10
main.cpp
@@ -1,5 +1,4 @@
|
||||
#include <iostream>
|
||||
#include <random>
|
||||
|
||||
#include "SFML/Graphics.hpp"
|
||||
#include "headers/Player.h"
|
||||
@@ -65,13 +64,9 @@ int main()
|
||||
if(sf::Mouse::isButtonPressed(sf::Mouse::Left)) ship.shoot();
|
||||
if(sf::Mouse::isButtonPressed(sf::Mouse::Right)) ship.alternate_shoot();
|
||||
|
||||
|
||||
// TODO: Meteory na jednym poziomie ze statkiem
|
||||
// TODO: Kolizje
|
||||
// Generate a new meteor at a random position at the top of the screen
|
||||
if (sf::Keyboard::isKeyPressed(sf::Keyboard::M)) {
|
||||
plansza.spawn_meteor();
|
||||
}
|
||||
plansza.spawn_meteor();
|
||||
|
||||
|
||||
// Update and draw meteors
|
||||
for (auto& meteor : plansza.getMeteors()) {
|
||||
@@ -84,6 +79,7 @@ int main()
|
||||
window.draw(bullet.getSprite());
|
||||
}
|
||||
|
||||
plansza.update_meteors();
|
||||
ship.updateBullets();
|
||||
window.draw(ship.getSprite());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user