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 yatayata

how are people jumping between levels?

I have some random ways of moving between levels so have defined some portal type entity to load a new level. using weltmeister i can pass in a property like targetLevel="someLevelName".
however this means i need to refer to the levels as strings.

so i need to do
loadLevel("intro");

however, impact is expecting an Object, ie LevelIntro

loadLevel(LevelIntro);

this object is created by weltmeister, eg a level file contains

LevelIntro=/*JSON[*/{"entities":[{"

so how can i random access and jump around levels?
one thought is to hack weltmeister to also add a levelName property and build a list of these as the game initializes... but this seems a bit messy (then will be harder to upgrade WM etc...)

so i guess what i really need is to convert the variable name to a string, to which there are some hacky methods... looking through global objects... eg

window["LevelIntro"] == LevelIntro


any clean suggestions appreciated!

1 decade ago by delly

i believe this works:

ig.game.loadLevel( ig.global['LevelIntro'] );
Page 1 of 1
« first « previous next › last »