1 decade ago by begeeben
Normally main.js structured this way:
When I need more than one ig.game instance in main.js, the file becomes huge and hard to maintain. For example if I have several mini games in main.js each extended from ig.game then they will make main.js really big. Is there a good way to separate these game instance to some external file or plugin?
ig.module( 'game.main' ) .requires( 'impact.game' ) .defines(function(){ MyGame = ig.Game.extend({ init: function() { }, update: function() { // Update all entities and BackgroundMaps this.parent(); }, draw: function() { // Draw all entities and backgroundMaps this.parent(); } }); // Start the Game with 60fps, a resolution of 320x240, scaled // up by a factor of 2 ig.main( '#canvas', MyGame, 60, 320, 240, 2 ); });
When I need more than one ig.game instance in main.js, the file becomes huge and hard to maintain. For example if I have several mini games in main.js each extended from ig.game then they will make main.js really big. Is there a good way to separate these game instance to some external file or plugin?