This is supposed to become a community contribution, esp. aimed at the beginners as it is very easy to use: Simply set up WED paths and #include "pathfinding.c" and you are ready to go, there is no manual path calculation or entity setup necessary, everything is handled automatically. There are a few functions, but you can keep it simple and only use
If you want to move ent to vtarget, you can call this function in a while loop and it will calculate the position where ent has to move to to reach vtarget. Example:
Code:
action enemy()
{
while(1)
{
ent_path_get_target(my,player.x,temp);
turn and move to temp!
wait(1);
}
}
The code tries to keep the calculations to a minimum (it remembers old positions, start- and target-nodes and checks if a new path is necessary), but if you know the start- and target-node, you can use other faster functions. I plan to release this when jcl fixes a path_next bug.
"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual