For Each Loop Problem

  • 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

    [attachment=0:15yh2xir][/attachment:15yh2xir]

    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

  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Can the For Each loop considered false if the number of instance specified by the For Each loop is 0?

  • 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.

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