Meteoryty lecą w trybie testowym.

This commit is contained in:
2024-11-19 14:42:25 +01:00
parent a69dc434a9
commit cf10a042c0
7 changed files with 112 additions and 21 deletions

30
sources/Meteor.cpp Normal file
View File

@@ -0,0 +1,30 @@
#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;
}