How do I reload last layout

Get help using Construct 2

Post » Wed Apr 15, 2015 8:42 pm

Hello,

Does anyone have some tips for me on how to reopen last layout ... how to go back and forth amongst layouts without of need to do entire reloading and executing of layouts allover again?

thanx!!!
B
28
S
11
G
2
Posts: 688
Reputation: 5,126

Post » Thu Apr 16, 2015 6:17 am

bump!
B
28
S
11
G
2
Posts: 688
Reputation: 5,126

Post » Thu Apr 16, 2015 10:01 am

I'm not sure what you mean, but wouldn't creating a global variable and setting it to the name of the layout before changing layouts work?

so

on button pushed
- system set variable Lastlayout = layoutname
- goto layout - (whatever layout you'd like to go to)

on button "back to last layout"
- goto layout - LastLayout
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Apr 16, 2015 1:58 pm

Hello, LittleStain.

It's not problem to go to the certain layout... it's problem to not need to reexecute entire layout but to open it as it was on the moment i closed it and switched to other one.
So that it preserves all executed states.

BR
B
28
S
11
G
2
Posts: 688
Reputation: 5,126

Post » Thu Apr 16, 2015 2:02 pm

You might want to look into the persist behaviour..

https://www.scirra.com/manual/161/persist
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Apr 16, 2015 2:06 pm

well i did add that behaviour to desired objects but it shows no effect... :(
B
28
S
11
G
2
Posts: 688
Reputation: 5,126

Post » Thu Apr 16, 2015 2:16 pm

Without seeing your capx I can't be sure of why it doesn't work.
The persist behaviour should make sure the objects remember their previous state.
I'll try one guess, but am convinced it won't be right..
Could it be you are resetting the objects through events or creating new ones with the original stats?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Apr 16, 2015 2:48 pm

You need, when quitting the layout, to somehow keep in memory the state/position and any relevant informations for the objects in the current layout.
And you need, on start of layout to check if this is the first execution of the layout or if the layout has already been executed, in which case you do apply the saved informations to the current "scene".

The persist behavior can indeed help with that, be sure to consult its manual article to know exactly how to apply it.
Otherwise, to manually save data, you can use data structures like arrays to keep in memory the several informations.

To know what informations to save, this completely depends on your project and what you are trying to achieve, which is, as LittleStain explain, unknown to us because of a lack of capx or even clear/detailed explanations.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
293
S
117
G
96
Posts: 7,310
Reputation: 71,069


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 5 guests