FlashPunk Tutorial 05: A* Pathfinding for NPCs

Posted by dolgion on Thursday Sep 30, 2010 Under Flashpunk

What’s up? The Pathfinding tutorial is! After a bunch of stuff keeping me from finishing it, I’ve finally made it. As announced in the previous post, the code is onGitHub from now on. You can get the entire source code in a nice zip or tar archive over here. I’ve tried to make the code as easy to understand as possible, because I simply don’t have the time nor nerve to explain every single line there is. Instead, I’ll focus on explaining the logic of the code as easily to understand as possible, and only refer to actual code when it’s really important. You are really going to need to get the code, Alt+Tab between this tutorial and the code I’m referring to pretty much all the time. The screenshots of code I’m showing here are only telling you part of the story. Apart from the pathfinding code, there are several other bigger changes made to the code ever since tutorial number 4. Major additions are:

  • NPCs and their pathfinding code
  • A clock that continuously ticks and a display for the time
  • A text area that displays the current location of the player
  • Map data, player data and NPC data is loaded from xml in contrast to hardcoded data

You can try the SWF directly here. Read More

Share
Tags : , , , , , , , , | add comments