Liranan Posted November 6, 2014 Share Posted November 6, 2014 Hello everyone! I'm a starter on Phaser, I did some small examples and now I'm working on a bigger game. My code is growing and growing and it has become difficult to read. I use 5 js files: load, boot, menu, game and main. Main is where I write most of the code. I was wondering if it's possible to create other files and attach them to the main state somehow. For example, write all the level creation code in one file and call it from the main.js file... Like an include on php. I guess my question it's dumb for some of you, hehe, what can I say... I'm new! Thank you very much. Liranan. Link to comment Share on other sites More sharing options...
lewster32 Posted November 6, 2014 Share Posted November 6, 2014 Most of the larger projects I've seen and worked on myself use a class-like structure, so every 'class' has its own file, and then the whole lot is concatenated with a build tool such as Grunt. This is how Phaser itself is built, so it's worth looking at the source to see how Phaser is structured. Link to comment Share on other sites More sharing options...
Liranan Posted November 6, 2014 Author Share Posted November 6, 2014 Thank you lewster32, I guess I have to learn how to create classes soon or later, and this is a good moment. I found this tutorial:http://toastedware.com/?p=258 In case someone have the same problem than I lewster32 1 Link to comment Share on other sites More sharing options...
Recommended Posts