mirror of
https://github.com/photonstorm/phaser
synced 2024-12-18 09:03:29 +00:00
13c99f3491
If your game references the old Phaser.StageScaleMode consts like SHOW_ALL you need to update them to Phaser.ScaleManager, i.e. Phaser.ScaleManager.SHOW_ALL. All of the Project Templates have been updated to reflect the above change.
42 lines
934 B
JavaScript
42 lines
934 B
JavaScript
|
|
BasicGame.MainMenu = function (game) {
|
|
|
|
this.music = null;
|
|
this.playButton = null;
|
|
|
|
};
|
|
|
|
BasicGame.MainMenu.prototype = {
|
|
|
|
create: function () {
|
|
|
|
// We've already preloaded our assets, so let's kick right into the Main Menu itself.
|
|
// Here all we're doing is playing some music and adding a picture and button
|
|
// Naturally I expect you to do something significantly better :)
|
|
|
|
this.music = this.add.audio('titleMusic');
|
|
this.music.play();
|
|
|
|
this.add.sprite(0, 0, 'titlepage');
|
|
|
|
this.playButton = this.add.button(400, 600, 'playButton', this.startGame, this, 'buttonOver', 'buttonOut', 'buttonOver');
|
|
|
|
},
|
|
|
|
update: function () {
|
|
|
|
// Do some nice funky main menu effect here
|
|
|
|
},
|
|
|
|
startGame: function (pointer) {
|
|
|
|
// Ok, the Play Button has been clicked or touched, so let's stop the music (otherwise it'll carry on playing)
|
|
this.music.stop();
|
|
|
|
// And start the actual game
|
|
this.state.start('Game');
|
|
|
|
}
|
|
|
|
};
|