Meteory są w tym samym stanie co w poprzednim commit, tylko, że teraz są zdefiniowane w osobnej klasie "Plansza"
This commit is contained in:
@@ -1,15 +1,14 @@
|
||||
#include <iostream>
|
||||
#include "../headers/Meteor.h"
|
||||
|
||||
Meteor::Meteor(int x, int y, sf::Texture &texture) {
|
||||
position.x = x;
|
||||
position.y = y;
|
||||
Meteor::Meteor(float x, float y, sf::Texture &texture) {
|
||||
outOfBounds = false;
|
||||
meteorTexture = texture;
|
||||
meteorSprite.setTexture(texture);
|
||||
meteorSpeed = 10.0f;
|
||||
meteorSprite.setPosition(x, y);
|
||||
meteorSpeed = 10.0f;
|
||||
meteorSprite.scale(0.05f, 0.05f);
|
||||
meteorPosition.x = x;
|
||||
meteorPosition.y = y;
|
||||
}
|
||||
|
||||
sf::Sprite &Meteor::getSprite() {
|
||||
@@ -18,8 +17,8 @@ sf::Sprite &Meteor::getSprite() {
|
||||
|
||||
void Meteor::update() {
|
||||
meteorSprite.move(0.0f, meteorSpeed);
|
||||
position.y += int(meteorSpeed);
|
||||
if(position.y > 900) {
|
||||
meteorPosition.y += int(meteorSpeed);
|
||||
if(meteorPosition.y > 900) {
|
||||
outOfBounds = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user