How do I get this simple timer test to work?

0 favourites
  • 6 posts
From the Asset Store
_______ Huge collection of metal fixtures ________
  • I have a Sprite object type with a Timer behavior.

    There are three instances of this Sprite on the Layout.

    In the EventSheet on start up I loop through all Sprite objects and for each Sprite I start the timer with the Tag set to an instance variable on each Sprite.

    There is an event listening for the Timer event for each Tag (set with the Instance Variable again) and if you look at the browser console you can see only one of them is fired.

    Here is a capx (http://sdrv.ms/1bsA3LH)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • try changing the start timer to 3 different values

    (eg

    start timer sprite.TimerName (random(5)) (once)

    )

    and see if you get an output more like you are expecting ?

  • Why did that work?

    Is it just not possible to have sprites sharing the same timer interval?

  • ok change it back to just 1.

    add a sub event under your on timer sprite.timername

    and check each sprite that has fired its timer

    sprite   -   on timer sprite.timername

    (sub event)

       for each sprite      -    send info to console

                                 ( log in console : etc)

  • Thanks much.

    I think they are packing all events for each sprite together into a single event since they are of the same type and are occurring at the same time.

  • You need to reverse RomPackWobbles events:

    For each Sprite

       On Timer...

    The issue is that your original On Timer has all Sprites picked at the same time, so the event only gets triggered once. The for-loop checks each individually. The down side is that the for-loop will run constantly, forever.

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