How do I loop through an array and stop looping if a value compared of a cell is equal?
if cell in x is equal to `foo`
Here is what I have got so far.
Hi guys, I have uploaded a CAPX with what I am trying to do. I am wondering if there is something case in construct where you can exit out of a loop when a condition is met. Ultimately I want a Plants vs Zombies tower selection mode.
[quote:1j91tc3q]Loops can be stopped with the Stop Loop system action.
Not only in a array loop but any loop you can set a value in a variable ON/OFF where you just get inside of a loop when it's value is "1" and then reset (inside the loop in a sub event if necessary) to 0, then the loop won't run again.
Develop games in your browser. Powerful, performant & highly capable.
Thanks for the responses Blackhornet and kossglobal!! much appreciated attacking this problem now.
Thanks again for the help guys.
I am having trouble populating array 1 with the contents of array 2. I am not sure what I am doing incorrectly. Could you peek into my capx? It sounds simple enough but it functions not.
You've got a bunch of stuff disabled. Can you get it back to a usable state so I'm not guessing what should or shouldn't be enabled.
Sorry about that black hornet. I have a new capx up there now. I fiddled around and have it populating array1 with the contents of array 2 but it populates all cells. I just want it to stop once it fills an empty slot.
I was fiddling some more and I think I fixed it!!! hurray doing some more testing to see if I can break it. Its all in the aove capx link