How does Every XXX second work

  • I have something like code in attachment.

    I have 3 instances of an object on layout and I want to move (play animation from beginning) particular one in different moment of game.

    After first 15 seconds move instance with ID 1 after 40 move instance with ID 2 and after 70 move instance with ID 3.

    Last condition Animation frame = 0 ensures that animation will be played only once.

    It works first time first object with ID 1 is played after 15 second second after 40 seconds and third after 70.

    But when I go to other layout and then return all events Every 15 second, Every 40 second and Every 70 second are fired at the beginning. What is wrong ?

  • I'm not sure on that, but probably the timer is still running when you change layouts and once you go back the event is waiting there ready to trigger.

    You could use the timer behaviour to do this, start the timer 'on start of layout', then on timer finished event do whatever you need to do.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • THX, it works with timer behavior.

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