API Reference › IVec2 › IVec2.manhattan
method

IVec2.manhattan

IVec2.manhattan(a, b) -> int

Returns the Manhattan (taxicab) distance |dx| + |dy| between two cells — the number of orthogonal steps between them, the natural distance metric on a 4-connected grid.

Example

program Demo {
  handler Step phase Update {
    let steps = IVec2.manhattan(pos, goal)
  }
}
← All symbols