-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmainMenu.js
49 lines (32 loc) · 1.51 KB
/
mainMenu.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
BasicGame.MainMenu = function (game) {
this.music = null;
this.playButton = null;
};
BasicGame.MainMenu.prototype = {
create: function () {
// RaZ localStorage
localStorage.clear();
// TODO : disable init testing
// localStorage.setItem('done', 'secondLvl');
// 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.add.sprite(0, 0, 'titlepage');
this.loadingText = this.add.text(this.game.width / 2, this.game.height / 2 + 80, "Click to start", { font: "20px monospace", fill: "#fff" });
this.loadingText.anchor.setTo(0.5, 0.5);
this.add.text(this.game.width / 2, this.game.height - 90, "Copyright (c) LD2017", { font: "12px monospace", fill: "#fff", align: "center"}).anchor.setTo(0.5, 0.5);
this.add.text(this.game.width / 2, this.game.height - 75, "Assets Copyright (c) 2017 gallanty.deviantart.com", { font: "12px monospace", fill: "#fff", align: "center"}).anchor.setTo(0.5, 0.5);
},
update: function () {
if (this.input.activePointer.isDown) {
this.startGame();
}
// 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('Gender');
}
};