以前用过的。map数据的格式根据你的需要改一下。
太长了,只能分开发
/*********************** Part 1 *****************************/
/**
* AStar pathfinding algorithm
*/
public class AStar {
private Square[][] squares;
public static final byte WALL = 0x1, BLANK = 0x0;
public static final byte WALL_MASK = (byte) 0xf;
public static final byte OPEN_MASK = (byte) 0x80;
public static final byte CLOSED_MASK = (byte) 0x40;
private byte[][] map;
private Square lStart;
private Square lEnd;
private static final byte ORTHOGONAL_COST = 1;
byte height;
byte width;
//Binary Heap
public Square[] heapTree;
public int heapSize;