Looping Array Index

This forum is currently in read-only mode.
From the Asset Store
For Adventure, Action, Heroes, Sci-fi and Action-RPG games.
  • Hi, I am looping through an array, and checking each position in the array to see if it equal to 1. If it isn't, I set it equal to one. If it is, I move on to the next position and check again. If I'm looking at an index that is higher than the length of my array, I start over from index 1.

    The problem is, after I loop back to the first index of the array, I can never increment the index again.

    Here is a cap to demonstrate the problem

    Am I doing something stupid with the loop? Thanks for any assistance!

  • the 'compare value at x' condition of the array does not evaluate correctly if x is 1; that's a bug. i've added it to the tracker.

    you could work around this by using the 'compare' condition of the system object.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • the 'compare value at x' condition of the array does not evaluate correctly if x is 1; that's a bug. i've added it to the tracker.

    you could work around this by using the 'compare' condition of the system object.

    Thank you, that works perfectly!

    I'm glad to see it wasn't just me being stupid.

  • It's fixed in the next build, but there's an infinite loop in your .cap when they're all set to 1 .

  • It's fixed in the next build, but there's an infinite loop in your .cap when they're all set to 1 .

    Yes, thank you. This was just a sample cap to demonstrate the problem I was having.

    Great news on the bug fix!

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