Jump to content

How do you organise your projects?


adamkdean
 Share

Recommended Posts

Hi all,

 

Seasoned developer here. I'm looking at using Phaser as an easy way to visualise some simulations.

 

In the docs, the author hints at a better way of organising your code: "The final parameter is an object containing four references to Phasers essential functions. Their use is thoroughly explained here. Note that this object isn't required - Phaser supports a full State system allowing you to break your code into much cleaner single objects. But for a simple Getting Started guide such as this we'll use this approach as it allows for faster prototyping."

 

Does anyone have an example of this? 

 

Thanks!

 

Adam

Link to comment
Share on other sites

There's an example in the repo in the resources folder (Project Templates) showing how to use States instead of global functions. Hopefully that will get you going. For a complete in-depth guide on how States work it's part of issue 1 of Interphase (disclosure: commercial book, not free)

Link to comment
Share on other sites

There's an example in the repo in the resources folder (Project Templates) showing how to use States instead of global functions. Hopefully that will get you going. For a complete in-depth guide on how States work it's part of issue 1 of Interphase (disclosure: commercial book, not free)

 

Thanks Rich. 

 

Do you have a link to the book? (I'm guessing it's not going to be revealed to me in a Star Trek novel!)

 

Regards,

 

Adam

Link to comment
Share on other sites

I regularly utilize require.js to help organize my codebases. I'm not sure if it fits your organizational desires but you can check out this repo for an example of how I usually go about it in tandem with Phaser if you want. Every state, sprite, component, etc. has its own file. Require.js essentially treats the folder structures as namespaces that you gain access to via definitions in the beginning of each file.

Link to comment
Share on other sites

  • 3 months later...

I regularly utilize require.js to help organize my codebases. I'm not sure if it fits your organizational desires but you can check out this repo for an example of how I usually go about it in tandem with Phaser if you want. Every state, sprite, component, etc. has its own file. Require.js essentially treats the folder structures as namespaces that you gain access to via definitions in the beginning of each file.

 

This is a great example, very clean.  Thanks for sharing.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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