O'Reilly logo

XNA 4.0 Game Development by Example Beginner's Guide by Kurt Jaegers

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Path finding

To resolve this problem, we need to implement a path-finding system that will allow us to easily determine the shortest route between any two squares on the tile map. The path needs to take walls into account, and needs to be fast enough that several enemy tanks can run the check without bogging down the game because in addition to verifying the placement of game objects, the same code will be used to allow enemy robots to move towards the player and attempt to destroy him.

The A* path-finding algorithm

The method we will implement for Robot Rampage is called A* (pronounced "A Star"). This path-finding system is fairly straightforward and relatively fast, as it uses an educated guess system to try out potential paths between two points. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required