Home

Awesome

Phaser CE TypeScript ParcelJS

<div align="center"> <img src="https://raw.githubusercontent.com/Cerlancism/Phaser-CE-TypeScript-ParcelJS/master/Banner.png" width="640" alt="Banner" /> </div>

Phaser CE boilerplate.

Try out here

https://cerlancism.github.io/Phaser-CE-TypeScript-ParcelJS/build/

Features

Installation

Set Up

Clone this repository.

Open this folder in Visual Studio code and from menu:
Terminal -> New Terminal

npm install Download tools and dependencies (one time)

npm start To develop (work in src folder, creates dev folder, open in browser http://localhost:1234)

npm run build To build (minified and playable offline, creates build folder)

Important Note

Due to bundling and limitation of mounting Phaser to window scope, do not import Phaser as destructured ES modules (becareful as this is suggested by auto import), for example:

// You can use ES Modules for your own modules.
import { Logger } from '/utilities'
// But do not use ES Modules for Phaser.
import { Game, IGameConfig } from 'phaser-ce'

const config: IGameConfig = { /* Configs */ }
const game = new Game(config)

Logger.log("Game Created")

This will cause the build size to bloat as Phaser will be included twice. To prevent this, use Phaser only as namepace:

import { Logger } from '/utilities'

// Do use Phaser only as namepace.
const config: Phaser.IGameConfig = { /* Configs */ }
const game = new Phaser.Game(config)

Logger.log("Game Created")

Credits