ArcBasicDocs
2DPathfindingArcBasic extension

CreatePathGrid

Creates a grid for finding paths.

CreatePathGrid ( width,height )

Parameters

width
how many cells across, from 1 to 4096. Cells are numbered from 0 to width - 1.
height
how many cells down, from 1 to 4096. Cells are numbered from 0 to height - 1.

Description

Creates a grid for finding paths through and gives back its handle. Every cell starts open, costing 1 to cross. Mark the walls with PathGridBlock, then ask for a way from one cell to another with FindGridPath. A grid usually mirrors a game's own map, cell for cell:

Example

CreatePathGrid.abs
Dim map(19, 14)grid = CreatePathGrid(20, 15)For y = 0 To 14    For x = 0 To 19        If map(x, y) = 1 Then PathGridBlock grid, x, y    NextNext

See also