For Each Loop Problem

Bugs will be moved here once resolved.

Post » Wed Dec 31, 2014 10:02 pm

Problem Description
Trigger Once While True and Every X Seconds conditions only apply to one of the loop. Else event runs even the For Each loop is running.

Attach a Capx
For Loop Bug.capx


Description of Capx
There are 4 yellow boxes,2 green boxes and 2 brown boxes. Each yellow boxes should fire only once when overlaping with green boxes. Each yellow boxes also should fire every 1 second when overlaping with brown boxes. There is a timer to indicate whether the Else event is running.

Steps to Reproduce Bug
  • Problem 1:Use trigger once or every X seconds under loop condition.
  • Problem 2:Use Else event after Looping event

Observed Result
Only one of the boxes which are overlaping green boxes apply the trigger once while true. Only one of the yellow boxes which are overlaping brown boxes fires. The timer keeps running.
(Occasionally, the first yellow box will stop firing. To make it fires, try refresh the browser)

Expected Result
Trigger Once and Every X seconds should apply to each loop. All yellow boxes which overlap green boxes should do the same. Same goes to brown boxes. The timer should not run because the For Each loop event is running.

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

Operating System and Service Pack
Windows 7

Construct 2 Version ID
r192
You do not have the required permissions to view the files attached to this post.
B
17
S
4
G
1
Posts: 203
Reputation: 1,583

Post » Mon Jan 05, 2015 6:23 pm

Closing as won't fix: neither 'trigger once' nor 'every X seconds' make much sense in a loop - you probably instead want to move them up the subevent tree so they are above the loops. Similarly I don't know what you expect 'else' to do after a loop event, since loops don't have a clear definition for whether they are true or false.
Scirra Founder
B
387
S
230
G
87
Posts: 24,249
Reputation: 192,240

Post » Mon Jan 05, 2015 6:56 pm

Can the For Each loop considered false if the number of instance specified by the For Each loop is 0?
B
17
S
4
G
1
Posts: 203
Reputation: 1,583

Post » Mon Jan 05, 2015 7:03 pm

I'd prefer to leave it as "undefined" - I mean, what if it only runs once but none of the events are true, isn't that a similar case? I think you can argue it either way, so I'd prefer that nobody relies on this to do anything in particular.
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 4 guests