-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathEnemies.h
More file actions
82 lines (68 loc) · 2.08 KB
/
Enemies.h
File metadata and controls
82 lines (68 loc) · 2.08 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
71
72
73
74
75
76
77
78
79
80
81
82
#ifndef ENEMIES_H
#define ENEMIES_H
#include <cmath>
#include <stdlib.h>
#include <time.h>
#include "Level_Load.h"
#include "Player.h"
enum tState { IDLE, TRANSITION, SCATTER, CHASE, FRIGHTENED, DEAD };
enum tGhost { RED, PINK, BLUE, ORANGE };
const float HUGE_DISTANCE = 1000000.0f;
class Enemy
{
public:
//Constructors
Enemy(tGhost type, Level const& level);
//Methods
void UpdatePositions(Level const& level);
void Reset(Level &level);
void GameReset(tGhost ghost_type, Level &level);
void SetState(tState s);
void SetPosition(int posX, int posY);
void SetNextPosition(int posX, int posY);
void SetInitialPosition(int posX, int posY);
void SetPixelPosition(float pixel_x, float pixel_y);
void Draw(float swidth, float sheight, int x, int y);
void SetTarget(int targetX, int targetY);
void MoveToTarget(Level &level);
void SetCounter(int i);
void SetStateCounter(int i);
void SetMaxCounter(int i);
void ResetCounter();
ALLEGRO_BITMAP *GetBitmap() const;
tDirection GetDirection() const;
int GetPositionX() const;
int GetPositionY() const;
int GetNextPositionX() const;
int GetNextPositionY() const;
int GetInitialPositionX() const;
int GetInitialPositionY() const;
int GetHousePositionX() const;
int GetHousePositionY() const;
int GetCounter() const;
int GetStateCounter() const;
int GetIdleTime() const;
float GetPixelPositionX() const;
float GetPixelPositionY() const;
float GetMaxCounter() const;
tState GetState() const;
tGhost GetType() const;
~Enemy();
private:
tState state;
protected:
int counter, state_counter, idle_time;
int target[2];
int ScatterTarget[2], IdleTarget[2];
float max_counter;
tDirection direction;
tGhost type;
pixel_position initial_position, position, next_position, initial_house;
short int animationState;
std::vector<ALLEGRO_BITMAP *> sprite;
std::vector<ALLEGRO_BITMAP *> scared_sprite;
std::vector<ALLEGRO_BITMAP *> eaten_sprite;
};
float distance(int posX, int posY, int targetX, int targetY);
//This funcion simply returns the addition of the horizontal an vertical distance between coordinates of the ghost and its target.
#endif