Meteoryty są spawnowane automatycznie co 1 sekunde, max 5 meteorytów na plansze
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
#include <iostream>
|
||||
#include "../headers/Meteor.h"
|
||||
|
||||
Meteor::Meteor(float x, float y, sf::Texture &texture) {
|
||||
@@ -5,7 +6,7 @@ Meteor::Meteor(float x, float y, sf::Texture &texture) {
|
||||
meteorTexture = texture;
|
||||
meteorSprite.setTexture(texture);
|
||||
meteorSprite.setPosition(x, y);
|
||||
meteorSpeed = 10.0f;
|
||||
meteorSpeed = 5.0f;
|
||||
meteorSprite.scale(0.05f, 0.05f);
|
||||
meteorPosition.x = x;
|
||||
meteorPosition.y = y;
|
||||
@@ -18,7 +19,7 @@ sf::Sprite &Meteor::getSprite() {
|
||||
void Meteor::update() {
|
||||
meteorSprite.move(0.0f, meteorSpeed);
|
||||
meteorPosition.y += int(meteorSpeed);
|
||||
if(meteorPosition.y > 900) {
|
||||
if(meteorPosition.y > 800) {
|
||||
outOfBounds = true;
|
||||
}
|
||||
}
|
||||
@@ -27,3 +28,11 @@ bool Meteor::getStatus() {
|
||||
return outOfBounds;
|
||||
}
|
||||
|
||||
unsigned int Meteor::counter = 0;
|
||||
|
||||
// było użyte do testowania czy meteoryt jest kasowany
|
||||
//Meteor::~Meteor() {
|
||||
// Meteor::counter++;
|
||||
// std::clog << Meteor::counter << " Meteor destroyed\n";
|
||||
//}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user