From 0c22172952f8cb092110122354d40095f33d15a1 Mon Sep 17 00:00:00 2001 From: Mark Date: Thu, 25 Apr 2024 22:29:55 -0400 Subject: [PATCH] feat(scenes): add Lose --- src/constants/key.ts | 1 + src/scenes/Lose.tsx | 42 ++++++++++++++++++++++++++++++++++++++++++ src/scenes/Main.tsx | 4 ++++ src/scenes/index.ts | 1 + 4 files changed, 48 insertions(+) create mode 100644 src/scenes/Lose.tsx diff --git a/src/constants/key.ts b/src/constants/key.ts index 4aac180..cd2622a 100644 --- a/src/constants/key.ts +++ b/src/constants/key.ts @@ -9,6 +9,7 @@ const image = { const scene = { boot: 'boot', + lose: 'lose', main: 'main', menu: 'menu', win: 'win', diff --git a/src/scenes/Lose.tsx b/src/scenes/Lose.tsx new file mode 100644 index 0000000..41a12b0 --- /dev/null +++ b/src/scenes/Lose.tsx @@ -0,0 +1,42 @@ +import { Scene } from 'phaser'; +import { render, Text } from 'phaser-jsx'; + +import { Button } from '../components'; +import { key } from '../constants'; + +export class Lose extends Scene { + constructor() { + super(key.scene.lose); + } + + create() { + const { centerX, centerY } = this.cameras.main; + + render( + <> + + + + , + this, + ); + } +} diff --git a/src/scenes/Main.tsx b/src/scenes/Main.tsx index a72cebd..e7a581a 100644 --- a/src/scenes/Main.tsx +++ b/src/scenes/Main.tsx @@ -85,6 +85,10 @@ export class Main extends Phaser.Scene { 0, 1, ); + + if (this.vignette.radius === 0) { + this.scene.start(key.scene.lose); + } }, callbackScope: this, loop: true, diff --git a/src/scenes/index.ts b/src/scenes/index.ts index 871834b..5a04645 100644 --- a/src/scenes/index.ts +++ b/src/scenes/index.ts @@ -1,4 +1,5 @@ export * from './Boot'; +export * from './Lose'; export * from './Main'; export * from './Menu'; export * from './Win';