resetting whole game (or just the persist objects)

0 favourites
  • 4 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Hi Guys,

    If my game uses a few objects with the 'persist' behaviour on, is there a way I can easily reset these say on game over? so any that was destroyed will be back to there original place etc.

    Better yet, is there a way to easily reset the whole game (like the reset global variables) but which resets the global variables and persist objects and anything else.

    either would be great if anybody knows, I can probably figure out but didnt know if there was an easy way

    Thanks,

    Alan

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hmmm...I would think the persist behavior would have a 'clear data' action, but it doesn't. 'Reset All'...that would be an interesting addition. Two work arounds:

    Lame idea: Browser -- Reset Page. Not the most elegant solution, but...

    Good Idea: Save states: Just save the initial state of your game when it starts, and restore it after game over. That should reset everything. Course, it might lag a little if your game has lots of objects and data.

  • Neller

    what i do, is save the game at the start, and so when you want to reset the game (lest say the player goes back to the menu) you just load the save state you did at the start and the game will load to as in the begining, even if the persistent objects will be reseted.

  • Thanks guys, I tried doing the save game route but for some reason when I loaded my game again it had wierd results (like my player couldnt move).

    In the end I removed the 'persist' behaviour off my objects and just store the states I needed in Arrays, then when I reset the game just cleared the arrays, seems to be doing the job for now anyways.

    Thanks again

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)