alessandronunes Posted August 31, 2016 Share Posted August 31, 2016 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 More sharing options...
LTNGames Posted August 31, 2016 Share Posted August 31, 2016 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. alessandronunes 1 Link to comment Share on other sites More sharing options...
samme Posted August 31, 2016 Share Posted August 31, 2016 alessandronunes 1 Link to comment Share on other sites More sharing options...
alessandronunes Posted September 2, 2016 Author Share Posted September 2, 2016 Thanks @LTNGames and @samme. I'll try to split the file this way. Link to comment Share on other sites More sharing options...
Recommended Posts