This repository has been archived on 2025-06-06. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
LotoStatek/sources/Projectile.cpp
Andrii Solianyk 2341c2fa6d New Projectiles class
Refactor of Bullet class
Different method of shooting.
2024-12-01 17:44:25 +01:00

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;
}