API Reference › Collision › Collision.rects
method

Collision.rects

Collision.rects(ax, ay, aw, ah, bx, by, bw, bh) -> bool

Returns true when the axis-aligned rectangles (ax, ay, aw, ah) and (bx, by, bw, bh) overlap. Edges that merely touch do not count as overlapping. This is the standard broad-phase test for two hitboxes, tiles, or UI regions.

Example

program Demo {
  handler Step phase Update {
    if Collision.rects(px, py, 16, 16, ex, ey, 16, 16) { hit() }
  }
}
← All symbols