samme / phaser-ce-parcel

A Phaser CE game template using Parcel bundler

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Phaser CE with Parcel

This is a Phaser CE game template using Parcel. Most common transformations (CoffeeScript, Babel/Flow, TypeScript) work “out of the box”.

Use

# If you don't have Parcel, install it:
npm install -g parcel-bundler

# Clone or download this repo.
# From the project directory, install:
npm install

# Auto-compile and run dev server:
npm run start

# Compile for production:
npm run build

You can edit these scripts in package.json to suit your needs. See:

Game assets

Static assets used in your JavaScript must be imported:

import space from './assets/space.png'; // -> './space.89e3a46b.png'
// OR
import images from './assets/*.png'; // -> { space: './space.89e3a46b.png', … }

See LoadState for an example.

If you prefer, you can use a plugin to copy static assets instead.

Hot reload

When running the dev server the game is destroyed and then recreated after you save changes to your files. Rarely, this can fail. Just refresh the browser.

If you don't like hot reload at all, you can turn it off:

parcel serve src/index.html --no-hmr

About

A Phaser CE game template using Parcel bundler


Languages

Language:JavaScript 94.8%Language:HTML 5.2%