"Every x seconds" runs, when it shouldn't

Get help using Construct 2

Post » Tue Aug 11, 2015 11:32 am

Hi folks!

I'm about to copy an existing app for educational reasons (I'm a teacher...), but I'm stuck with something... and I'm about to give up... after hours of thinking...

The problem:
I've got 2 layouts, one is the "Start"-Layout, whose only purpose is to forward to the 2nd layout "Level 1".
Now, if one presses the space-bar, the 2nd layout appears and the game starts... everything okay then, right?

No! For some reason, I clearly don't understand, the "every tick"-condition, that is written into the 2nd event-sheet, runs all the time - even, if the 2nd layout is not active...

Don't believe me? Just do the following...

1. Preview the project
2. Don't wait, press the space-bar
3. You should see 5 rows moving downwards...
4. Restart the preview
5. Wait 2-3 seconds (or so...)
6. You should see, that, depending on how long you've waited, the padding between the 5th and 6th row changes...

WHY? Well... the first 5 rows are system-created on "start of layout"... while every subsequent row is created on "every 3 seconds"... But why is the "every 3 seconds" running, while the concerned layout is inactive?

I hope, one can see, what I'm trying to say here... if not... there's a capx-file with the whole code... I realized, that I can't reproduce the problem... so I'm posting the whole project (but it's a very little project, so... :-))

The capx-file: http://gertschp.myhostpoint.ch/EveryTickProblem.capx

There's even a small clip: http://gertschp.myhostpoint.ch/EveryTic ... _klein.mov

Thx for your help!
Last edited by philipgertsch on Tue Aug 11, 2015 12:15 pm, edited 1 time in total.
Posts: 17
Reputation: 370

Post » Tue Aug 11, 2015 11:53 am

Every x seconds is counted from the start of the game, not the start of the layout..

To do something in timed intervals you might want to try the timer behaviour..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
Posts: 6,160
Reputation: 19,775

Post » Tue Aug 11, 2015 12:25 pm

Thanks very much! This was new to me...

Now it works, I placed a sprite with "Timer"-behavior somewhere beside the layout and made it run "on start of layout". It now triggers every 3 seconds.

Thank you sir :-) - and, have a nice day!
Posts: 17
Reputation: 370

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 1 guest