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
hamx01 fcabc0534a A little code refactor
+ new bullet texture added
2024-11-16 16:01:01 +01:00

52 lines
1011 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();
virtual void move(float deltaX, float deltaY) = 0;
virtual void moveLeft() = 0;
virtual void moveRight() = 0;
virtual void moveUp() = 0;
virtual void moveDown() = 0;
virtual void shoot() = 0;
std::vector<Bullet>& getBullets();
void updateBullets();
void setMovingSpeed(float speed) {
moving_speed = speed;
}
protected:
sf::Sprite actorSprite;
sf::Texture actorTexture;
sf::Texture bulletTextureLeft;
sf::Texture bulletTextureRight;
Position position;
unsigned int hp;
unsigned int damage;
unsigned int firerate;
float moving_speed;
std::vector<Bullet> bullets;
};
#endif //ACTOR_H