-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClass.h
More file actions
172 lines (133 loc) · 3.16 KB
/
Copy pathClass.h
File metadata and controls
172 lines (133 loc) · 3.16 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
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
#ifndef CLASS_H
#define CLASS_H
#define PI 3.1415927
#define MAX_AMMUNITION 1000
#define MAX_COMPUTER 20
#define MAX_AWARD 40
#define MAX_PLAYER 1
#define AMMUNITION_RANGE 750
#define BOMB_RANGE 80
#define BOMB_BLAST_RANGE 150
#define START_BOMB_NUMBER 0
#define WIN_SCORE 500000
class BaseObject{
public:
BaseObject(float a=0,float b=0,int l=0,float s=0,float d=0,int k=0){
x=a;
y=b;
life=l;
speed=s;
direction=d;
kind=k;
blastNum=0;
blastTime=0;
}
float getX(){return x;}
float getY(){return y;}
int getLife(){return life;}
float getSpeed(){return speed;}
int getKind(){return kind;}
void setX(float a){x=a;}
void setY(float b){y=b;}
void setLife(int l){life=l;}
void setSpeed(float s){speed=s;}
protected:
float x;
float y;
float speed;
int life;
float direction;
int kind;
int blastNum;
int blastTime;
};
class PlayerPlane:public BaseObject{
public:
PlayerPlane(float a=0,float b=0,int l=0,float s=0);
void initPlane(float a,float b,int l,float s);
int getAmmunitionKind() {return ammunitionKind;}
int getBombNum() {return bombNum;}
int getScore() {return score;}
void setAmmunitionKind(int bk) {ammunitionKind=bk;}
void setBombNum(int bn) {bombNum=bn;}
void setScore(int s) {score=s;}
void setFireInterval(int i) {fireInterval=i;}
int getFireInterval() {return fireInterval;}
void levelUp() { fireLevel++; }
void setFireLevel(int f) { fireLevel = f;}
int getFireLevel() { return fireLevel;}
void moveUp();
void moveDown();
void moveRight();
void moveLeft();
void stay();
void draw();
void blast();
void fire();
void fireBomb();
void hitcomPlane();
void update();
private:
int fireTime;
int bombNum;
int planeTexture;
int ammunitionKind;
int score;
int fireInterval; /*L default 100 */
int fireLevel;
};
class ComputerPlane:public BaseObject{
public:
ComputerPlane(float a=0,float b=0,int l=0,float d=0,float s=0,int k=0);
bool getExplosible(){ return explosible;}
void setExplosible(bool b) {explosible=b;}
void setKind(int k);
void draw();
void move();
void fire();
void blast();
void compinit();
void update();
void leftaward();
void damaged(int damage);
private:
int fireTime;
bool explosible;
int rewardScore;
int fireInteral;
};
/*L new kind=4, explodeLevel=100 */
class Ammunition:public BaseObject{
public:
Ammunition(
float x_pos=0,
float y_pos=0,
float direction=0,
float speed=0,
int lift=0,
int kind=0);
void setOwner(int w) {owner=w;}
int getOwner() {return owner;}
void setExplosible(bool bn) {explosible=bn;}
int getExplodeLevel(void){return explodeLevel;}
void setY(float y_) {y=y_;};
void setX(float x_) {x=x_;};
void setDirection(float d_) {direction=d_;};
void move();
void draw();
void blast();
void hitTheTarget();
private:
bool explosible;
float displacement;
int owner;
int explodeLevel;
};
class Award:public BaseObject{
public:
Award(float a=0,float b=0,float s=0,int l=0,int k=0);
void draw();
void move();
void eat();
};
#endif