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/headers/Actor.h

54 lines
941 B
C++

#ifndef ACTOR_H
#define ACTOR_H
#include "SFML/Graphics/Sprite.hpp"
#include "SFML/Graphics/Texture.hpp"
#include "Bullet.h"
struct Position {
int x;
int y;
};
class Actor {
public:
Actor(int x, int y, std::string path);
void loadTexture(std::string path);
sf::Sprite& getSprite();
Position getPosition();
void move(float deltaX, float deltaY);
void moveLeft();
void moveRight();
void shoot();
std::vector<Bullet>& getBullets();
void updateBullets() {
for (auto& bullet : bullets) {
if(bullet.getStatus()) {
bullets.erase(bullets.begin());
}
}
}
protected:
sf::Sprite actorSprite;
sf::Texture actorTexture;
sf::Texture bulletTexture;
Position position;
unsigned int hp;
unsigned int damage;
unsigned int firerate;
float moving_speed;
std::vector<Bullet> bullets;
};
#endif //ACTOR_H