53 lines
1.2 KiB
JavaScript
53 lines
1.2 KiB
JavaScript
export class IntroScene extends Phaser.Scene {
|
|
constructor() {
|
|
super({ key: 'IntroScene' });
|
|
}
|
|
|
|
create() {
|
|
const W = this.scale.width;
|
|
const H = this.scale.height;
|
|
|
|
this.add.rectangle(W / 2, H / 2, W, H, 0x000000);
|
|
|
|
this.add.text(W / 2, H / 2 - 100, 'OVERRUN', {
|
|
fontFamily: 'FutureImperfect',
|
|
fontSize: '72px',
|
|
fill: '#00ccff',
|
|
stroke: '#003366',
|
|
strokeThickness: 6,
|
|
}).setOrigin(0.5);
|
|
|
|
this.add.text(W / 2, H / 2, 'Survive the waves. Choose your power.', {
|
|
fontSize: '20px',
|
|
fill: '#aaaaaa',
|
|
}).setOrigin(0.5);
|
|
|
|
const prompt = this.add.text(W / 2, H / 2 + 80, 'Press ENTER or click to start', {
|
|
fontSize: '22px',
|
|
fill: '#ffffff',
|
|
}).setOrigin(0.5);
|
|
|
|
// Blink the prompt
|
|
this.tweens.add({
|
|
targets: prompt,
|
|
alpha: 0,
|
|
duration: 600,
|
|
yoyo: true,
|
|
repeat: -1,
|
|
});
|
|
|
|
// Controls hint
|
|
this.add.text(W / 2, H - 60, 'WASD — Move Mouse — Aim Left Click — Fire', {
|
|
fontSize: '14px',
|
|
fill: '#666666',
|
|
}).setOrigin(0.5);
|
|
|
|
this.input.keyboard.once('keydown-ENTER', () => this._start());
|
|
this.input.once('pointerdown', () => this._start());
|
|
}
|
|
|
|
_start() {
|
|
this.scene.start('GameScene');
|
|
}
|
|
}
|