A* Pathfinding in an isometric world with Flex
I’m having way too much fun with Flex.. It didn’t take me more than a few nights to put together a small test of an isometric world and implement an A* algorithm for pathfinding. It’s not nearly done yet, particularly the motion is bad, but you can check it out here:
http://www.topholt.com/Flex/bin-release/IsoPathfinder.html
Perhaps I could spend some time this holiday season making it into a small game or something. Who knows.
If anyone are interested in the implementation details, let me know. The screen-to-tile-space conversion took me a while to figure out, and A* can be tricky as well.
Edit: I’ve added the ability to fire small pieces of cheese at the cursor, to test collision with walls. Just press ‘A’ and you’ll see it in action!
Edit: View Source is now available.

10.12.2007 at 21:27
Is it possible to view the source? I struggle with picking diamond-shapes using mouse coordinates.
10.12.2007 at 21:34
Sure thing - I just need to clean it up a bit
I’ll post an updated version of the isometric pathfinder demo in a few days with View Source enabled!
11.12.2007 at 16:41
Hey ! I’m also interested in the source code. Nice work anyway !
You will see parts of your algorithm in my next game for sure !
12.12.2007 at 13:37
Did you have the time to clean your source code ?

12.12.2007 at 14:08
Yup, finally did - at least some of it. More refactoring to do, but this should give you guys a fair chance of copy&pasting for your own projects. Let me know if anything is unclear
12.12.2007 at 15:23
Dang! I just noticed that View Source craps up the ‘ characters all over the place - probably a beta 2 bug. At the bottom left of the View Source window you can download the source as a zip file. Do that instead, the chars are fine there.
15.12.2007 at 19:07
[...] A* Pathfinding in an Isometric World with Flex [...]
28.12.2007 at 22:10
This is is pretty cool!!!
I used the source and reworked it into a maven2 build if you wish to see, I can give it to you in any form.
I only had problem with the KeyCodec (Flex2 could not find the import) to capture the key ‘A’ but I just replaced the line with
// Fire cheese when the user presses ‘A’.
if (event.keyCode == 65)
{
Are you planing to tweak this more?
I would be open to contribute my changes…
08.01.2008 at 16:32
Aron, thanks for the comment! I’d sure like to see your build, although I have no experience with Maven. But then again, this would be a great time to learn
I’m not currently continuing development on the pathfinding, but may do so at a later time for a game I’m considering doing. If/when I do that, I’ll post the code.
One thing that you should be sure to try out is giving certain areas/tiles higher or lower movement costs; For instance, walking through tall grass is slower than walking on a road, but not impossible! This is extremely easy to implement with A* (just change movement costs), and the result looks and feels quite impressive!
24.01.2008 at 19:05
Hi,
My prblem is:
///—
1 error found
F:\Pathfiles\IsoPathfinder.as:206
ERROR : Llamada a un método stop posiblemente no definido mediante una referencia con tipo estático mx.effects:Move.
205 // Stop the effect.
206 Move(event.target).stop();
207 }
///—
help plis, thanks for answers!
24.01.2008 at 20:21
Hi Danger,
My Spanish is … well, non-existant, but I think it may have to do with the version of Flex you are using. I built this using Flex 3 beta 3. Did you do that as well?
24.01.2008 at 20:27
Hi Claus…
thanks for you answer…
My English is poor… jejeje, Im use flex builder 2… Be with flex 3?
pd: I found an excellent example in flex…
24.01.2008 at 22:38
Hi Claus,
Unistall flex builder 2, and install FB 3 beta 3… nice! thanks…
26.01.2008 at 12:52
Hi Claus,
where can I view or download the source code?
Maybe I am getting old, but I didn’t find the link
26.01.2008 at 13:01
I started to create a simcity like game in Flash but having difficulties to convert it into Flex.
I hope that your example helps me to do that.
26.01.2008 at 15:21
SORRY I found it!
29.01.2008 at 20:48
Hmm - I think about it and write something more later - Hi…
30.01.2008 at 09:13
Pete, if you need the source code, right-click and “View Source” (you already figured this out) - and THEN click on “Download Source ZIP” in the lower left corner, which gives you the entire source correctly. Flex 3 beta 3 still has issues with View Source and the ‘ character.
Mielno, looking forward to any comments
11.03.2008 at 22:57
The Resources are missing. It doesn´t matter for the images, but the xml was nice to have …
06.04.2008 at 21:45
Hey Claus,
Very nice work indeed - the code will assist me well in the iso- tile based game im building….
Can you by any chance add the resources \ xml file , or explain how to implement it?
Thanks!
Zacks
07.04.2008 at 12:50
It took me a little while to dig out the old source code and remove unnecessary parts (such as the xml files in Resources, which was a work-in-progress). But now it’s done, so go ahead and grab the source!
07.04.2008 at 15:20
Hey Claus,
Awesome job!
Thanks for the well working demo , it will help me alot , im sure
Zack
17.07.2008 at 23:45
SOG knives…
Interesting ideas… I wonder how the Hollywood media would portray this?…