A little code refactor
+ new bullet texture added
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "../headers/Actor.h"
|
||||
|
||||
// TODO: Naprawić krzywy sprite statku
|
||||
Actor::Actor(int x, int y, std::string path) {
|
||||
loadTexture(path);
|
||||
position.x = x;
|
||||
@@ -11,25 +12,20 @@ void Actor::loadTexture(std::string path) {
|
||||
actorTexture.loadFromFile(path);
|
||||
actorSprite.setTexture(actorTexture);
|
||||
|
||||
bulletTexture.loadFromFile("../assets/img/bullet.png");
|
||||
bulletTextureLeft.loadFromFile("../assets/img/bullet.png");
|
||||
bulletTextureRight.loadFromFile("../assets/img/bullet_right.png");
|
||||
}
|
||||
|
||||
sf::Sprite &Actor::getSprite() {
|
||||
return actorSprite;
|
||||
}
|
||||
|
||||
void Actor::move(float deltaX, float deltaY) {}
|
||||
|
||||
void Actor::moveLeft() {}
|
||||
|
||||
void Actor::moveRight() {}
|
||||
|
||||
Position Actor::getPosition() {
|
||||
return {position.x, position.y};
|
||||
}
|
||||
|
||||
void Actor::shoot() {
|
||||
bullets.emplace_back(float(position.x) + actorSprite.getGlobalBounds().width / 2-62, position.y, bulletTexture);
|
||||
bullets.emplace_back(float(position.x) + actorSprite.getGlobalBounds().width / 2-62, position.y, bulletTextureLeft);
|
||||
}
|
||||
|
||||
std::vector<Bullet> &Actor::getBullets() {
|
||||
|
||||
Reference in New Issue
Block a user