How do I get layout switching to act as expected.

Get help using Construct 2

Post » Thu Aug 14, 2014 4:48 am

When I test a layout by itself, everything in the layout seems to work as expected, but when I test the whole project, layouts seem to do strange things.

Is there a reason layouts behave differently when testing the whole project and moving and transitioning through the different layouts, as opposed to testing just the layout on its own?
B
10
S
2
Posts: 37
Reputation: 688

Post » Fri Aug 15, 2014 2:16 pm

To really understand what is going, we would need to know what "strange things" are happening. However, here are a couple things to look for.

Are you using global variables that get modified in a previous event? Global variables persist between layouts.

Are some of your events in the layouts referencing ticks passed? If they are, many ticks have already passed in the system by the time the layout starts. This could cause items in the layout to be in a different state than you expect them to be in.

I have found it is always good to have an on start of layout event to set everything to the beginning state for that layout. Simply added this type of event may fix the problem for you.

I hope that gets you what you need and, good luck with your project.
B
39
S
12
G
11
Posts: 331
Reputation: 7,727

Post » Fri Aug 15, 2014 5:08 pm

Oh I see. Yes. I'm using things, like... Spawn object every X seconds

and sometimes you'll go to level 2... and the spawns will happen too early

I'll try adding the "on start of layout" event to these parts

thank you :)
B
10
S
2
Posts: 37
Reputation: 688

Post » Fri Aug 15, 2014 6:25 pm

For the every x seconds, you should add a variable to the layout storing the start time of the layout and do every x seconds after the stored time, not the game time.
B
39
S
12
G
11
Posts: 331
Reputation: 7,727

Post » Fri Aug 15, 2014 7:44 pm

ok

yeah... I was realizing you can't combine "at start of layout" and "every x seconds"

thanks again
I'll try that then
B
10
S
2
Posts: 37
Reputation: 688

Post » Fri Aug 15, 2014 8:20 pm

I thought setting a condition like...
only do the spawn actions when the object is not on the screen would be a clever way of simplifying this...
but it doesn't seem to work... things still spawn as the layout starts when using every x seconds... even with this condition applied

the problem I was trying to avoid was enemies spawning right next to the player as soon as the layout starts
B
10
S
2
Posts: 37
Reputation: 688


Return to How do I....?

Who is online

Users browsing this forum: Fradno, marcinkowski, tarek2 and 10 guests