-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGhost.h
63 lines (45 loc) · 1.17 KB
/
Ghost.h
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
#pragma once
#include "PlayerPac.h"
//#include"Game.h"
class Ghost
{
private:
//Data Members
char direction; //direction
int stucked = 0; //will be one if ghost is stuck while following the target.
//Game* game;
//Functions
void initVariables();
public:
//Data Memebers
Position mapPos;
Position ghostPos;
int horg;
int verg;
bool seen;
bool scared;
bool scatter;
//friend functions
int collide_ghost(bool power, int& pposx, int& pposy, int& ghox, int& ghoy, char& direct,int &x,int &y);
int displacement(int, int, int, int);
void frighten_end(bool&, bool&,int &);
bool is_wall(int x, int y);
//Functions
Ghost();
//Ghost();
void Target(Position target);
void move_decide();
char getDirectionFromGhost();
void move();
char frighten_mode();
void get_frighten(bool eat_apple);
virtual void chase_mode(Position) = 0;
virtual void scatter_mode() = 0;
protected:
virtual void saw_pac(Position p);//pacman's cordinates.
void set_dir(char a);
bool up(); //checks if moving up is possible
bool down(); // checks if moving down is possible
bool left();// checks if moving left is possible
bool right();// checks if moving right is possible
};