API Reference › Collision › Collision.rect_circle
method

Collision.rect_circle

Collision.rect_circle(rx, ry, rw, rh, cx, cy, cr) -> bool

Returns true when the rectangle (rx, ry, rw, rh) overlaps the circle centred at (cx, cy) with radius cr. It finds the point on the rectangle nearest the circle's centre and checks whether it falls within the radius — the correct test for a round actor against a blocky tile.

Example

program Demo {
  handler Step phase Update {
    if Collision.rect_circle(tx, ty, 16, 16, bx, by, 6) { block() }
  }
}
← All symbols