How do I change layout without resetting the last one?

Get help using Construct 2

Post » Mon Jul 20, 2015 4:41 pm

Trying to set up a shop in the game, or a room inside a building. How do i go on about it to keep the main layout level still running as it is when i enter another layout? For now it seems that it just resets the game.

https : // dl.dropboxusercontent.com/u/73502848/house.capx (remove the spaces)
B
7
S
1
Posts: 93
Reputation: 632

Post » Mon Jul 20, 2015 7:13 pm

Well, you can use the Persist behavior to make individual objects remember their state when you return to layout. If it's something more intricate you may have to set up a save system with LocalStorage or something to make it save/load data.
B
50
S
23
G
17
Posts: 291
Reputation: 12,432

Post » Mon Jul 20, 2015 8:13 pm

So the Persist behaviour would be good on a few objects but not the whole level? Lets say my guy has shot a dozen enemies dead on the ground and a handful are still behind a wall or something and lets say another house is in flames, i have to go to the shop to re-arm since im out of firepower. how do i get the level to be in the same state as when i entered the shop after i come out all gun-ho again?
B
7
S
1
Posts: 93
Reputation: 632

Post » Mon Jul 20, 2015 8:57 pm

Persist does in fact remember the attributes of objects like their positions and animations, whether they're destroyed or not, their instance variables, etc.

To use it just add the Persist behavior to any object that you'd like the game to keep track of, so e.g. monsters and powerups would need it, but a static background that never changes would not.
B
50
S
23
G
17
Posts: 291
Reputation: 12,432

Post » Mon Jul 20, 2015 9:30 pm

Sweet, seems to work :) A bit smarter again, thanks!
B
7
S
1
Posts: 93
Reputation: 632


Return to How do I....?

Who is online

Users browsing this forum: justifun, marcinkowski, wizdigitech, Yahoo [Bot] and 10 guests