31 lines
621 B
C++
31 lines
621 B
C++
#include <iostream>
|
|
#include "../headers/Meteor.h"
|
|
|
|
Meteor::Meteor(int x, int y, sf::Texture &texture) {
|
|
position.x = x;
|
|
position.y = y;
|
|
outOfBounds = false;
|
|
meteorTexture = texture;
|
|
meteorSprite.setTexture(texture);
|
|
meteorSpeed = 10.0f;
|
|
meteorSprite.setPosition(x, y);
|
|
meteorSprite.scale(0.05f, 0.05f);
|
|
}
|
|
|
|
sf::Sprite &Meteor::getSprite() {
|
|
return meteorSprite;
|
|
}
|
|
|
|
void Meteor::update() {
|
|
meteorSprite.move(0.0f, meteorSpeed);
|
|
position.y += int(meteorSpeed);
|
|
if(position.y > 900) {
|
|
outOfBounds = true;
|
|
}
|
|
}
|
|
|
|
bool Meteor::getStatus() {
|
|
return outOfBounds;
|
|
}
|
|
|