-
Notifications
You must be signed in to change notification settings - Fork 0
/
title.js
41 lines (30 loc) · 1.11 KB
/
title.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
demo.title = function (game) {};
demo.title.prototype = {
create:function(game){
titlescreenBackground = game.add.sprite(0,0,'titleBackground');
this.createButton(game,"Play",548,350,200,50,function(){
this.state.start('cutscene');
backgroundMusic.stop();
});
titlescreen = game.add.sprite(548, 128, 'titlescreen');
titlescreen.anchor.setTo(0.5,0.5);
backgroundMusic = game.add.audio('titleMusic');
backgroundMusic.loop = true;
backgroundMusic.play();
},
update:function(game){
},
createButton: function(game,string,x,y,w,h,callback){
var button1 = game.add.button(x,y,'button',callback,this,2,1,0);
button1.anchor.setTo(0.5,0.5);
button1.width = w;
button1.height = h;
var txt = game.add.text(button1.x,button1.y,string,
{
font:"14px Arial",
fill:"#fff",
align:"center"
});
txt.anchor.setTo(0.5,0.5);
}
};