-
Notifications
You must be signed in to change notification settings - Fork 0
/
dieState.js
82 lines (68 loc) · 2.8 KB
/
dieState.js
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
const dieState = {
create: function () {
Game.world.setBounds (0,0,1280,720)
Game.backg= Game.add.image (1,1,'MenuBg')
Game.title= Game.add.image (Game.world.centerX,Game.world.centerY-225,"title")
Game.title.anchor.setTo(0.5)
Game.title.scale.setTo(2)
Game.hoverbg = Game.add.sprite (Game.title.x,Game.world.centerY-75,'hoverbg')
Game.hoverbg.anchor.setTo (0.5)
Game.hoverbg.alpha = 0
Game.hoverbg.scale.setTo(0.55,0.8)
Game.hoverbg2 = Game.add.sprite (Game.world.centerX,Game.world.centerY,'hoverbg')
Game.hoverbg2.anchor.setTo (0.5)
Game.hoverbg2.alpha = 0
Game.hoverbg2.scale.setTo(0.7,0.9)
Game.hoverbg3 = Game.add.sprite (Game.world.centerX,Game.world.centerY+75,'hoverbg')
Game.hoverbg3.anchor.setTo (0.5)
Game.hoverbg3.alpha = 0
Game.hoverbg3.scale.setTo(1.03,0.8)
Game.button = Game.add .button (Game.title.x,Game.world.centerY-75,'playb',this.actionOnClick,Game)
Game.button.anchor.setTo(0.5)
Game.button.animations.add ('hover',[0,1,0],6,false)
Game.button2 = Game.add .button (Game.world.centerX,Game.world.centerY,'optb',this.actionOnClick2,Game)
Game.button2.anchor.setTo(0.5)
Game.button3=Game.add .button (Game.world.centerX,Game.world.centerY+75,'mainmenu',this.actionOnClick3,Game)
Game.button3.anchor.setTo(0.5)
Game.buttonSound = Game.add.audio ("button",0.5,)
Game.button.inputEnabled = true
Game.button2.inputEnabled = true
Game.button.inputEnabled = true
Game.button.events.onInputOver.add (function () {
Game.buttonSound.play()
Game.hoverbg.alpha = 0.8
Game.button.animations.play('hover')
})
Game.button.events.onInputOut.add (function () {
Game.buttonSound.stop ()
Game.hoverbg.alpha = 0
})
Game.button2.events.onInputOver.add (function () {
Game.buttonSound.play ()
Game.hoverbg2.alpha = 0.8
Game.button2.animations.play('hover')
})
Game.button2.events.onInputOut.add (function () {
Game.buttonSound.stop ()
Game.hoverbg2.alpha = 0
})
Game.button3.events.onInputOver.add (function () {
Game.buttonSound.play ()
Game.hoverbg3.alpha = 0.8
Game.button3.animations.play('hover')
})
Game.button3.events.onInputOut.add (function () {
Game.buttonSound.stop ()
Game.hoverbg3.alpha = 0
})
},
actionOnClick: function () {
Game.state.start ('play')
},
actionOnClick2: function () {
Game.state.start ('Options')
},
actionOnClick3: function () {
Game.state.start ('MainMenu')
}
}