Kimeiga / nuke-hone

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Phaser 3 with Parcel

Parcel is a fast, zero-config web application bundler.

This is a simple Phaser game template using Parcel, and based on Making your first Phaser 3 game.

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
# 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 need to be imported or required:

require('../assets/sky.png') // -> './sky.8fef0675.png'

See bootScene for an example.

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

Package aliasing

You can use package.alias to specify an alternative Phaser build, e.g.,

{
  "name": "my-phaser-game",
  "alias": {
    "phaser": "./node_modules/phaser/src/phaser-arcade-physics.js"
  }
}

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


Languages

Language:JavaScript 97.4%Language:HTML 2.6%