Archived
Meteoryty są spawnowane automatycznie co 1 sekunde, max 5 meteorytów na plansze
This commit is contained in:
@@ -15,12 +15,14 @@ public:
|
||||
sf::Sprite &getSprite();
|
||||
bool getStatus();
|
||||
void update();
|
||||
~Meteor();
|
||||
private:
|
||||
sf::Texture meteorTexture;
|
||||
sf::Sprite meteorSprite;
|
||||
Position meteorPosition;
|
||||
float meteorSpeed;
|
||||
bool outOfBounds;
|
||||
static unsigned int counter;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "Meteor.h"
|
||||
#include "RandomNumberGenerator.h"
|
||||
#include "SFML/System/Clock.hpp"
|
||||
|
||||
class Plansza {
|
||||
struct Size {
|
||||
@@ -21,6 +22,8 @@ private:
|
||||
Size size;
|
||||
sf::Texture meteorTexture;
|
||||
RandomNumberGenerator random;
|
||||
unsigned int meteorsCounter;
|
||||
sf::Clock spawnClock;
|
||||
};
|
||||
|
||||
#endif //PLANSZA_H
|
||||
|
||||
@@ -10,7 +10,7 @@ private:
|
||||
std::uniform_int_distribution<> dis;
|
||||
|
||||
public:
|
||||
RandomNumberGenerator() : gen(rd()), dis(0, 599) {}
|
||||
RandomNumberGenerator() : gen(rd()), dis(0, 499) {}
|
||||
|
||||
int getRandomNumber() {
|
||||
return dis(gen);
|
||||
|
||||
Reference in New Issue
Block a user