-
Notifications
You must be signed in to change notification settings - Fork 0
/
Actor.h
296 lines (235 loc) · 7.21 KB
/
Actor.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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
#ifndef ACTOR_H_
#define ACTOR_H_
#include "GraphObject.h"
#include "StudentWorld.h"
#include "GameConstants.h"
using namespace std;
class StudentWorld;
class Actors : public GraphObject{ //main class
public:
virtual void dosomething() = 0; //do something function for ticks
bool switchdirectionifneeded(int targetX, int targetY);
Actors(StudentWorld* Sworld, int imageID, int startX, int startY, int dir, int depth, double size);
virtual bool usesHealth(){return false;}
void doCommonality();
virtual void bonked() = 0;
virtual bool isprojectile(){return false;}
virtual void damage(){;}
virtual bool CanBlock()
{
return false;
}
virtual bool Damageable() //returns if damageable or not
{
return false;
}
virtual bool Bonkable() //returns if bonkable or not
{
return false;
}
bool isalive(){ //returns life status
return alive;
}
void setdead(){ //lets you set life stataus
alive = false;
}
StudentWorld* getWorld(){ //allows access to Student WWorld
return m_world;
}
private:
bool alive; //alive or dead status
StudentWorld* m_world;//gives access to studentworld
};
class peach: public Actors{
public:
//major functions
peach(StudentWorld* Sworld, int imageID, int startX, int startY); //constructor
virtual void dosomething();
virtual void bonked();
virtual void damaged(){bonked();}
//trivial functions
virtual bool damageable(){return true;}
virtual bool usesHealth(){return true;}
int currenthealth(){return health;}
bool starpowerstatus(){return status(starpower_ticks);}
bool jumppowerstatus(){return jumppower;}
bool shootpowerstatus(){return shootpower;}
void setpowerstatus(string x, int y){
if(x == "jumppower" and y == 0)
jumppower = true;
if(x == "shootpower" and y ==0)
shootpower = true;
if(x == "none" and y>0)
starpower_ticks = y;
}
void sethealth(int x){health = x;}
bool temporaryinvincibilitystatus(){return status(invincibility_ticks);}
bool needsRecharge()
{
if(time_to_recharge_before_next_fire > 0)
return true;
else
return false;
}
bool JumpStatus(){return status(remaining_jump_distance);}
private:
bool status(int ticks){
if(ticks > 0)
return true;
else
return false;
}
int health;
int starpower_ticks;
bool jumppower;
bool shootpower;
int invincibility_ticks;
int time_to_recharge_before_next_fire;
int remaining_jump_distance;
bool CanShootFireball;
bool jumpinitiated;
};
class platforms: public Actors{ //sub class of Actors, includes pipes and blocks
public:
platforms(StudentWorld* Sworld, int imageID, int startX, int startY);
virtual void dosomething(){;}
virtual bool Bonkable(){return true;}
virtual bool CanBlock(){return true;}
virtual void bonked(){;}
private:
};
class pipe : public platforms{
public:
pipe(StudentWorld* Sworld, int startX, int startY);
virtual bool Bonkable(){return false;}
};
class block : public platforms{
public:
block(StudentWorld* Sworld, int startX, int startY, bool Stargoodie, bool Mushgoodie, bool Flowergoodie, bool Empty);
virtual void bonked();
bool Stargoodiestatus(){return Stargoodie;}
bool Mushgoodiestatus(){return Mushgoodie;}
bool Flowergoodiestatus(){return Flowergoodie;}
void ReleaseGoodie(bool goodie){goodie = false;}
private:
bool Stargoodie;
bool Mushgoodie;
bool Flowergoodie;
bool Empty;
bool Bonked = false;
};
class objectives: public Actors{ //includes flags and mario
public:
objectives(StudentWorld* Sworld, int imageID, int startX, int startY);
virtual void bonked(){;}
virtual void dosomething(){;}
void docommonality3(string x);
private:
};
class Mario: public objectives{
public:
Mario(StudentWorld* Sworld, int startX, int startY);
virtual void bonked(){;}
virtual void dosomething();
private:
};
class Flag: public objectives{
public:
Flag(StudentWorld* Sworld, int startX, int startY);
virtual void bonked(){;}
virtual void dosomething();
private:
};
class goodies : public Actors{ //includes the flower, mushroom, and star goodies
public:
goodies(StudentWorld* Sworld, int imageID, int startX, int startY);
bool doCommonality2(int sethealth, int setscore, string z, int setTicks);
virtual void dosomething(){;}
virtual void bonked(){;}
private:
};
class Flower : public goodies{
public:
virtual void dosomething();
virtual void bonked(){;}
Flower(StudentWorld* Sworld, int startX, int startY);
private:
};
class Mushroom : public goodies{
public:
virtual void dosomething();
virtual void bonked(){;}
Mushroom(StudentWorld* Sworld, int startX, int startY);
};
class Star : public goodies{
public:
virtual void dosomething();
virtual void bonked(){;}
Star(StudentWorld* Sworld, int startX, int startY);
};
class projectiles : public Actors{ //includes all the projectiles, so shell, and the fireballs
public:
projectiles(StudentWorld* Sworld, int imageID, int startX, int startY, int dir);
virtual void dosomething(){;}
virtual void bonked(){;}
void doprojectilebehavior(string z);
private:
};
class Peach_fired_fireballs : public projectiles{
public:
Peach_fired_fireballs(StudentWorld* Sworld, int startX, int startY, int dir);
virtual void dosomething();
virtual void bonked(){;}
virtual bool isprojectile(){return true;}
private:
};
class Piranha_fired_fireballs: public projectiles{
public:
Piranha_fired_fireballs(StudentWorld* Sworld, int startX, int startY, int dir);
virtual void dosomething();
virtual void bonked(){;}
};
class Shell: public projectiles{
public: Shell(StudentWorld* Sworld, int startX, int startY, int dir);
virtual void dosomething();
virtual void bonked(){;}
};
class enemies : public Actors { //contains the enemies, koopa, piranha, goomba
public:
enemies(StudentWorld* Sworld, int imageID, int startX, int startY, int dir);
virtual void dosomething(){;}
virtual void bonked(){;}
virtual void koopa_goomba_commonality();
virtual void bonk_commonality();
virtual bool bonkable(){return true;}
virtual bool damageable(){return true;}
private:
};
class goomba : public enemies{
public:
goomba(StudentWorld* Sworld, int startX, int startY, int dir);
virtual void dosomething();
virtual void bonked();
virtual void damage();
virtual bool damageable(){return true;}
private:
};
class koopa : public enemies{
public:
koopa(StudentWorld* Sworld, int startX, int startY, int dir);
virtual void dosomething();
virtual void bonked();
virtual void damage();
virtual bool damageable(){return true;}
private:
};
class piranha : public enemies{
public:
piranha(StudentWorld* Sworld, int startX, int startY, int dir);
virtual void dosomething();
virtual void bonked();
virtual void damage();
private:
int firing_delay = 0;
};
#endif // ACTOR_H_