Jump to content

generator-phaser-official: Yeoman Generator for Phaser projects


codevinsky
 Share

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.

Link to comment
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.

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...

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
Link to comment
Share on other sites

  • 1 month later...
  • 4 months later...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...