New Projectiles class
Refactor of Bullet class Different method of shooting.
This commit is contained in:
23
sources/Projectile.cpp
Normal file
23
sources/Projectile.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user