Last active
December 14, 2015 20:38
-
-
Save unstoppablecarl/5144969 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MyGame = new ig.Game.extend({ | |
levelToLoad: level1, | |
// levelName ex: test3 | |
changeLevel: function(levelName){ | |
// prepend and capitalize | |
var levelObjName = 'Level' + levelName.charAt(0).toUpperCase() + levelName.slice(1), | |
levelPath = 'game.levels.' + levelName; | |
delete ig.modules['dom.ready']; // reset dom event handler | |
delete ig.modules['dummy.loader']; | |
// tell impact to load the level module | |
ig | |
.module('dummy.loader') | |
.requires(levelPath) | |
.defines(function(){ | |
MyGame.prototype.levelToLoad = ig.global[levelObjName]; | |
ig.system.setGame(MyGame); | |
}); | |
// force the module load | |
ig._execModules(); | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment