Repopulate An Array

Get help using Construct 2

Post » Tue Feb 18, 2014 6:11 pm

I have an array that is loaded, on layout start, from an event sheet. The array data sheet is included in the other event sheets. As the game progresses, rows are deleted. When a game session is ended the player has the option to restart the game. The problem is, the array does not reload the data. How can I repopulate the array?
B
16
S
6
Posts: 33
Reputation: 1,620

Post » Tue Feb 18, 2014 6:14 pm

You can either :
- trigger again the event in the loading event sheet (function may help)
- save the state of your array at the start of the level (after loading of course) as JSON in a variable, and load from JSON using that same variable's content at the restart of the game.
B
17
S
8
G
4
Posts: 461
Reputation: 6,157

Post » Tue Feb 18, 2014 6:32 pm

I figure out a way to do it with save states. How is that different from JSON? Would using a function be a better way to do it (assuming I can get it to work)?
B
16
S
6
Posts: 33
Reputation: 1,620

Post » Tue Feb 18, 2014 6:35 pm

Save states will also restore everything else, so it seems the best way to restart the game.
Using JSON directly was specific to the array here to help save it, but it is the same method used by save states. So you're good :)
B
17
S
8
G
4
Posts: 461
Reputation: 6,157

Post » Tue Feb 18, 2014 6:37 pm

Thanks for the help, good sir! :D
B
16
S
6
Posts: 33
Reputation: 1,620


Return to How do I....?

Who is online

Users browsing this forum: Google [Bot], jorgmaquoi, Rable, TELLES0808 and 2 guests