< index < 13. Path finding < 13.1 Creating a path |
===================================== | > 13.3 Reading path information |
C++ : bool TCODPath::compute(int ox, int oy, int dx, int dy) C : bool TCOD_path_compute(TCOD_path_t path, int ox,int oy, int dx, int dy) Py : path_compute(path, ox, oy, dx, dy)
Parameter | Description |
---|---|
path | In the C version, the path handler returned by a creation function. |
ox,oy | Coordinates of the origin of the path. |
dx,dy | Coordinates of the destination of the path. |
C++ : TCODMap *myMap = new TCODMap(50,50); TCODPath *path = new TCODPath(myMap); // allocate the path path->compute(5,5,25,25); // calculate path from 5,5 to 25,25 C : TCOD_map_t my_map=TCOD_map_new(50,50); TCOD_path_t path = TCOD_path_new_using_map(my_map); TCOD_path_compute(path,5,5,25,25); Py : my_map=libtcod.map_new(50,50) path = libtcod.path_new_using_map(my_map) libtcod.path_compute(path,5,5,25,25)