I've been having trouble with for loops.
I've created a simple for loop that decides how far my units move
for (int i = 0; i < moveSpeed; i++) {
//moves unit
if (i == moveSpeed) {
path = null;
}
}
My problem is that the path is not cleared. And I'm too dumb to figure it out.
Is there any way to tell if the loop has ended and act on that information?
↧