1 decade ago by Nanolucas
Hey guys,
What I want is to be able to load a particular level inside main.js without it being part of the requires().
I'm using node.js and socket.io to connect users and load data into main.js, but until they've successfully connected, I won't know which level I'll be loading. If I have 20 different levels then it seems impractical to require them all into main.js if I'm only going to end up using one of them.
So please tell me, how can I do something like:
I've been searching for a while but couldn't find a solution to this, any help would be most appreciated.
What I want is to be able to load a particular level inside main.js without it being part of the requires().
I'm using node.js and socket.io to connect users and load data into main.js, but until they've successfully connected, I won't know which level I'll be loading. If I have 20 different levels then it seems impractical to require them all into main.js if I'm only going to end up using one of them.
So please tell me, how can I do something like:
ig.require('game.levels.arena1'); ig.game.loadLevel(ig.global['LevelArena1']);
I've been searching for a while but couldn't find a solution to this, any help would be most appreciated.