Meteoryty lecą w trybie testowym.
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
#include <iostream>
|
||||
#include "../headers/Bullet.h"
|
||||
|
||||
Bullet::Bullet(float x, float y, sf::Texture &bulletTexture) {
|
||||
Bullet::Bullet(float x, float y, sf::Texture &texture) {
|
||||
outOfBounds = false;
|
||||
bulletSprite.setTexture(bulletTexture);
|
||||
bulletTexture = texture;
|
||||
bulletSprite.setTexture(texture);
|
||||
bulletSprite.setPosition(x, y);
|
||||
bulletSpeed = -10.0f;
|
||||
bulletPosition.x = x;
|
||||
|
||||
30
sources/Meteor.cpp
Normal file
30
sources/Meteor.cpp
Normal 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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user