Jump to content
  • Advertisement
Sign in to follow this  

[AS2 Flash] Enemy-AI movement and collision

This topic is 3120 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hello all i am trying to create a simple game in flash 8... I have created a player,enemy and walls... i have implemented a very very basic chasing algo to the enemy... Now whenever there are obstacles the NPC gets stuck in them. I want to make my enemy movement more intelligent and i want to improve my enemy's collisions.. Can any1 point me on how to make the enemy more intelligent in his movement.. I refered some of the AI books but i cud not understand them as some of the books calculated pixel values .. Could any1 explain in terms of AS2.. Help wud be grateful... well this is the code for NPC's movement and for collisions
function follow(){
	while (_root.wall_mc.hitTest(ai._x, ai._y+22, true)) {
	while (_root.wall_mc.hitTest(ai._x, ai._y-12, true)) {
	while (_root.wall_mc.hitTest(ai._x-3, ai._y, true)) {
	while (_root.wall_mc.hitTest(ai._x+44, ai._y, true)) {
// The wall is typically like a maze eg: like in pac-man but i am not using tiles

I know this is very basic but i cud not find any tutorials that teaches avoiding obstacles for the NPC in flash.. Is there any way i can attach my file coz i cud not find an option???

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!