-
Notifications
You must be signed in to change notification settings - Fork 0
/
S_MenuState.as
75 lines (63 loc) · 1.87 KB
/
S_MenuState.as
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
package
{
import flash.display.MovieClip;
public class S_MenuState extends StateMachine
{
private var refToDocClass;
private var startButton;
private var helpButton;
private var creditsButton;
private var muteSoundButton;
private var menuBackground;
public function S_MenuState(documentClass)
{
refToDocClass = documentClass;
//Create GUI
startButton = new GUIButton(refToDocClass, "ENTER_GAME", new ButtonStart());
startButton.x = 562.65;
startButton.startX = 562.65;
startButton.y = 283.15;
muteSoundButton = new GUIButton(refToDocClass, "MUTE_SOUNDS", new ButtonSound());
muteSoundButton.x = 727.8;
muteSoundButton.startX = 727.8;
muteSoundButton.y = 14.6;
helpButton = new GUIButton(refToDocClass, "ENTER_HELP", new ButtonHelp());
helpButton.x = 561.65;
helpButton.startX = 561.65;
helpButton.y = 368.15;
creditsButton = new GUIButton(refToDocClass, "ENTER_CREDITS", new ButtonCredits());
creditsButton.x = 561.65;
creditsButton.startX = 561.65;
creditsButton.y = 447.65;
//Create the background image for the menu state
menuBackground = new TitleBackground();
addChild(menuBackground);
addChild(startButton);
addChild(muteSoundButton);
addChild(helpButton);
addChild(creditsButton);
}
//Update the buttons
override public function update()
{
startButton.update(mouseIsPressed);
muteSoundButton.update(mouseIsPressed);
creditsButton.update(mouseIsPressed);
helpButton.update(mouseIsPressed);
}
override public function keyPressed(key)
{
}
override public function keyReleased(key)
{
}
//Tell the buttons when the gui registered a mouse down event
override public function mousePressed()
{
startButton.mousePressed();
muteSoundButton.mousePressed();
creditsButton.mousePressed();
helpButton.mousePressed();
}
}
}