A slush generator for createing phaser games using es6 module system
A starting point to build a game with Phaser, using "ES6 modules" to organise your code.
Frameworks and tools used to make it possible:
Simply run the following command:
npm install -g slush-phaser-project
Navigate to where you want to develop your game (you can create a new folder too if you like).
$ cd /path/to/folder$ mkdir myGreatGame$ cd ./myGreatGame
Then call the slush template to begin.
$ slush phaser-project
Finally run gulp to launch a server.
After installed there should be a
phaser command in your PATH, try
phaser --version to check it.
Now there's only generator support from the cli command, maybe project or some other features will be added, but I dont have any idea about that. Feel free to tell me what you think :D
NOTE: to make generator work as you want, please locate to
GAME_ROOT instead of
phaser [command] [options] Commands: g|generate // Generate a new scene/prefab with ES6 support Options: -h, --help output usage information -V, --version output the version number Command-Specific Help: phaser [command] --help
Generate a new state called
phaser g state:credits
Generate a new sprite prefab
phaser g sprite:trigger
Generate a new sprite prefab
phaser g sprite:triggers/radar
The workflow introduced below is recommended but not forced which will just make your life easier :D
There're 2 folders "design" and "media" created at root path, both of them are empty by default.
The "design" folder is made for your game design docs, graphs and sketches.
The "media" folder is for your original assets(ai, psd, wav...). You may process them with tools like TexturePacker, Audacity... to phaser friendly formats(png, ogg...) and put them into
static/assets for use.
When editing source code, make sure you update the files within the
project directory. These files will then be compiled and reload for developing or compressed and added to the
dist directory for publishing.
ECMAScript 6 features are supported with help of Traceur. This means you can write code with syntax which is going to be supported officially by Phaser 3.
Google analytics have been included so that you can track user actions. This is useful for seeing how far the user gets, which in turn will alert you to any bugs or levels that are impossible to complete.
To track an event, just add the following code anywhere in your game:
gameanalyticstrackEvent'action' 'label' 'value';
Only the action is required, but you may want to add extra options, such as health, level or simply what just happend.
"Perhaps by early 2015 we ought to be looking at going purely ES6? Moving to using more advanced native browser features like Object.observe and Promises." -- Richard, the author of Phaser.io
The MIT License (MIT)
Copyright (c) 2014 Sean Bohan
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.