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

7 years ago by fugufish

Any way of selectively loading modules at the start?

eg: I want to load only the module below, if i'm on mobile. If not, i'll load another module


ig.module('game.entities.entity-player-mobile')
.requires(
	'impact.entity'
)
.defines(function() {
	EntityPlayerMobile= ig.Entity.extend({

    });
});



the reason is because we can't afford pre-loading all modules for all versions , especially if the game is huge.

7 years ago by StuartTresadern

I assume this is more to do with assets rather than the modules ? if so you could create a custom loader to load resources based on device.
http://impactjs.com/documentation/class-reference/loader

Another Option is to detect the device and load different Versions of the game. I was sure Dominic had a PHP example of this but I can't find it at the Moment (if i do I will upadte the thread).

7 years ago by vincentpiel

it would seem more easy to handle the entities you want to spawn before the game starts, and then spawn the right one :

var EntityPlayer = ig.ua.mobile ? EntityPlayerMobile : EntityPlayerBrowser;
var EntityBadGuy = ig.ua.mobile ? EntityBadGuyMobile : EntityBadGuyBrowser;
...
and then use within a game : this.spawnEntity(EntityPlayer, ..., ... ) ;
Page 1 of 1
« first « previous next › last »