rocinantealpha

reference / collision

touching

Whether two shapes touch, edges included: touching ball paddle.

ball = { pos: { 200, 150 }, radius: 40 }wall = { pos: { 220, 60 }, size: { 140, 30 } }if touching ball wall [ fill tomato ] else [ fill teal ]circle at ball.pos radius ball.radiusrect at wall.pos size wall.size fill 120
what it draws: the whole window, 400 by 300
What the example of touching draws

How to write it

touching a b

Gives true or false.

Related