30 lines
667 B
C++
30 lines
667 B
C++
#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());
|
|
}
|
|
}
|
|
}
|