Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by KenD

What's the best way to defer loading of sounds for entities used on later levels? I've got ~14MB of sounds and I'd rather not load them all up front. In the docs, it mentions
All sound and image files that your game needs should be loaded by the preloader, so that they are actually available when needed.

Calling the .draw() method on an image that has not yet been loaded, will do nothing. Attempting to play a sound file that has not been loaded, will result in a severe lag.


I have my entities split up according to which level they&039;re on, so if I create the necessary sounds in the entity's #init() method, will that start loading the sounds as soon as the game starts, or will they not begin loading until the level loads, since they're not referenced anywhere outside the level?

1 decade ago by jizaymes

I'm not entirely sure but maybe you'll be better off using different 'games' to isolate this behavior and then when changing 'levels', you really spawn a new game that will preload at that time. You'd use the ig.system.setGame() method to do this, http://impactjs.com/documentation/class-reference/system#setgame
Page 1 of 1
« first « previous next › last »