Multiple fixes

Obracające się meteoryty, koniec gry przy natrafieniu na meteoryt.
Poprawione sprajty statku, meteorytu i pocisku
This commit is contained in:
2024-11-21 15:50:25 +01:00
parent b16fd9fad5
commit 2bdfbb193c
9 changed files with 42 additions and 16 deletions

View File

@@ -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);
}