Jump to content

saving state of current state?


defic
 Share

Recommended Posts

Okay this might be a ridiculous question, but is it possible to save the state of the current state, so I could easily continue where I left off.

 

Let me explain a bit more. At the moment I have a level editor (made with phaser) in my game and it outputs json so I can easily save the levels to external file. But when I test the level by playing it, I cannot go back to the editor (unless I do a json parsing module for the editor, which would require too much work for atm). So can I save the state using phaser libraries or plain javascript?

 

Edit: Maybe one way to do it: never leave the level editor and just launch a new window with the new level? And I would like to add that the level editor is just for developing the game, so no worries about users and "bad performance" :)

 

 

Edit2: okay got it working like described above. It ain't pretty but it is working. Funny how I was banging my head a while trying to figure this out and as soon as I write the question here I start progressing :D.

 

Here is how I did it:

//at editorlevelinfo = this.json;var w = window.open("url to my game");//after loading my game in new windowif(window.opener != null){             if(window.opener.levelinfo != null){                  var json = window.opener.levelinfo;                   this.state.start('Level', true, false, json, null);               }}else{        this.state.start('LevelMenu');}
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...