-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEnemy.h
More file actions
71 lines (54 loc) · 1.63 KB
/
Enemy.h
File metadata and controls
71 lines (54 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#ifndef ENEMY_H
#define ENEMY_H
#include <SFML/Graphics.hpp>
#include <iostream>
#include <string>
// Included this to prevent circular dependencies
// Forward declaration of Restaurant class
class Restaurant;
// Included this to prevent circular dependencies
// Forward declaration of Player class
class Player;
// Struct to group x and y coordinates, improving clarity and organization
struct EnemyPosition {
float x;
float y;
};
class Enemy {
private:
std::string fID; // Enemy ID
EnemyPosition fPosition; // Position struct
int fAttack; // Attack power
sf::CircleShape circle; // Circle shape to represent the enemy
float fSpeed; // Speed at which the enemy moves
public:
// Default constructor
Enemy();
// Overloaded constructor
Enemy(std::string id, EnemyPosition position, float radius, int attack);
// Get & Set for fID
std::string getID();
void setID(std::string& id);
// Get & Set for fPosition
EnemyPosition getPosition();
void setPosition(EnemyPosition& position);
// Get & Set for fAttack
int getAttack();
void setAttack(int attack);
// Get Enemy's cirlce
sf::CircleShape getCircle();
// Get & Set for speed
float getEnemySpeed() const;
void setEnemySpeed(float speed);
// Draw the enemy to the SFML window
void draw(sf::RenderWindow& window);
// Method to chase player
void chase(Player *player, const Restaurant &restaurant);
// Method to attack the player reputation
void attackPlayerReputation();
// Method to get the global bounds of the enemy
sf::FloatRect getGlobalBounds() const;
// Destructor
~Enemy();
};
#endif