For Each....

  • Is this a bug in R74 or am I just to dumb to understand the concept of "For Each"?!

    <img src="http://quak.laurig.de/ForEach.PNG" border="0" />

    I have 17 instances of "InventorySlot" - but this loop keeps counting till hell freezes over?!

    Where do I fail?!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This event probably runs every tick, meaning that every tick it will add (the) 17 instances to count.

    You probably need to add more conditions to limit its execution, or pay more attention to where it is placed (for example, as subevent of a start of layout event, it will only run once on the very beginning of the layout.)

    Be sure to read over and over again how events work.

    When in doubt, look at your code and try to "translate" it the way C2 will read it.

    Event 4, every tick it will loop through each instances of InventorySlot and add 1 to the variable count.

  • Thanks!!! <img src="smileys/smiley20.gif" border="0" align="middle" /> <img src="smileys/smiley20.gif" border="0" align="middle" /> <img src="smileys/smiley20.gif" border="0" align="middle" /> <img src="smileys/smiley20.gif" border="0" align="middle" />

    Even thou I placed it "stand alone" you were right with the "every tick" assumption.

    I now placed as sub-event under "Layout start" and it worked!

    Cheers

    Matt

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