codevinsky

generator-phaser-official: Yeoman Generator for Phaser projects

Recommended Posts

I spent the day creating a generator for phaser projects. 

 

Install the generator:

$ npm install -g yo generator-phaser-official

Create a project directory

$ mkdir phaser-bird && cd $_

Run the generator

$ yo phaser-official

Answer the questions at the prompts. The generator will create the scaffolding and install the dependencies. It also has a very simple "hello, world!" game included so that you can see how this workflow operates.

 

Run the server

$ grunt 

This will build and compile the required index and bootstrapper files, start a server, watch files for changes, and reload your browser when you've modified and saved a file.

 

Write your code

All game code will reside in the game directory. You shouldn't need to modify the main.js file, and in fact, you shouldn't. On each build, the main.js file gets overridden with references to your game states.

 

Extras:

 

Generate a new game state

$ yo phaser-official:state "stateName" 

This will create a new stateName.js file in the game/states directory as well as add it to the included scripts and bootstrapper.

 

Generate a new prefab

$ yo phaser-official:prefab "prefabName" 

This will create a new prefabName.js file in the game/prefabs directory as well as ad it to the included scripts.

 

Hope you guys will enjoy it.

Share this post


Link to post
Share on other sites

Sounds interesting ! I surelly will try it some day.

 

I just hope it will be updated, not like the two other phaser generator, which begin to be old and obsolete now.

Share this post


Link to post
Share on other sites

So I've just checked, and after generation, I type grunt, but doesn't work.

 

If I remove the ]); at line 93, the tasks seem to run.

 

Then the server is launched, my browser open but I get a "cannot get /".

 

I didn't touch anything, just remove the line  and type grunt directly after generating.

Share this post


Link to post
Share on other sites

I've tried it just a moment ago... and i wondering why phaser is missing...

 

Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:9000/js/phaser.js
Uncaught ReferenceError: Phaser is not defined game.js:6
 
 
Maybe the generator needs an update... i'll check it in the weekend but still I like the idea of: yo phaser-official downloading latest phaser version and setting up a project

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.