52 lines
862 B
C++
52 lines
862 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();
|
|
|
|
void setMovingSpeed(float speed) {
|
|
moving_speed = speed;
|
|
}
|
|
|
|
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
|