-
Notifications
You must be signed in to change notification settings - Fork 0
/
Options2.js
49 lines (41 loc) · 1.62 KB
/
Options2.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
const Options2State = {
create: function () {
Game.backg=Game.add.image(1,1,'MenuBg')
Game.mute = Game.add .button (Game.world.centerX,Game.world.centerY,'mute',this.actionOnClick,Game)
Game.mute.anchor.setTo(0.5)
Game.mute.animations.add ('mute',[0,1],100,false)
Game.mute.animations.add ('mute2',[1,0],100,false)
Game.back=Game.add.button (1,1,'back',this.actionOnClick2)
Game.fullscreen = Game.add .button (Game.world.centerX,Game.world.centerY-75,'full',this.actionOnClick3,Game)
Game.fullscreen.animations.frame = 1
Game.fullscreen.anchor.setTo (0.5)
Game.controls = Game.add.button (Game.world.centerX, Game.world.centerY+75,'controls',this.actionOnClick4,Game)
Game.controls.anchor.setTo (0.5)
Game.scale.fullScreenScaleMode = Phaser.ScaleManager.EXACT_FIT
},
actionOnClick: function () {
if (!Game.sound.mute){
Game.sound.mute = true
Game.mute.animations.play ('mute')
}else {
Game.sound.mute = false
Game.mute.animations.play ('mute2')
}
},
actionOnClick2: function () {
Game.state.resume ('play')
Game.state.getCurrentState ('play')
},
actionOnClick3: function () {
Game.fullscreen.animations.play ('offToOn')
Game.scale.startFullScreen(true)
Game.fullscreen.animations.frame = 0
if (Game.scale.isFullScreen){
Game.scale.stopFullScreen(true)
Game.fullscreen.animations.frame = 1
}
},
actionOnClick4: function () {
Game.state.start ('Controls')
}
}