mirror of
https://github.com/tiennm99/ai-coding-workflow-labs.git
synced 2026-08-14 11:24:28 +00:00
feat: add Phaser config factory, PreloadScene, and GameScene stub
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import Phaser from "phaser";
|
||||
import { PreloadScene } from "./scenes/PreloadScene";
|
||||
import { GameScene } from "./scenes/GameScene";
|
||||
|
||||
export function createPhaserConfig(
|
||||
parent: HTMLElement,
|
||||
width: number,
|
||||
height: number
|
||||
): Phaser.Types.Core.GameConfig {
|
||||
return {
|
||||
type: Phaser.AUTO,
|
||||
parent,
|
||||
width,
|
||||
height,
|
||||
backgroundColor: "#16213e",
|
||||
scene: [PreloadScene, GameScene],
|
||||
scale: {
|
||||
mode: Phaser.Scale.FIT,
|
||||
autoCenter: Phaser.Scale.CENTER_BOTH,
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import Phaser from "phaser";
|
||||
|
||||
export class GameScene extends Phaser.Scene {
|
||||
constructor() {
|
||||
super({ key: "GameScene" });
|
||||
}
|
||||
|
||||
create(): void {
|
||||
this.add
|
||||
.text(this.cameras.main.centerX, this.cameras.main.centerY, "Game Loading...", {
|
||||
fontSize: "24px",
|
||||
color: "#ffffff",
|
||||
})
|
||||
.setOrigin(0.5);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import Phaser from "phaser";
|
||||
|
||||
export class PreloadScene extends Phaser.Scene {
|
||||
constructor() {
|
||||
super({ key: "PreloadScene" });
|
||||
}
|
||||
|
||||
preload(): void {
|
||||
// No assets to load — emoji are rendered as text
|
||||
}
|
||||
|
||||
create(): void {
|
||||
this.scene.start("GameScene");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user