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 Steve

Does anyone have a suggestion on how to manage going from one level to another? I have some simple "if your at this pixel location then loadlevel(x), but see the need for a better way of managing this. I also am having trouble identifying which level I am in. I can't figure out the handle to the Map object. How are others doing this?

1 decade ago by jminor

You should probably make a trigger entity similar to the one at the end of this document: http://impactjs.com/documentation/weltmeister

When the player touches that entity then the check function is called and you can load a the new level.

If you make the level name a parameter of the entity then you can even fill it in when editing the map in Weltmeister. That lets you place multiple exits anywhere you want in any level in your game.

1 decade ago by NeilHighley

Extend Main to include a currentLevel parameter, by adding it to the comma seperated list in the extended object.
e.g.

currentLevel:1,
currentLevelName:'FirstLevel',

Then when you start a level, update the parameters using ig.game.currentLevel.

Alternatively, create a gamestate module, which can hold all the flags, level parameters and player stats while the game is running, then attach it to ig in the init function.

1 decade ago by dominic

Quote from jminor
When the player touches that entity then the check function is called and you can load a the new level.


Biolab Disaster does this with a generic Trigger entity and a separate Levelchange entity that loads the new level when triggered. I just uploaded a package with some of Biolab Disaster's entities – see the blog post.
Page 1 of 1
« first « previous next › last »