codevinsky Posted March 26, 2014 Share Posted March 26, 2014 I spent the day creating a generator for phaser projects. Install the generator:$ npm install -g yo generator-phaser-officialCreate a project directory$ mkdir phaser-bird && cd $_Run the generator$ yo phaser-officialAnswer 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 codeAll 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. jerome, P.Uri.Tanner and drhayes 3 Link to comment Share on other sites More sharing options...
Zaidar Posted March 26, 2014 Share Posted March 26, 2014 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. Link to comment Share on other sites More sharing options...
Zaidar Posted March 26, 2014 Share Posted March 26, 2014 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 More sharing options...
codevinsky Posted March 26, 2014 Author Share Posted March 26, 2014 That's what I get for not unlinking my local npm module. It's fixed. You'll need to run:$ npm update -g generator-phaser-officialThat's my bad. Link to comment Share on other sites More sharing options...
Zaidar Posted March 26, 2014 Share Posted March 26, 2014 It seems to work perfectly now, thank you. Link to comment Share on other sites More sharing options...
codevinsky Posted April 4, 2014 Author Share Posted April 4, 2014 I updated the generator to default to 2.0.2 and to use Browserify for dependency injection. Link to comment Share on other sites More sharing options...
adamyall Posted April 4, 2014 Share Posted April 4, 2014 Any plans to incorporate TypeScript? Link to comment Share on other sites More sharing options...
codevinsky Posted April 4, 2014 Author Share Posted April 4, 2014 I'll work on learning typescript this week, and then incorporating it into the generator. Nepoxx and adamyall 2 Link to comment Share on other sites More sharing options...
jyapayne Posted April 5, 2014 Share Posted April 5, 2014 Awesome! I was looking for a nice little generator. I'll check this out for my next project. Nice work codevinsky (I like saying your username in the voice of Dracula) Link to comment Share on other sites More sharing options...
Mike Posted May 22, 2014 Share Posted May 22, 2014 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.jsUncaught 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 More sharing options...
frank84 Posted July 19, 2014 Share Posted July 19, 2014 I'm just starting looking into Phasing and that is exactly what I was looking for, thank a lot! Link to comment Share on other sites More sharing options...
Nepoxx Posted December 2, 2014 Share Posted December 2, 2014 I'll work on learning typescript this week, and then incorporating it into the generator.Any update on this? I'd definitely be interested Link to comment Share on other sites More sharing options...
Recommended Posts