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

6 years ago by afflicto

in my main.js I load levels via JSON. ( I set the wm config to save as JSON instead of module)

Now, if I have the level data parsed as JSON.
I need something like ig.game.parseLevel(levelData);

Is there such a function?
I need to save the levels as JSON because I'm using it on the server-side (I'm making a multiplayer game, yes)

thanks in advance.

6 years ago by dominic

ig.game.loadLevel() accepts a js object. To parse a JSON string, use the native JSON API:
var levelObject = JSON.parse( jsonString );
this.loadLevel( levelObject );

The usual module wrapper around levels just ensures that the files can be loaded and are ready before the game starts. The object you pass to loadLevel() is always a plain js object, not a module.

6 years ago by afflicto

Alright, thanks :)

6 years ago by icydee

I would be interested in talking to you about how you are doing your multi-player game, I have been investigating impactjs for this too.

icydee
Page 1 of 1
« first « previous next › last »