#include "../headers/Actor.h" Actor::Actor(int x, int y, std::string path) { loadTexture(path); position.x = x; position.y = y; actorSprite.setPosition(x, y); } void Actor::loadTexture(std::string path) { actorTexture.loadFromFile(path); actorSprite.setTexture(actorTexture); bulletTexture.loadFromFile("../assets/img/bullet.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); } std::vector &Actor::getBullets() { return bullets; } void Actor::updateBullets() { for (auto& bullet : bullets) { if(bullet.getStatus()) { bullets.erase(bullets.begin()); } } }