Skip to content

rect_overlaps

Test whether two rectangles overlap. Touching edges do not overlap.

Parameters

  • x1 — First left.
  • y1 — First top.
  • w1 — First width.
  • h1 — First height.
  • x2 — Second left.
  • y2 — Second top.
  • w2 — Second width.
  • h2 — Second height.
if rect_overlaps(10, 10, 16, 16, 20, 20, 8, 8) then
print("hit")
end

Related: rect_contains, mv.collision.overlap.

See the collision guide for more examples and limits.