Jump to content

Game Structure - How to organize a Phaser Project


alessandronunes
 Share

Recommended Posts

Hello,

I started a hobby project to learn Phaser (https://github.com/alessandronunes/soccerpunch). It's lika a Clash Royale Soccer, with punchs (not implemented yet).

The code is growing and I need to split the game logic in more than one file. I have knowledge of some Javascript frameworks, like Sencha and JQuery Mobile, and I'm familiar to the MVC concept.

I'll probably try to create files for every game object (Player.js, Goal.js, Ball.js, etc.).

So I would like to ask: how do you organize your code files? Please send examples! 

Link to comment
Share on other sites

For me, I'm used to working with larger files 2000 lines or less(not really all that large, but to some it is) so I like to organized my code in about 3 - 4 files depending on the project. Usually states, sprites, managers and windows (if required) if I have specific mechanics I like to make a plugin which can be used in more than one game so ill do that and keep the logic separate from the game. The managers file can usually used in more than one game as well, as its basically just functions with asset urls and global functions. Other than that it's really all personal taste and how you like working, unless of course your working with a team. So really however you feel comtorable is how you should do it. 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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