Jump to content

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.

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.

Link to post
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 post
Share on other sites
  • 1 month later...
  • 4 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...