-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmenu.js
More file actions
63 lines (53 loc) · 1.59 KB
/
Copy pathmenu.js
File metadata and controls
63 lines (53 loc) · 1.59 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
function Menu(startCallback) {
var self = this,
halfScreen = CAMERA_W / 2;
self.land = new Texture(camera.textureWidth, camera.heightDiff, LAND).generate();
self.sky = new Texture(camera.textureWidth / camera.parallaxFactor, camera.h, SKY).generate(8);
self.w = CAMERA_W;
self.units = {
'1': new Fire(random(250, 820)),
'2': new Cactus(100)
};
self.textsCopy = [
[0, 1, {
text: 'PRESS Z TO PLAY',
font: 'italic bold 56px Verdana',
color: COLOR_RED,
x: halfScreen,
y: 190,
shake: 1,
center: true
}],
[0, 1, {
text: 'PRESS X TO LAUNCH TUTORIAL',
font: 'italic bold 22px Verdana',
color: COLOR_RED,
x: halfScreen,
y: 240,
center: true
}],
[0, 1, {
text: 'Z and X to ATTACK',
x: halfScreen - halfScreen / 2,
y: 310,
center: true
}],
[0, 1, {
text: 'ARROWS to MOVE',
x: halfScreen + halfScreen / 2,
y: 310,
center: true
}],
[0, 1, {
text: 'Q to toggle MUSIC',
x: halfScreen,
y: 85,
center: true
}]
];
self.texts = []; // That's to be looked up by `camera.postEffects`. Texts will be added here by Level.updateTexts().
off();
on('KeyZ', startCallback.bind(null, 1)); // Start the game.
on('KeyX', startCallback.bind(null, 0)); // Tutorial (zeroth level).
}
extend(Menu, Level);