API Reference › Grid › Grid.line_of_sight
method

Grid.line_of_sight

Grid.line_of_sight(x0, y0, x1, y1, wall) -> bool

Whether an unobstructed straight line connects (x0, y0) and (x1, y1) — true when no cell it crosses (endpoints included) is a wall. Use it for visibility, aggro checks, and cover.

Parameters

wallthe impassable tile char

Example

program Demo {
  handler H phase Update {
    if Grid.line_of_sight(1, 1, 8, 1, '#') { print(1) }
  }
}
← All symbols