forked from ComputerGeek01/Random
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Enemy.hpp
81 lines (60 loc) · 2.15 KB
/
Enemy.hpp
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
71
72
73
74
75
76
77
78
79
80
81
#include "Units.hpp"
struct ENEMY : UNIT
{
private:
public:
ENEMY(sf::Image* img, int Z): Targeted(false)
{
scale = SCALE;
Enemy++;
HP = 2;
LID = Id; //Id Is A Static Data Member
PID = Id;
Id++; //Increament Id Everytime Constructor Is Called
Alive = true;
Selected = false;
Mode = NORMAL;
Speed = .5;
Kills = 0;
Pos = sf::Vector2f(0,0);
Img = img; //Inherited From Base Class
Type = Z; //Inherited From Base Class
Time.Reset();
Target = -1;
/////*Generate Units Position Until It Is Within The Bounds Of The Screen*/////
do
{
Pos.x = rand() % 200; //Start Somewhere between 0 and 200
Right = Pos.x + (25 * scale);
}while(Pos.x < 0 || Right > WIDTH);
do
{
Pos.y = rand() % HEIGHT;
Bottom = Pos.y + (50 * scale);
}while(Pos.y < 0 || Bottom > HEIGHT);
RB.x = Right;
RB.y = Bottom;
Sprite.SetImage(*Img);
Sprite.SetScale(scale, scale);
Sprite.SetSubRect(sf::IntRect(0, 0, 24, 50));
Sprite2.SetImage(*Img);
Sprite2.SetScale(scale, scale);
Sprite2.SetSubRect(sf::IntRect(25, 0, 50, 50));
Sprite3.SetImage(*Img);
Sprite3.SetScale(scale, scale);
Sprite3.SetSubRect(sf::IntRect(51, 0, 75, 50));
Sprite.SetPosition(Pos);
Sprite2.SetPosition(Pos);
Sprite3.SetPosition(Pos);
Dest = Pos;
}
sf::Sprite* draw();
std::string GetData();
bool RightClick(float X, float Y);
int Attack(UNIT* Unit);
void Hit();
void Die();
bool Targeted;
sf::Sprite Sprite3;
static int Enemy;
};