mandag 16. november 2009

AI

creating the AI i started whit getting the creatures to folow the charecter. The problem i got whit it were that i used the code from the school exaple, where they used this.xxxxxxx to point on the last creature created. that were a problem for me because i had a lot of creatures, and they needed to get new directions later. so i created one folow code for each type of creature, i loop trough all the creatures in the array and set a new path for each frame.

the next problem i encounterd were, that the math i was thinking of dident work to get the disdance. but the code i used to find the unit sircle were actualy the distance from point x to point y. whitch is what i needed to use to get the creature to folow the charecter when it came innside a set distance.

after i got that working, then i created the portal and got the creatures to folow it if the charecter is outside its range.

Ingen kommentarer:

Legg inn en kommentar