• Stars
    star
    1,283
  • Rank 36,676 (Top 0.8 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 9 years ago
  • Updated about 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A bootstrap project for create games with Phaser + ES6 + Webpack.

Phaser + ES6 + Webpack.

A bootstrap project to create games with Phaser + ES6 + Webpack.

Phaser+ES6+Webpack

js-standard-style

Phaser 3 supported in this branch: https://github.com/lean/phaser-es6-webpack/tree/phaser3

Typescript supported in this branch: https://github.com/lean/phaser-es6-webpack/tree/typescript

Features

  • ESLINT with JavaScript Standard Style configuration
  • Next generation of Javascript
  • Browsers are automatically updated as you change project files
  • Webpack ready
  • WebFont Loader
  • Multilanguage support
  • PWA Support

Typescript

If you need typescript support checkout the typescript branch. Thanks to @MatsMaker

Setup

You'll need to install a few things before you have a working copy of the project.

1. Clone this repo:

Navigate into your workspace directory.

Run:

git clone https://github.com/lean/phaser-es6-webpack.git

2. Install node.js and npm:

https://nodejs.org/en/

3. Install dependencies (optionally you can install yarn):

Navigate to the cloned repo's directory.

Run:

npm install

or if you chose yarn, just run yarn

4. Run the development server:

Run:

npm run dev

This will run a server so you can run the game in a browser. It will also start a watch process, so you can change the source and the process will recompile and refresh the browser automatically.

To run the game, open your browser and enter http://localhost:3000 into the address bar.

Build for deployment:

Run:

npm run deploy

This will optimize and minimize the compiled bundle.

Deploy for cordova:

Make sure to uncomment the cordova.js file in the src/index.html and to update config.xml with your informations. (name/description...)

More informations about the cordova configuration: https://cordova.apache.org/docs/en/latest/config_ref/

There is 3 platforms actually tested and supported :

  • browser
  • ios
  • android

First run (ios example):

npm run cordova
cordova platform add ios
cordova run ios

Update (ios example):

npm run cordova
cordova platform update ios
cordova run ios

This will optimize and minimize the compiled bundle.

Config:

before you get to work you will surely want to check the config file. You could setup dimensions, webfonts, etc

Webfonts:

In the config file you can specify which webfonts you want to include. In case you do not want to use webfonts simply leave the array empty

Credits

Big thanks to these great repos:

https://github.com/belohlavek/phaser-es6-boilerplate

https://github.com/cstuncsik/phaser-es6-demo

Contributors

https://github.com/RenaudROHLINGER