24 lines
536 B
C++
24 lines
536 B
C++
#include "../headers/Projectile.h"
|
|
|
|
Projectile::Projectile(float x, float y, sf::Texture &texture) {
|
|
position.x = x;
|
|
position.y = y;
|
|
outOfBounds = false;
|
|
sprite.setTexture(texture);
|
|
sprite.setOrigin(sprite.getLocalBounds().width/2, sprite.getLocalBounds().height/2);
|
|
sprite.setPosition(x, y);
|
|
speed = -10.0f;
|
|
}
|
|
|
|
sf::Sprite &Projectile::getSprite() {
|
|
return sprite;
|
|
}
|
|
|
|
void Projectile::setSpeed(float speed) {
|
|
this->speed = speed;
|
|
}
|
|
|
|
bool Projectile::isOutOfBounds() const {
|
|
return outOfBounds;
|
|
}
|