How do I use for each x element

0 favourites
  • 5 posts
From the Asset Store
🙌 Element Magic Hit Sound Pack comes with 805 high-quality sound effect
  • You've been a great help so far with my efforts so I hoped someone could answer my next question:

    When running through an array with For Each X Element, does loop index not work?

    Cheers

  • If you've tried it and it doesn't then I guess it doesn't Would it be meaningful if you had say, a 3D array?

    edit: sorry you've specifically said for X elements. I guess that could make sense. But a quick test shows it doesn't work. I normally use normal for loops and Array.at() anyway. Maybe it's the old school developer in me It's just more flexible IMO

  • Yeah, I can't get it to work.

    As I understand it there's also a slightly hidden command: loopindex("name of loop") but that doesn't work either.

    I tried: loopindex("x")

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You'll have to use the built in expression "CurX" if using the built in "For Each X Element"

  • I normally use normal for loops and Array.at() anyway. Maybe it's the old school developer in me It's just more flexible IMO

    Not only is it more flexible, it is the only way to iterate through an array and keep the "stop loop" functionnality ! I never liked Array's built-in loops...

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