1 decade ago by TommyBs
Hi,
Are there any level load plugins that let you load a level when required? I'm currently making a game that could have an ever expanding number of levels. I've got a successful AJAX call being made that loads levels when I need them, but the issue is the .requires of those levels. If I try to load the levels on level.onload I get js errors about the entities not being loaded.
If i set a timeout after the level script has loaded, it's fine as the inner "requires" have then completed. The trouble is there could be x amount of requires in a specific level and setting a timeout isn't a reliable way of determining if all the level dependencies have also been loaded. I thought about requiring all the entities in my main.js, so in theory a level shouldn't need to load them, but I'm not sure if this is an optimum solution or if it would even work. I saw another post on here about using jquery.getScript, but I'm pretty sure this would have the same issue.
Anyone managed to get anything like this working?
Thanks
Are there any level load plugins that let you load a level when required? I'm currently making a game that could have an ever expanding number of levels. I've got a successful AJAX call being made that loads levels when I need them, but the issue is the .requires of those levels. If I try to load the levels on level.onload I get js errors about the entities not being loaded.
If i set a timeout after the level script has loaded, it's fine as the inner "requires" have then completed. The trouble is there could be x amount of requires in a specific level and setting a timeout isn't a reliable way of determining if all the level dependencies have also been loaded. I thought about requiring all the entities in my main.js, so in theory a level shouldn't need to load them, but I'm not sure if this is an optimum solution or if it would even work. I saw another post on here about using jquery.getScript, but I'm pretty sure this would have the same issue.
Anyone managed to get anything like this working?
Thanks