Multiple fixes
Obracające się meteoryty, koniec gry przy natrafieniu na meteoryt. Poprawione sprajty statku, meteorytu i pocisku
This commit is contained in:
@@ -2,17 +2,15 @@
|
||||
#include <iostream>
|
||||
#include "../headers/Plansza.h"
|
||||
|
||||
Plansza::Plansza(int windowHeight, int windowWidth) {
|
||||
Plansza::Plansza(unsigned int windowHeight, unsigned int windowWidth) {
|
||||
size.height = windowHeight;
|
||||
size.width = windowWidth;
|
||||
meteorTexture.loadFromFile("../assets/img/meteor.png");
|
||||
spawnClock.restart();
|
||||
}
|
||||
|
||||
// TODO: Meteory na jednym poziomie ze statkiem
|
||||
// TODO: Kolizje
|
||||
void Plansza::spawn_meteor() {
|
||||
if (spawnClock.getElapsedTime().asSeconds() > 1.0f) { // spawn co 1 sekunde
|
||||
if (spawnClock.getElapsedTime().asSeconds() > rand() % 10 + 1) { // randomowy spawn meteorytów od 10 do 1 sekundy
|
||||
if (meteors.size() < 5) { // jeśli jest mniej niż 5 meteorów na planszy
|
||||
meteors.emplace_back(random.getRandomNumber(), -100, meteorTexture);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user