2013-10-30 03:46:52 +00:00
|
|
|
|
2013-10-28 23:29:04 +00:00
|
|
|
BasicGame.MainMenu = function (game) {
|
|
|
|
|
|
|
|
this.music = null;
|
|
|
|
this.playButton = null;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
BasicGame.MainMenu.prototype = {
|
|
|
|
|
|
|
|
create: function () {
|
|
|
|
|
2013-11-06 16:46:21 +00:00
|
|
|
// We've already preloaded our assets, so let's kick right into the Main Menu itself.
|
2013-10-28 23:29:04 +00:00
|
|
|
// 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
|
2014-02-25 14:46:48 +00:00
|
|
|
this.state.start('Game');
|
2013-10-28 23:29:04 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|