-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathActor.h
More file actions
179 lines (153 loc) · 3.85 KB
/
Actor.h
File metadata and controls
179 lines (153 loc) · 3.85 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
173
174
175
176
177
178
179
#ifndef ACTOR_H_
#define ACTOR_H_
#include "GraphObject.h"
class StudentWorld;
// Students: Add code to this file, Actor.cpp, StudentWorld.h, and StudentWorld.cpp
class Actor : public GraphObject {
public:
//base
Actor(int imageID, double startX, double startY, StudentWorld* sw, int dir, int depth, int health);
virtual ~Actor();
virtual void doSomething() = 0;
//virtual functions
virtual bool canBlock() const { return false; }
virtual bool canBeHit() const { return false; }
virtual bool isEdible() const { return false; }
virtual int damage() { return 0; }
virtual int score() const { return 0; }
//non virtual functions
void updateHealth(int health);
int getHealth() const;
bool isAlive() const;
StudentWorld* getWorld() const;
private:
StudentWorld* m_gw;
int m_health;
};
class Socrates : public Actor {
public:
Socrates(StudentWorld* sw);
virtual ~Socrates();
virtual void doSomething();
int getSpray() const;
int getFlames() const;
void addFlames();
private:
int m_sprayCharge;
int m_flameCharge;
bool m_didNothing;
};
class Bacteria : public Actor {
public:
Bacteria(int id, double startX, double startY, StudentWorld* sw, int health);
bool canBeHit() const { return true; }
int getFood() const;
int getMove() const;
void newAngle();
void setFood(int change);
void move(int change);
private:
int m_foodEaten;
int m_ovementPlan;
Pit* m_dad;
};
class RegSalmon : public Bacteria {
public:
RegSalmon(double startX, double startY, StudentWorld* sw);
void doSomething();
int damage() const { return -1; }
};
class AggSalmon : public Bacteria {
public:
AggSalmon(double startX, double startY, StudentWorld* sw);
void doSomething();
int damage() const { return -2; }
};
class Ecoli : public Bacteria {
public:
Ecoli(double startX, double startY, StudentWorld* sw);
void doSomething();
int damage() const { return -4; }
};
////holds bacterias
class Pit : public Actor {
public:
Pit(double startX, double startY, StudentWorld* sw);
void doSomething();
private:
int m_aggroSalmon;
int m_regSalmon;
int m_Ecoli;
int m_total;
};
//
////disinfectant spray
////flame
class Projectile : public Actor {
public:
Projectile(int imageID, double startX, double startY, StudentWorld* sw, int dir);
void doSomething();
void setDistance(int dist);
int getDistance() const;
private:
int m_distance;
};
class Spray : public Projectile {
public:
Spray(double startX, double startY, StudentWorld* sw, int dir);
virtual int damage() { return -2; }
private:
};
class Flames : public Projectile {
public:
Flames(double startX, double startY, StudentWorld* sw, int dir);
virtual int damage() { return -5; }
private:
};
//
////health goodie
////flame thrower goodie
////extra life goodie
class Goodie : public Actor {
public:
Goodie(int ID, double startX, double startY, StudentWorld* sw, int life, int score);
virtual void doSomething();
virtual bool isEdible() const { return true; }
virtual bool canBeHit() const { return true; }
int score() const;
private:
int m_score;
};
class HealthGoodie : public Goodie {
public:
HealthGoodie(double startX, double startY, StudentWorld* sw, int life);
private:
};
class FlameGoodie : public Goodie {
public:
FlameGoodie(double startX, double startY, StudentWorld* sw, int life);
};
class ExtraLife : public Goodie {
public:
ExtraLife(double startX, double startY, StudentWorld* sw, int life);
};
class Fungus : public Goodie {
public:
Fungus(double startX, double startY, StudentWorld* sw, int life);
};
class Food : public Actor {
public:
Food(double startX, double startY, StudentWorld* sw);
virtual bool isEdible() const { return true; }
void doSomething();
private:
};
class Dirt : public Actor {
public:
Dirt(double startX, double startY, StudentWorld* sw);
virtual void doSomething();
virtual bool canBeHit() const { return true; }
virtual bool canBlock() const { return true; }
private:
};
#endif // ACTOR_H_