resetting whole game (or just the persist objects)

Get help using Construct 2

Post » Wed Nov 12, 2014 11:21 pm

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
B
11
S
2
G
1
Posts: 68
Reputation: 777

Post » Wed Nov 12, 2014 11:54 pm

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.
Don't lose your work. Backup your game with Dropbox.
B
44
S
10
G
10
Posts: 1,106
Reputation: 9,202

Post » Thu Nov 13, 2014 3:05 am

@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.
B
23
S
6
G
3
Posts: 316
Reputation: 3,461

Post » Fri Nov 14, 2014 9:06 am

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
B
11
S
2
G
1
Posts: 68
Reputation: 777


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 11 guests