View Full Version : [AS3] Character movement along path

05-10-2010, 07:04 PM
Hi. I need to make adventure game like Monkey Island. My character should walk along predefined path and he is controlled by mouse clicks. Is it possible to do it using motion guide? I searched for some tutorials, but most of them are written in as2. Thanks for any help.

05-10-2010, 09:04 PM
i havent tried this, but i think it should provide what you want.

05-10-2010, 09:46 PM
This helped a lot. Thanks for your post. If my character walks always on the same path is this the easiest way to animate him? He walks directly to mouse coordinates. I'm sure u know how it worked in old, classic adventure games :)
I'm asking because I'm not very advanced AS programmer.

05-11-2010, 08:55 AM
Well it depends which form you're talking about. If you want something like the Longest Journey, where when you click in a valid spot on a map the character walks directly there then you'd just set your player MC to a walking animation, set rotation, and have them walk directly there.

Unless of course, there are objects in the way that could block a certain straight path, then you might have to use some basic form of A* pathfinding. That gets a little trickier. How that would work, is you divide your game map up into a grid. Each coordinate in the grid can either be walked on, or not walked on. Then when you click on the map, the algorithm would detect what coordinate your player is on, what coordinate you clicked on, and the fastest way there. This is same kind of pathfinding used in some TD games.