-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathActor.h
230 lines (201 loc) · 5.24 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
#ifndef ACTOR_H_
#define ACTOR_H_
#include "GraphObject.h"
// Students: Add code to this file, Actor.cpp, StudentWorld.h, and StudentWorld.cpp
class StudentWorld;
class Actor: public GraphObject
{
public:
Actor(StudentWorld& studentWorld, int imageID, int startX, int startY, int dir, int depth, double size);
virtual void doSomething() = 0;
virtual bool isSolid() {return false;};
bool isAlive() {return m_alive;};
void setAlive(bool b) {m_alive = b;};
virtual void bonk(){};
StudentWorld& world() {return m_studentWorld;};
virtual bool isDamageable() {return true;};
bool getDamaged() {return damaged;};
void setDamaged(bool b) {damaged = b;};
virtual bool isEnemy() {return false;};
virtual void inflictDamage() {};
private:
bool m_alive = true;
StudentWorld& m_studentWorld;
bool damaged = false;
};
class Blipe : public Actor
{
public:
Blipe(StudentWorld& studentWorld, int ID, int x, int y);
void doSomething() {};
bool isSolid() {return true;};
virtual void bonk() {};
bool isDamageable() {return false;};
};
class Block : public Blipe
{
public:
Block(StudentWorld& studentWorld, int startX, int startY);
void bonk();
virtual void spawnPowerUp() {};
void setSpawned(bool b) {spawned = b;};
bool getSpawned() {return spawned;};
private:
bool spawned = false;
};
class FlowerBlock : public Block
{
public:
FlowerBlock(StudentWorld& studentWorld, int startX, int startY);
void spawnPowerUp();
};
class MushroomBlock : public Block
{
public:
MushroomBlock(StudentWorld& studentWorld, int startX, int startY);
void spawnPowerUp();
};
class StarBlock : public Block
{
public:
StarBlock(StudentWorld& studentWorld, int startX, int startY);
void spawnPowerUp();
};
class Pipe : public Blipe
{
public:
Pipe(StudentWorld& studentWorld, int startX, int startY);
};
class Peach : public Actor
{
public:
Peach(StudentWorld& studentWorld, int startX, int startY);
void doSomething();
void bonk();
void inflictDamage();
int getHitPoint() {return m_hitPoint;};
void setHitPoint(int x) {m_hitPoint = x;};
bool getShootPow() {return shootPow;};
void setShootPow(bool b) {shootPow = b;};
bool getJumpPow() {return jumpPow;};
void setJumpPow(bool b) {jumpPow = b;};
bool getStarPow() {return starPow;};
void setStarPow() {starPow = true;};
void setStarTime() {m_starTime = 150;};
bool getTempInvincible() {return tempInvinc;};
private:
int m_hitPoint = 1;
bool power = false;
int m_starTime = 0;
bool starPow = false;
int m_jumpDis = 0;
bool jumpPow = false;
bool shootPow = false;
int m_shootRecharge = 0;
bool tempInvinc = false;//PROBABLY SHOULD IMPLEMENT THIS
int m_timeInvinc = 0;
};
class Projectile : public Actor
{
public:
Projectile(StudentWorld& studentWorld, int ID, int x, int y, int dir);
void doSomething();
virtual bool canDamagePeach() = 0;
bool isDamageable() {return false;};
private:
};
class PiranhaFireball : public Projectile
{
public:
PiranhaFireball(StudentWorld& studentWorld, int x, int y, int dir);
bool canDamagePeach() {return true;};
};
class PeachFireball : public Projectile
{
public:
PeachFireball(StudentWorld& studentWorld, int x, int y, int dir);
PeachFireball(StudentWorld& studentWorld, int ID, int x, int y, int dir);
bool canDamagePeach() {return false;};
private:
};
class Shell : public PeachFireball
{
public:
Shell(StudentWorld& studentWorld, int x, int y, int dir);
};
class Flario : public Actor
{
public:
Flario(StudentWorld& studentWorld, int ID, int x, int y);
bool isDamageable() {return false;};
virtual int returnStatus() = 0;
void doSomething();
};
class Flag : public Flario
{
public:
Flag(StudentWorld& studentWorld, int x, int y);
int returnStatus() {return GWSTATUS_FINISHED_LEVEL;};
};
class Mario : public Flario
{
public:
Mario(StudentWorld& studentWorld, int x, int y);
int returnStatus() {return GWSTATUS_PLAYER_WON;};
};
class Goodies : public Actor
{
public:
Goodies(StudentWorld& studentWorld, int ID, int x, int y);
void doSomething();
virtual int pointInc() = 0;
bool isDamageable() {return false;};
};
class Flower : public Goodies
{
public:
Flower(StudentWorld& studentWorld, int x, int y);
int pointInc() {return 50;};
};
class Mushroom : public Goodies
{
public:
Mushroom(StudentWorld& studentWorld, int x, int y);
int pointInc() {return 75;};
};
class Star : public Goodies
{
public:
Star(StudentWorld& studentWorld, int x, int y);
int pointInc() {return 100;};
};
class Enemy : public Actor
{
public:
Enemy(StudentWorld& studentWorld, int ID, int x, int y);
void doSomething();
void bonk();
virtual bool canMakeShell() {return false;};
void inflictDamage();
bool isEnemy() {return true;};
};
class Goomba : public Enemy
{
public:
Goomba(StudentWorld& studentWorld, int x, int y);
};
class Koopa : public Enemy
{
public:
Koopa(StudentWorld& studentWorld, int x, int y);
bool canMakeShell() {return true;};
};
class Piranha : public Enemy
{
public:
Piranha(StudentWorld& studentWorld, int x, int y);
void doSomething();
private:
int m_shootDelay = 0;
};
#endif // ACTOR_H_