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

9 years ago by razare2016

In my main game I have:
ig.MyGame = ig.Game.extend({ .... // and so on

This works:
ig.Game.loadLevel(LevelDung1);

This does not work:
ig.MyGame.loadLevel(LevelDung1);

The reason I try to use the 2nd one, is that the first one I do not trust. I think I'm doing it wrong because it seems to me this is creating a brand new game object? Wouldn't I want to reference the original game object?

But how would I do that deep down inside of a code which does not include the game.main asset, because that would be circular?

9 years ago by razare2016

Like if I wanted to spawn entities, but those entities have a reference to the game object?

I guess I can pass them an initialization parameter, but is there an easier way?

9 years ago by Joncom

When you start your game (by calling ig.main inside "main.js"), the engine automatically creates a game instance at ig.game. Note the lowercase "g".

Therefore, load your level like this: ig.game.loadLevel(LevelExample)
Page 1 of 1
« first « previous next › last »