If you want the red balls to move towards the triangle and stop when they hit it, two easy ways are to use processing’s dist() function or make an AABB (axis aligned bounding box) class, give one to all objects, and use it to check collisions.
1 Like