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 John

Is there any way to dynamically unload a resource e.g. image / level after it's been loaded?

1 decade ago by Joncom

Should work for images...

// If you were to load an image like this...

// Load an image
var img = new ig.Image( 'player.png' );

// Then you'd want to unset the variable
// something like this...
img = null;

// Also, the image will be in 
// ig.resources (an array).
// You'll want to splice it out.

// Also, the ig.Image object
// is being held in 
// ig.Image.cache (an object).
// You'll want to delete it from
// there too.

1 decade ago by John

Okay, so say I use the method below


delete backgroundMap.tiles;
delete ig.Image.cache['media/foo.png'];
delete LevelFooResources[0];


Will I be able to load the level again with no problems, or will I have to load the resources again? And if so, how would I go about doing that?
Page 1 of 1
« first « previous next › last »