/
mapSelector.js
56 lines (52 loc) · 2.12 KB
/
mapSelector.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
var map = 1;
var nextMap;
var preMap;
class mapSelector extends Phaser.Scene {
constructor() {
super("mapSelector");
};
preload(){
};
create(){
this.sound.stopAll();
this.sound.play("Spagetti", {volume:.25, loop: true});
this.add.image(400,225,"ui");
var map1 = this.add.image(680,240,"map1").setScale(.24);
map1.setInteractive();
map1.on("pointerdown", ()=>{
this.scene.start("map1");
});
var map2 = this.add.image(680,240,"map2").setScale(.24).setVisible(false);
map2.setInteractive()
map2.on("pointerdown", ()=>{
this.scene.start("map2");
});
var map3 = this.add.image(680,240,"map3").setScale(.24).setVisible(false);
var map4 = this.add.image(680,240,"map4").setScale(.24).setVisible(false);
var map5 = this.add.image(680,240,"map5").setScale(.24).setVisible(false);
var map1Dif = this.add.text(600, 425, "Difficulty: Easy", {color: "black", fontFamily: "texat"}).setScale(.9);
var map2Dif = this.add.text(600, 425, "Difficulty: Medium", {color: "black", fontFamily: "texat"}).setScale(.75).setVisible(false);
var map3Dif = this.add.text(600, 425, "Difficulty: Medium", {color: "black", fontFamily: "texat"}).setScale(.75).setVisible(false);
var map4Dif = this.add.text(600, 425, "Difficulty: Medium", {color: "black", fontFamily: "texat"}).setScale(.75).setVisible(false);
var map5Dif = this.add.text(600, 425, "Difficulty: Hard", {color: "black", fontFamily: "texat"}).setScale(.85).setVisible(false);
var arrowNext = this.add.sprite(755,400,"arrowSign").setScale(.15).setInteractive();
var arrowPre = this.add.sprite(585,400,"arrowSign").setScale(.15).setInteractive();
arrowPre.flipX = true;
arrowNext.on("pointerdown", () => {
nextMap = map + 1;
eval("map"+nextMap).setVisible(true);
eval("map"+nextMap+"Dif").setVisible(true);
eval("map"+map).setVisible(false);
eval("map"+map+"Dif").setVisible(false);
map += 1;
});
arrowPre.on("pointerdown", () => {
preMap = map - 1;
eval("map"+preMap).setVisible(true);
eval("map"+preMap+"Dif").setVisible(true);
eval("map"+map).setVisible(false);
eval("map"+map+"Dif").setVisible(false);
map -= 1;
});
}
}