Aethelgard/js/scenes/MenuScene.js

12 lines
374 B
JavaScript

export default class MenuScene extends Phaser.Scene {
constructor() { super('Menu'); }
preload() {}
create() {
const { width, height } = this.scale;
this.add.text(width/2, height/2, 'Press SPACE to Start', { font: '32px Arial', fill: '#fff' }).setOrigin(0.5);
this.input.keyboard.once('keydown-SPACE', () => {
this.scene.start('Game');
});
}
}