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

0 favourites
  • 3 posts
  • 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... <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":-)" title="Smile">)

    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!

    Cheers,

    Philip

  • 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..

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)