Game Development Reference
In-Depth Information
How it works...
The AI begins in an idle state. As long as it has some items in the targetableObjects
list, it will run the sense method on each update. If it sees anything, it will switch to the
Follow state and stay there until it loses track of the target.
The sense method consists of a for loop that sends rays in an arc representing a field of
view. Each ray is limited by sightRange and the loop will exit if a ray has collided with
anything from the targetableObjects list.
Search WWH ::




Custom Search