39 lines
853 B
C++
39 lines
853 B
C++
#include <iostream>
|
|
#include "../headers/Meteor.h"
|
|
|
|
Meteor::Meteor(float x, float y, sf::Texture &texture) {
|
|
outOfBounds = false;
|
|
meteorTexture = texture;
|
|
meteorSprite.setTexture(texture);
|
|
meteorSprite.setPosition(x, y);
|
|
meteorSpeed = 5.0f;
|
|
meteorSprite.scale(0.05f, 0.05f);
|
|
meteorPosition.x = x;
|
|
meteorPosition.y = y;
|
|
}
|
|
|
|
sf::Sprite &Meteor::getSprite() {
|
|
return meteorSprite;
|
|
}
|
|
|
|
void Meteor::update() {
|
|
meteorSprite.move(0.0f, meteorSpeed);
|
|
meteorPosition.y += int(meteorSpeed);
|
|
if(meteorPosition.y > 800) {
|
|
outOfBounds = true;
|
|
}
|
|
}
|
|
|
|
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";
|
|
//}
|
|
|