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
|
#include "Monocle.h"
#include "Graphics/SpriteAnimation.h"
#include "LevelEditor/LevelEditor.h"
using namespace Monocle;
namespace Flock
{
int const GROUNDTOP = 200;
int const GROUNDBOTTOM = 590;
// left & right are in scene...
class Sheep : public Entity
{
public:
Sheep();
void Update();
Vector2 velocity;
float aiTime;
std::string state;
SpriteAnimation *sprite;
AudioAsset *baah, *scaredogg;
AudioDeck *deck, *scared;
float const WALKSPEED;
float const DOGSPEED; // speed when being herded
int const DOGDISTANCE; // distance within which sheep runs from dog
float const WOLFSPEED; // speed when running from wolf
int const WOLFDISTANCE; // distance within which sheep runs from rolf
int const GENERALAWARENESS; // distance for noticing interesting things
};
class Wolf : public Entity
{
public:
Wolf();
void Update();
Vector2 velocity;
float aiTime;
std::string state;
SpriteAnimation *sprite;
Sheep *chasing;
float const WALKSPEED;
float const DOGSPEED; // speed when being herded
int const DOGDISTANCE; // distance within which sheep runs from dog
float const SHEEPSPEED; // speed when being chasing sheep
int const SHEEPDISTANCE; // distance within which wolf chases sheep
};
class Dog : public Entity
{
public:
Dog();
void Update();
Vector2 velocity;
SpriteAnimation *sprite;
float const VELOCITY;
};
class Background : public Entity
{
public:
Background();
void Render();
Sprite *sprite;
};
class FlockScene : public Scene
{
public:
FlockScene();
void Begin();
void Update();
void HideSpawners();
void ShowSpawners();
void Spawn(int x);
LevelEditor *levelEditor;
Vector2 cameraTarget;
bool transitioning;
bool win;
int leftBoundary;
int rightBoundary;
};
class Text: public Entity
{
public:
Text(const std::string& text, FontAsset* font=NULL);
void Render();
void SetFont(FontAsset* font) { this->font = font; }
void SetText(const std::string& text) { this->text = text; }
protected:
FontAsset* font;
std::string text;
};
}
|