-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathselect.js
More file actions
60 lines (52 loc) · 2 KB
/
select.js
File metadata and controls
60 lines (52 loc) · 2 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
var endState = {
preload: function() {
game.load.image('win_bg', 'assets/win_bg.jpg');
game.load.image('lose_bg', 'assets/lose_bg.jpg');
game.load.spritesheet('play_bt', 'assets/playbutton.png', 249, 83);
game.load.spritesheet('setting_bt', 'assets/settingbutton.png', 250, 100);
},
create: function() {
if(outcome){
this.winScreen();
}
else{
this.loseScreen();
}
this.play_bt = game.add.button(game.world.centerX - 295, 100, 'play_bt', this.playClick, this, 1, 0, 0);
this.setting_bt = game.add.button(game.world.centerX - 295, 200, 'setting_bt', this.settingClick, this, 1, 0, 0);
this.play_bt.onInputOver.add(this.buttonOver,this);
this.setting_bt.onInputOver.add(this.buttonOver,this);
stateText.text=scoreString+score;
game.add.text(game.world.centerX-272, 320, stateText.text, { font: '50px Georgia', fill: '#fff' });
},
loseScreen:function(){
// background
this.lose_bg=game.add.image(0,0,'lose_bg');
this.lose_bg.scale.setTo(0.5,0.5);
game.add.text(game.world.centerX-272, 400, 'You Lose', { font: '50px Georgia', fill: '#fff' });
},
winScreen:function(){
// background
this.win_bg=game.add.image(-200,0,'win_bg');
this.win_bg.scale.setTo(0.68,0.68);
game.add.text(game.world.centerX-272, 400, 'You Win', { font: '50px Georgia', fill: '#fff' });
// scoreText.text = scoreString + score;
// stateText.text = " You Won \n";
// stateText.visible = true;
},
buttonOver:function(){
this.buttonSound=game.add.audio('button_sound');
if(soundmute==0)
this.buttonSound.play();
},
playClick:function(){
score=0;
outcome=0;
game.state.start('level1');
},
settingClick:function(){
game.state.start('setting');
},
update: function() {
}
};