p5.collide2D
https://github.com/bmoren/p5.collide2D#collidelinecircle
p5.collide 2D library contains functions that detect collision between 2 2D geometry, including points, circles, rectangles, lines, polygons, triangles, and arc. All functions returns a boolean value: when two shapes collide, it return true, while two don’t collide, it return false. And it also contain a function called collideDebug(). Once two geometries collide, this function draw an ellipse at the collision point when applicable and calculable.
Example: https://bmoren.github.io/p5.collide2D/examples/swords/index.html
This is a sword game. So when one player is attacked by another’s sword, it will turn to red for 100 ms, meaning that the player gets hurt.