How "for each" works ?

0 favourites
  • 3 posts
  • I have the following example and I have a question:

    Why does the condition is not meet ?

    This is a simple example that is not working in my game.In some situations the "for each" condition works as I expected...but not in the above example

    capx

    <img src="https://dl.dropbox.com/u/139926126/Forums/squares_01.PNG" border="0">

    The result:

    <img src="https://dl.dropbox.com/u/139926126/Forums/squares_02.PNG" border="0">

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • <center><img src="https://dl.dropbox.com/u/36472942/construct/forumhelp/NoneedForEach.PNG" border="0"></center>

    It's picking.

    You don't need a for each there, and the most important is to be sure to select the correct object in the condition.

    Example that goes further.

  • Kyatric I know I don't need "for each" in this example, I just didn't understood how is working. I thought the loop works like this:

    • select first RED square
    • check if GREEN square overlapps the selected RED square
    • select second RED square...and so on

    but I guess the correct behaviour is like this:

    • select first RED square
    • check if RED square overlapps the selected GREEN square
    • select second RED square...and so on

    Is that true?

    In that case...i need to take a cold shower and reprogram my little brain synapses.

    Thanks

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