Confused with every X seconds

0 favourites
  • 5 posts
From the Asset Store
Like tourists, Travel around the world as fast as you can!
  • Hi, I am confused with the operation of every X seconds.

    I create an object every 5 seconds but if you reset the layout to the third second (for example), then the object is now created after two seconds.

    That is, the time has not been restarted!.

    Is there any way to reset the time used in every X seconds when a layout restarts?

    https://dl.dropboxusercontent.com/u/60803633/test18.capx

    Here you can see a picture of what I mean.

    If you restart the layout in the second number 4, then after rebooting, after 1 second the object was created but I am using every 5 secs!.

  • This is documented in the manual. If you want accurate timing, use 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
  • I did not see anything about this here:

    Every X seconds

    Run the event regularly at a given time interval in seconds. This can also be used beneath other conditions to only run the event at a given time interval while the other conditions are true, e.g. "Player is holding spacebar AND every 0.5 seconds: fire laser".

    I assume you mean the downloadable manual

  • It's in there somewhere. Every X seconds is based on the time the app starts, not when the layout starts.

  • To make a timer that restarts every time the layout starts could be done many ways. Probably an easy pseudo example would be something like;

    --------------------------------------------

    Start of layout -> Set Global variable (timer) = 0

    Every 1.0 seconds -> Add 1 to Global variable (timer)

    If global variable (timer) = 5 -> do something

    --------------------------------------------

    Making a repeatable action would be a little trickier, but using a variable as the timer itself could work for sure.

    *EDIT*

    Just looked more closely at your event sheet there, and you're doing exactly this method already but maybe forgetting to set your variable on startup to 0. Global variables will always remember where they're at unless the program starts from the beginning again. You just need a reset on the variable you're already using when the layout starts up.

    ~Sol

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