How do I Save only ONE layout.

Get help using Construct 2

Post » Sun Mar 22, 2015 11:18 am

Hey guys, ima newbie here and i had a small question.

Im working on a small scale program, scattered across 4 layouts. (I may henceforth refer to them as "windows")

There is a sidebar that allows switching between these windows.

Now, i added the persist behaviour to stop a layout from resetting when i switched to another layout.

To elaborate, consider i pressed a button on layout 1, and this button spawned an object.
Not i switch to layout 2 using the sidebar i created. Then again, i switch back to layout 1. However, the object that i spawned earlier is now gone.

To fix this, i added the "persist" behavior to the object.

Now here arises the problem.
What i want to do is, when a specific button is clicked, the layout be saved to some slot, lets call it "save1".

Step1 : Easily done, right? However, there is one more thing i want to do.
Step2 : Lets say "layout 2" has 3 objects that were spawned by some means, and these objects have the persist behavior.
Step3 : Then i go to "layout 1" and save the game to a slot "save1".
Step4 : Now, i change a few things in layout 2, say i add an object. Now there are 4 objects with the persist behavior in "layout 2".
Step5 : Now i go back to layout 1 and using a button, i load the game from slot "save1".

It loads successfully, HOWEVER, layout 2 no longer has that other object we added in step 4 is now gone. I.E: the game saved layout2 as well as layout 1 when we saved to slot "save1" in step 3. I want the game to only save the layout1 when i goto save the game in step 3 and leave the rest be.

How can i go about this?
Thanks in advance, and i really appreciate you going through this, i know its an extremely long post, but i wanted to ensure im being clear.

If it is of any consequence, here is my saving system.
Posts: 3
Reputation: 206

Post » Tue Mar 31, 2015 5:30 pm

Make an instance variable for the object called something like CurrentLayout and when the object is created set it's CurrentLayout to the layout name. When you click save, save all the objects, but only if their variable CurrentLayout=LayoutName(system exspression)
Banned User
Posts: 105
Reputation: 1,170

Return to How do I....?

Who is online

Users browsing this forum: adventurist and 4 guests