Jump to content

basic enemy ai pathfinder / chase system


erich
 Share

Recommended Posts

Hi

If anyone is interested I created a basic enemy path chase system. It may be of use to someone else trying to make one themselves or to create a better version of it.

The basics of the sytem are quite simple (mainly 2 functions)

- I created a map array and a group of enemies
- In the update function I use the chaseMe() function for the enemies to use their "line of sight" to start the chase if the player isclose to the x and y on the stage
- If the player escapes, there is a short timer that will move the enemy (moveMonster() function) in a random direction where it may "see" you again and start the chase again

It is pretty basic - the demo is below, use cursor keys to move the player

http://html5gamer.mobi/projects/6/

You can view the source code in the browser (ctrl + u) or download the full demo in the zip file attached

Eric

map.jpg

6.zip

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...