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 Ant101

Is there any recommended way to add custom tasks to the preloader?

I've got a few functions that I would like to run before the game starts. I guess one way to do this would be to execute them before the initial ig.main() call, but from a visual perspective I would like these to run while the loader bar is displayed.

1 decade ago by Graphikos

Extending or injecting your own things into the loader should be possible. Something like:

MyLoader = ig.Loader.extend({

    load: function() {
        
    	// call your own functions here

    	this.parent();
    }
});

ig.main('#canvas', MyGame, 60, 320, 240, 2, MyLoader);

If you want to tweak the visuals to add a few more steps in the progress bar or something you'll need to do a bit more extending.

1 decade ago by Arantor

Bear in mind that in the progress bar you do not have access to any assets (images, sounds, fonts) so anything you do must use base canvas methods.

1 decade ago by Graphikos

If you want to see a more advanced extending of the loader you can look at the pre-loader for Biolab on github.

1 decade ago by Ant101

Thanks for the suggestions guys.
Page 1 of 1
« first « previous next › last »