-
Notifications
You must be signed in to change notification settings - Fork 0
/
Screens.hx
225 lines (195 loc) · 5.61 KB
/
Screens.hx
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
import flash.text.TextField;
import flash.text.TextFormat;
import flash.text.TextFormatAlign;
class GameFont extends flash.text.Font {}
class GameFormat extends TextFormat {
public function new() {
super();
font = "GameFont";
color = 0xffffcc;
}
}
class StartMessage extends TextField {
public function new() {
super();
embedFonts = true;
wordWrap = true;
var format = new GameFormat();
format.size = 12;
setTextFormat(format);
}
}
class StartTitle extends TextField {
public function new() {
super();
x = 30;
y = 20;
width = 500;
height = 40;
embedFonts = true;
var titleFormat = new GameFormat();
titleFormat.size = 36;
titleFormat.bold = true;
text = "Zombie Protagonist";
setTextFormat(titleFormat);
}
}
class StartIntro1 extends StartMessage {
public function new() {
super();
x = 30;
y = 80;
width = 540;
height = 15;
text = "Zombies are taking over the world. And they're invulnerable. Sucks to be you.";
}
}
class StartHero extends StartMessage {
public function new() {
super();
x = 60;
y = 105;
width = 480;
height = 45;
text = "This is you. You're smarter than most, and will be able to fend off one or two zombies at a time without infection. Use the arrow keys to move. Hit the spacebar to yell.";
}
}
class StartZombie extends StartMessage {
public function new() {
super();
x = 60;
y = 170;
width = 480;
height = 45;
text = "This is your standard garden-variety zombie. You can't kill them. Still, they're slow and stupid, and will follow the nearest human they see. Or, if you yell at them, they'll follow you instead.";
}
}
class StartHuman extends StartMessage {
public function new() {
super();
x = 60;
y = 225;
width = 480;
height = 45;
text = "And this is an innocent human. They're also pretty stupid, and will flee nearby zombies, or run around in a random panic. Or, if you yell at them, they'll follow you. If they get touched by a zombie, they'll get infected, and will turn into a zombie.";
}
}
class StartHaven extends StartMessage {
public function new() {
super();
x = 60;
y = 280;
width = 480;
height = 45;
text = "This is the safe haven. Get people in, keep zombies (and infected people) out. Nobody can get in unless you're already inside, so have people follow you in, and duck out before the zombies can enter.";
}
}
class StartIntro2 extends StartMessage {
public function new() {
super();
x = 30;
y = 340;
width = 540;
height = 60;
text = "Right. That's it. Arrow keys to move. Spacebar to yell.\n\nAnd don't die.";
var format = new GameFormat();
format.size = 16;
setTextFormat(format);
}
}
class LevelMessage extends TextField {
public function new() {
super();
x = 100;
y = 80;
width = 400;
height = 300;
embedFonts = true;
wordWrap = true;
visible = false;
var format = new GameFormat();
var titleFormat = new GameFormat();
format.size = 12;
titleFormat.size = 36;
titleFormat.bold = true;
text = "Congratulations";
text += "\n\n";
text += "You've managed to keep yourself and some people alive for a little longer. Enjoy a brief rest, and get ready for the next level.\n\n\n";
text += "Hit the space bar when you're ready.";
setTextFormat(format);
setTextFormat(titleFormat, 0, 15);
}
}
class DeadMessage extends TextField {
public function new() {
super();
x = 50;
y = 200;
width = 500;
height = 200;
visible = false;
text = "Game Over! You died!";
embedFonts = true;
var format = new GameFormat();
format.bold = true;
format.size = 48;
setTextFormat(format);
}
}
class FailedMessage extends TextField {
public function new() {
super();
x = 25;
y = 200;
width = 550;
height = 200;
visible = false;
text = "Game Over! All the humans died!";
embedFonts = true;
var format = new GameFormat();
format.bold = true;
format.size = 36;
setTextFormat(format);
}
}
class GameLabel extends TextField {
public function new(labelString) {
super();
height = 15;
embedFonts = true;
text = labelString;
var format = new GameFormat();
format.size = 12;
format.align = TextFormatAlign.CENTER;
setTextFormat(format);
}
}
class NumDisplay extends TextField {
private var digits : Int;
public function new(digits) {
this.digits = digits;
super();
height = 60;
width = digits * 40;
embedFonts = true;
for (i in 0...digits) {
text += "0";
}
var format = new GameFormat();
format.size = 58;
format.align = TextFormatAlign.CENTER;
setTextFormat(format);
defaultTextFormat = format;
}
public function update(number : Int) {
var newtext = number + "";
var counter = 10;
for (i in 1...digits) {
if (number < counter) {
newtext = "0" + newtext;
}
counter = counter * 10;
}
text = newtext;
}
}