How do I compare the values in two arrays?

Just started using Construct 2? Post your questions here

Post » Tue May 26, 2015 1:42 am

In my game, I have two arrays of equal length and I want to compare the values of one array with the values of the other. If I was writing this in Javascript, I would use a for loop and check to see if firstArray[i] == secondArray[i] but I'm not sure how to reference the index in a for loop in Construct 2. I have tried using i but it doesn't seem to work.
B
5
S
1
Posts: 1
Reputation: 462

Post » Tue May 26, 2015 4:34 am

Use the loopindex(name) expression to get the current index of loop name. Look for this expression on the system expression manual page for more information.
Moderator
B
113
S
41
G
20
Posts: 1,586
Reputation: 19,106


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 5 guests