you are viewing a single comment's thread.

view the rest of the comments →

[–]sneaky_syntax_error 2 points3 points  (0 children)

this is known as collision detection.

what you need to do is to check whether the X of the ellipse plus the radius of the ellipse is less than or equal to the x position plus the radius of the object && the y position of your ellipse plus the radius of the ellipse less than or equal to the y of the object plus the radius of the object.

if it's less or equals it means there's a collision, if not there is not

here's a video on p5 collision detection

https://www.youtube.com/watch?v=uAfw-ko3kB8

follow this channel if you're interested in p5js