A Yeoman generator to create HTML5 games with Phaser. This generator allows for the creation of Phaser games with best practices. The main generator (yo phaser
) outputs a basic Phaser game. You can also generate new prefabs (yo phaser:prefab
) or states (yo phaser:state
) to add to your project.
You can view your game in the browser by running npm start
from the project's root directory and the web page will refresh as you save your files.
When you are ready to publish, build your game with npm run build
and view the output in the build/
folder. The build process minifies and compresses individual files into one file for faster network downloading, the source code is transpiled to ES5 compatible JavaScript using Babel.
INSTRUCTIONS
Install Node.js
Install the required npm modules by issuing these commands:
npm install -g yo generator-phaser
Create a new directory for your game:
mkdir ~/Desktop/mygame && cd $_
mkdir %USERPROFILE%\Desktop\mygame && cd %USERPROFILE%\Desktop\mygame
Invoke the generator:
yo phaser
Invoke the state generator (Note: this updates & overwrites main.js
):
yo phaser:state
Invoke the prefab generator:
yo phaser:prefab
Invoke the shader generator:
yo phaser:shader
Run a local development server (livereload enabled) with this command:
npm start
Package your game (i.e. minify css, html and js) with:
npm run build
Notes
The game's main.js
file will be updated with new states when you run the state generator.
It adds in .js files found in the src/states/
directory.
CREDITS
@photonstorm for creating Phaser.
The guys behind yeoman.
Keney.nl for the default game's images, erkanozan for gunshot audio, iut_Paris8 for 'ding' audio
All other repo contributors