source-code/
break-the-web
Public
codeCodeinfoIssues 0call_splitPull Requestsplay_circleActions
break-the-web/src/game/main.ts
typescript33 lines793 B
import { AUTO, Game } from 'phaser';

import { PrologueScene } from './scenes/PrologueScene';
import { HorrorScene } from './scenes/HorrorScene';

const config: Phaser.Types.Core.GameConfig = {
    type: AUTO,
    width: 800,
    height: 500,
    parent: 'game-container',
    backgroundColor: '#0a0a0a',
    physics: {
        default: 'arcade',
        arcade: {
            gravity: { x: 0, y: 0 },
            debug: false
        }
    },
    scene: []
};

const StartGame = (parent: string | HTMLElement) => {
    const isHorror = (window as any).isHorrorMode || false;
    const finalConfig = {
        ...config,
        parent,
        scene: isHorror ? [HorrorScene, PrologueScene] : [PrologueScene, HorrorScene]
    };
    return new Game(finalConfig);
}

export default StartGame;

About

Interact with the web page itself using HTML5 Drag-and-Drop to pull inputs and images directly into the Phaser physics engine. Alter the website state through bi-directional communication between React and Phaser, unlocking a glitchy horror mode. The game is built using React, Phaser 3, Zustand for state management, and Vanilla CSS.

ReactPhaser 3TypeScriptZustandVite

Contributors

1