How do you reset the layout?

New releases and general discussions.

Post » Sat Oct 03, 2009 10:17 am

Hey there,

For an experiment, I'm trying to make a Mario game. However, when I got to the dying mechanism, I tried to make the layout restart/reset. Apparently that isn't possible, so I decided to create a different layout it would jump to, after which it would jump to the next layout.

However, the layout is not reset. Isn't there any way to reset the layout? :| So strange.
B
2
S
1
G
5
Posts: 40
Reputation: 1,480

Post » Sat Oct 03, 2009 10:49 am

Create System > Go to layout action and type LayoutNumber as a parameter for a layout number to go to. This should restart the current layout.

Yes, "restart layout" action would be great. How come it's not implemented yet?
B
160
S
75
G
28
Posts: 55
Reputation: 22,568

Post » Sat Oct 03, 2009 11:07 am

[quote="Przemek32767":2cq56bnr]Create System > Go to layout action and type LayoutNumber as a parameter for a layout number to go to. This should restart the current layout.

Yes, "restart layout" action would be great. How come it's not implemented yet?[/quote:2cq56bnr]

Not sure. Seems like a really obvious feature to me ;o

I actually tried that, but that didn't completely reset the layout :o
For example, it left the scrolling untouched instead of it resetting to the upperleft part of the layout.

Also, it didn't reset the included event sheets. For example, when the character dies, I disable the control event group. When I "reset" (read: go to) this layout again, the platform behaviour does work, but the tweaked control events I made don't because the event group is still disabled. Even though I set it to be enabled on the start of the layout (or rather, I set it to not be disabled).

Very strange.

EDIT: Of course these things are easily fixed by making some events that enable the groups and scroll to the right position, but that's not the point.
B
2
S
1
G
5
Posts: 40
Reputation: 1,480

Post » Tue Oct 06, 2009 8:58 am

It's because everything is "global" in Construct. I think the thing to do is just have a Start of Layout where you set everything the way you want it for now. Maybe you used MMF before, which doesn't remember things as often. The Event Sheets act independently of the layouts, I'm pretty sure.

A nice feature would be "reset values" for sprites, at least, so you could group together a bunch of sprites in a family and then "Start of Layout --> Reset Values" and it would set all the values to their initial ones.
B
5
S
2
G
3
Posts: 234
Reputation: 1,818

Post » Tue Oct 06, 2009 3:38 pm

[quote="konjak":3g9pciob]It's because everything is "global" in Construct. I think the thing to do is just have a Start of Layout where you set everything the way you want it for now. Maybe you used MMF before, which doesn't remember things as often. The Event Sheets act independently of the layouts, I'm pretty sure.

A nice feature would be "reset values" for sprites, at least, so you could group together a bunch of sprites in a family and then "Start of Layout --> Reset Values" and it would set all the values to their initial ones.[/quote:3g9pciob]

Exactly. It'd be cool if we'd have a nice little spreadsheet for all our global and private variables and being able to group variables together, so we could just "Start of Layout --> Reset 'Extra Attrs' Group'

So, say, all the buffs and stuff would be gone if you'd start on a new layout without having to manually set everything back to a certain value.
B
6
S
2
G
3
Posts: 520
Reputation: 2,690

Post » Tue Oct 06, 2009 3:44 pm

you can just destroy the character and make a new instance of the character object and all the variables will be at their default values.

to reset global variables you can load all the values into a hash table using a loop and when you reset just load in the hash table values back into the global variables.

Though it would be nice to have an action to reset global variables.
B
5
S
2
G
4
Posts: 632
Reputation: 2,829

Post » Tue Oct 06, 2009 8:41 pm

I just saved the layout at start of frame (after some generic set-up stuff), then reload the frame. This seems to function perfectly as a reset.
B
2
S
2
G
4
Posts: 124
Reputation: 1,698

Post » Wed Oct 07, 2009 3:42 pm

Not just values, but event group status as well. I guess the whole global thing is quite interesting, but it requires a different way of thinking the events out. Unlike in MMF :P
I just thought that, since the player event sheet is included in the layout, it would include it with the way I set it up in the event editor. And I thought, in combination with going to a layout it would basically reset everything, because everything would be included again.

It's rather confusing though. I'm used to everything restarting like in MMF. From a different perspective it makes sense to me though. It reminds me of the time when I was experimenting with game development with C++, having to set the variables and all myself, of course programming a reset function for that.

I was actually thinking of that save/load function yesterday. Might try that out, it should work fine, I think :D
B
2
S
1
G
5
Posts: 40
Reputation: 1,480

Post » Wed Feb 08, 2012 10:30 pm

would you mind doing a step by step on how you did the reset using "save"?
B
6
S
2
G
4
Posts: 12
Reputation: 2,810


Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 2 guests