API Reference › Collision › Collision.point_rect
method

Collision.point_rect

Collision.point_rect(px, py, rx, ry, rw, rh) -> bool

Returns true when the point (px, py) lies within the rectangle (rx, ry, rw, rh) — inclusive on the top-left edge, exclusive on the bottom-right. Use it for mouse or touch hit-testing against a button or a world region.

Example

program Demo {
  handler Step phase Update {
    if Collision.point_rect(mx, my, bx, by, bw, bh) { press() }
  }
}
← All symbols