Help with "Every X seconds" between layouts.

Get help using Construct 2

Post » Fri Nov 30, 2012 2:31 am

Hello Everyone,

I need your help to resolve this problem.

I have two layouts: Layout1 and Layout2 .

In the Layout1 you can select missions, meanwhile in Layout2 you play.
The problem I have is the following:

In the Layout2 I have Every 5 seconds an enemy appears.
But, if you stay in the Layout1 without select any mission and the 5 seconds already passed when you enter to layout2 the enemy is there...

The 5 seconds pass meanwhile you are in the Layout1.

How can I do that the "Every 5 seconds" only works when you are in the Layout2 ?

Thanks in advance and best regards.

Image
Image
B
26
S
2
G
1
Posts: 71
Reputation: 2,662

Post » Fri Nov 30, 2012 4:04 am

Have a variable that is set to 1 only when the player is on that layout. So you would make an event that changes it to 1 on start of layout, then give the spawning event another condition that tells it the variable needs to equal 1
B
40
S
12
G
7
Posts: 603
Reputation: 7,656

Post » Fri Nov 30, 2012 2:05 pm

Hello EncryptedCow,

I tried with the global variable with different value in the layouts and doesn't work.

Layout1
On Start of layout set variable=1
if (variable=1)   every X seconds
Layout2
On Start of layout   set variable=2
if (variable=2) every x seconds

I also tried comparing variable, values (layoutName), and other conditions such as layout end loading...

But, nothing works, the "every x seconds" just ignore those ones.

It seems that from the start of the game without matters what layout is, the "every X seconds" is always running.

Any idea?

Image
Image
B
26
S
2
G
1
Posts: 71
Reputation: 2,662

Post » Sat Dec 01, 2012 5:25 pm

Hi,

I Tried a couple other things such as setting group and...
didn't work....


Anyone else was dealing with this issue before?
Image
Image
B
26
S
2
G
1
Posts: 71
Reputation: 2,662

Post » Sun Dec 02, 2012 1:44 am

Are both layouts using the same event sheet? If so, consider creating one event sheet for each layout. Then it can't add to the variable unless it's on layout2.
B
27
S
8
G
5
Posts: 429
Reputation: 6,902

Post » Wed Jan 30, 2013 4:57 pm

I have the same problem in spawning enemies, but in my case I cant put in differents style sheets, because happens when I restart level.
Shouldnt restart layout or on layout start, restart the time in the level?
B
5
Posts: 1
Reputation: 529

Post » Thu Jan 31, 2013 11:18 pm

Hello Julian,

What I found is when you use the Every X seconds, does not work with the create object or spawn action.

Instead I created a variable that every X seconds add one.
I mean,
Variable time= 0
Every X seconds - > Add 1 to Time.

Then If I want to create an enemy every 5 seconds for example.
If time = 5 create object (or spawn).

And this works perfect.

Best Regards
Image
Image
B
26
S
2
G
1
Posts: 71
Reputation: 2,662


Return to How do I....?

Who is online

Users browsing this forum: DemantDigitalArt, Lancifer, Yahoo [Bot] and 25 guests