|
im confused. I kow how a while loop works and what it does but im stumped on this line while(true)... while what is true??? i dont get it. here is the code that is in question copied from the fps tutorial ai sript. so what is going on here can someone please explain.
(comments are locked)
|
|
It means 'do this loop forever' which, unless there were yields there (or early returns), would hang a program. In this case, it means this script will execute those commands until the game stops or the object it's on is destroyed or disabled. so once you yield the method would need to be called again through and update() or ect.
Mar 24 '12 at 09:27 PM
nemisis83
You should use 'add new comment' rather than Answer. I assume you're asking me. No, the framework takes care of it. Yield basically says 'go off and do other things, like process events and play sounds or whatever, but come back to this point in this method and continue from there'
Mar 24 '12 at 09:29 PM
DaveA
(comments are locked)
|
|
A while loop continues to loop as long as the condition is true. Since true is always true, while (true) is an infinite loop.
(comments are locked)
|
