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 Joncom

The following works just fine.

.requires(
    'impact.game',
    'impact.font',
    // Load certain mobule if on mobile.
    ( ig.ua.mobile ? 'game.mobile-module' : 'impact.game' ),
    ....

However, when baking the game I get the error:
ERROR: Couldn't load lib/(!ig/ua/mobile?game/mobile........etc.

Is there a way to prevent the requires process from loading something based on a variable like ig.ua.mobile and be able to still bake it?

Editted for clarity.

1 decade ago by fulvio

In your main.js, outside of the game.main module:

if (ig.ua.mobile) {
    ig.module('game.dummy-mobile-module')
        .requires('game.mobile-module')
        .defines(function(){});
} else {
    ig.module('game.dummy-module')
        .requires('impact.game')
        .defines(function(){});
}

ig.module('game.main')
...

This will define an empty dummy mobile module when running on mobile and the default impact module if not.

It's quite the hack, but it seems to work fine. Baking might chuck a hissy-fit though.

1 decade ago by Joncom

Works wonderfully, and bakes no problem!

Thank you fulvio.
Page 1 of 1
« first « previous next › last »