source-code/
break-the-web
Public
typescript36 lines863 B
import { Scene } from 'phaser';
export class GameOver extends Scene
{
camera: Phaser.Cameras.Scene2D.Camera;
background: Phaser.GameObjects.Image;
gameover_text : Phaser.GameObjects.Text;
constructor ()
{
super('GameOver');
}
create ()
{
this.camera = this.cameras.main
this.camera.setBackgroundColor(0xff0000);
this.background = this.add.image(512, 384, 'background');
this.background.setAlpha(0.5);
this.gameover_text = this.add.text(512, 384, 'Game Over', {
fontFamily: 'Arial Black', fontSize: 64, color: '#ffffff',
stroke: '#000000', strokeThickness: 8,
align: 'center'
});
this.gameover_text.setOrigin(0.5);
this.input.once('pointerdown', () => {
this.scene.start('MainMenu');
});
}
}
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.
linknre.codes
ReactPhaser 3TypeScriptZustandVite