Walking the path.

BlitzMax Forums/BlitzMax Programming/Walking the path.

Twinprogrammer(Posted 2013) [#1]
Hey guys,

I've been working on an a* pathfinding algorithm. It can find a path, but I just have one problem... walking the path! Can anyone give me a good example on how to walk the path?

EDIT: By walking the path, I mean having a sprite run across the path.


jkrankie(Posted 2013) [#2]
Depends what data your path holds. If it's the usual sort of thing, where you've grid nodes in order, you can effectively traverse them like a linked list.

Cheers
Charlie


Twinprogrammer(Posted 2013) [#3]
How do I move to them? Is it just something like this:

if playerx > node.x playerx:- 1
'repeat for the other moves...



*(Posted 2013) [#4]
Why not just have the character move from one node to the next


Twinprogrammer(Posted 2013) [#5]
Oh, that's what I did, but it didn't work. But now looking at it, I found an error! Thanks guys for your help!


jkrankie(Posted 2013) [#6]
why not post your code so we can see how you're doing it. A* can be implemented in a lot of different ways.

Cheers
Charlie