Meteory są w tym samym stanie co w poprzednim commit, tylko, że teraz są zdefiniowane w osobnej klasie "Plansza"
This commit is contained in:
@@ -1 +1,29 @@
|
||||
#include <random>
|
||||
#include "../headers/Plansza.h"
|
||||
|
||||
Plansza::Plansza(int windowHeight, int windowWidth) {
|
||||
size.height = windowHeight;
|
||||
size.width = windowWidth;
|
||||
meteorTexture.loadFromFile("../assets/img/meteor.png");
|
||||
}
|
||||
|
||||
void Plansza::spawn_meteor() {
|
||||
meteors.emplace_back(random.getRandomNumber(), 100, meteorTexture);
|
||||
}
|
||||
|
||||
Plansza::Size Plansza::getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
std::vector<Meteor> &Plansza::getMeteors() {
|
||||
return meteors;
|
||||
}
|
||||
|
||||
void Plansza::update_meteors() {
|
||||
// Remove meteors that are out of bounds
|
||||
for (auto& meteor : meteors) {
|
||||
if(meteor.getStatus()) {
|
||||
meteors.erase(meteors.begin());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user