-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsceneTitle.js
32 lines (23 loc) · 960 Bytes
/
sceneTitle.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
export const sceneTitle = new Phaser.Scene('sceneTitle');
let music;
sceneTitle.preload = function () {
this.load.image("title", `assets/title/title.png`);
console.log("loading music ")
this.load.audio("titleMusic", 'assets/audio/title.ogg');
}
sceneTitle.create = function () {
const key = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.ENTER);
this.r = this.add.rectangle(320, 240, 800, 850, 0x222288);
//this.add.image(320, 240, "title");
this.add.text(150, 50, "Super game made up with SEA",
{ color: "white", fontFamily: 'Arial', fontSize: '64px', wordWrap: { width: 400, useAdvancedWrap: true } });
this.add.text(280, 350, "Press start",
{ color: "white", fontFamily: 'Arial', fontSize: '32px' });
music = this.sound.add("titleMusic");
music.loop = true;
music.play();
key.on('down', () => {
music.pause();
this.scene.switch('sceneGame');
});
}