-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAsteroids.h
122 lines (102 loc) · 2.59 KB
/
Asteroids.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#ifndef SHOOT_CLASS_IS_INCLUDED
#define SHOOT_CLASS_IS_INCLUDED
class GameObject
{
public:
double x,y;
GameObject();
~GameObject();
void CleanUp(void);
// Add copy constructor and copy-assignment operator
GameObject(const GameObject &incoming);
GameObject &operator=(const GameObject &incoming);
};
class GameObjectWithState : public GameObject
{
public:
int state;
GameObjectWithState();
~GameObjectWithState();
void CleanUp(void);
// Add copy constructor and copy-assignment operator
GameObjectWithState(const GameObjectWithState &incoming);
GameObjectWithState &operator=(const GameObjectWithState &incoming);
};
class Missile : public GameObjectWithState
{
public:
double vx,vy,angle;
Missile();
~Missile();
void CleanUp(void);
// Add copy constructor and copy-assignment operator
Missile(const Missile &incoming);
Missile &operator=(const Missile &incoming);
double Getx(void) const;
double Gety(void) const;
int Getstate(void) const;
void Initialize(void);
void Fire(double sx,double sy, double angle);
void Move(double v);
bool CheckCollision(class Target &t);
void Steer(void);
void Draw(void);
};
class Target : public GameObjectWithState
{
public:
double w,h,vx,vy;
void Initialize(class Player &p);
Target();
~Target();
void CleanUp(void);
// Add copy constructor and copy-assignment operator
Target(const Target &incoming);
Target &operator=(const Target &incoming);
double Getx(void) const;
double Gety(void) const;
int Getstate(void) const;
void drawasteroids(double w, double h) const;
void Move(void);
void Draw(void);
};
class Player : public GameObjectWithState
{
public:
double vx, vy, angle;
int life;
Player();
~Player();
void CleanUp(void);
// Add copy constructor and copy-assignment operator
Player(const Player &incoming);
Player &operator=(const Player &incoming);
double Getx(void) const;
double Gety(void) const;
int Getstate(void) const;
void Initialize(double sx,double sy, double angle);
double rotateplayerx(double xs, double ys) const;
double rotateplayery(double xs, double ys) const;
void DrawPlayer(void) const;
void DrawFire(void) const;
void DrawPlayerBOOMast(void) const;
void Move(void);
void steer(void);
void Draw(void) const;
void DrawBOOM(void) const;
bool CheckCollision(class Target &t);
};
class AsteroidsGame
{
public:
int keyM;
void DrawLevel(int keyM, int ncount);
void Drawinitial(int KeyM, class Player &p);
void Drawplayerdestructor(int keyM, int nPAlive);
void waitasec(void);
void RunGameMenu(int keyM);
void DrawEnd(int KeyM, int Score);
void DrawWin(int KeyM, int Score);
int play(void);
};
#endif