-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlevelSelect.js
64 lines (53 loc) · 1.9 KB
/
levelSelect.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// This state is used for the level select screen. It is called when button is pressed from title screen.
var LevelSelect = function(game) {
console.log('Level Select loaded');
};
LevelSelect.prototype = {
create: function() {
var cX = this.game.world.centerX;
var cY = this.game.world.centerY;
// Button for stage One
var stageOneButton = this.game.add.button(cX, cY - 225, 'stageBanner', this.startLevelOne, this);
stageOneButton.anchor.set(0.5);
var stageOneText = game.add.text(0, 0, 'Stage : 1', {
font: 'Aldrich',
fontSize: '72px',
fill: '#000'
});
stageOneText.anchor.set(0.5);
stageOneButton.addChild(stageOneText);
// Button for stage Two
var stageTwoButton = this.game.add.button(cX, cY, 'stageBanner', this.startLevelTwo, this);
stageTwoButton.anchor.set(0.5);
var stageTwoText = game.add.text(0, 0, 'Stage : 2', {
font: 'Aldrich',
fontSize: '72px',
fill: '#000'
});
stageTwoText.anchor.set(0.5);
stageTwoButton.addChild(stageTwoText);
// Button to return to Title screen
var backButton = this.game.add.button(cX, cY + 225, 'stageBanner', this.backToMenu, this);
backButton.anchor.set(0.5);
var backText = game.add.text(0, 0, 'Back', {
font: 'Aldrich',
fontSize: '72px',
fill: '#000'
});
backText.anchor.set(0.5);
backButton.addChild(backText);
},
startLevelOne: function() {
globals.stage = 1;
console.log('Loading stage 1');
this.game.state.start('Main');
},
startLevelTwo: function() {
globals.stage = 2;
console.log('Loading stage 2');
this.game.state.start('Main');
},
backToMenu: function() {
this.game.state.start('Title');
},
};