Double function trigger bug.

Bugs will be moved here once resolved.

Post » Wed Apr 27, 2016 11:01 pm

Problem Description
If a function is called twice in the exact same time (by two Timers for instance), it is executed only once. The second trigger is ignored.
Expected behaviour would be to queue it somehow and execute function twice since it can behave differently based on parameters etc.
NOTE: Timers are queued if they trigger at the same time, therefore I assume that not queuing functions is not intended behaviour but a bug.

Attach a Capx
https://drive.google.com/file/d/0BwT_0l ... sp=sharing

Description of Capx
On start of layout it creates two instances of "Sprite" object which has a Timer behaviour.
Starts Timer for each sprite (both exactly on 2 seconds, once).
On Timer: triggeres a function.
Function simply changes the frame of the sprite.

Steps to Reproduce Bug
  • Just run the project and wait 2 seconds.

Observed Result
Only one sprite instance has frame changed.

Expected Result
Both instances should have frame changed.

Affected Browsers
  • Chrome: (YES)
  • FireFox: (YES)
  • Internet Explorer: (YES)

Operating System and Service Pack
Windows 10 Pro x64

Construct 2 Version ID
v. 227
ImageImage
B
27
S
16
G
68
Posts: 934
Reputation: 38,572

Post » Wed Apr 27, 2016 11:22 pm

It's the Timer that gets the queue. Add "For each Sprite", and you'll see the timer gets sent two Sprites at the same time.
ImageImageImage
B
71
S
21
G
220
Posts: 3,648
Reputation: 123,725

Post » Wed Apr 27, 2016 11:43 pm

I know that Timer is queued - it is good. That's how it should be. But the function which is called by two different timers at the same time, is triggered only once - this is not good. Should be triggered twice.
ImageImage
B
27
S
16
G
68
Posts: 934
Reputation: 38,572

Post » Thu Apr 28, 2016 12:06 am

ImageImageImage
B
71
S
21
G
220
Posts: 3,648
Reputation: 123,725

Post » Thu Apr 28, 2016 12:35 am

Ah that's what you mean. So it triggers with SOL. I was sure it triggers each instance separately.

Thanks a lot @blackhornet!
ImageImage
B
27
S
16
G
68
Posts: 934
Reputation: 38,572

Post » Thu Apr 28, 2016 10:31 am

Closing as not a bug. This does come up from time to time, but the "On timer" condition can have more than one instance picked at a time if multiple timers fire at the same time. Adding "for each" to the condition fixes it.
Scirra Founder
B
387
S
230
G
87
Posts: 24,249
Reputation: 192,240


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 7 guests