Jump to content

how to set up a Phaser project? [first project]


super001
 Share

Recommended Posts

hi,

  I just started using Phaser. it's awesome, really easy to learn and use.

 I was wondering how to set up a project. I know there are many ways: the easy one is to have a index.html file, a .js file and the phaser.min.js. I'm currently making a game but the .js file has reached 300 lines of code, that is not a good thing as it could be a bit counfusing, expecially for someone who wants to contribute. so my question is how can I set up a Phaser projects making it easy understandable?

 

P.S. I need i detailed guide/explanation if possible

 

thanks a lot.

Link to comment
Share on other sites

There're some nicely laid out templates here: https://github.com/photonstorm/phaser/tree/master/resources/Project%20Templates

 

Splitting your JavaScript up into separate files can be as simple as doing just that; copying and pasting the bits into different files, then just adding more script tags to your html file. Later on you may want to concatenate them and minify into a single file and at that point you should probably start looking at build tools like Grunt or Gulp, though they're not for absolute beginners. If you do work these tool out though, they make the whole process much nicer; you can have them watch your files for changes, and when you alter any of your separate files, they can check for errors, combine, minify and even do stuff like generate documentation - and much more.

 

It's the tip of a pretty big iceberg and I don't think any one tutorial or guide could (or should) cover it all, and each person will find their own way and their own preferences for coding style, tools and so on. It's a lot of fun and very rewarding to learn though, so good luck, get your hands dirty and by all means ask questions here if you get truly stuck :)

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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