Hello i want to calculate the distance between the centre of Pac-Man and the centre of the treat and If this distance is less than the radius of Pac-Man, we will consider Pac-Man to have “eaten” the treat. When Pac-Man has “eaten” the treat, make the treat reappear in a new random location
This Abe Pazos tutorial may be of help. There is a built-in distance function in processing – dist() – that I think will make your task easier.
Do not get distracted by the use of noise() in the tutorial, just focus on the implementation of dist().
Since you don’t show setup() or draw() in your code, I’m not sure what your overall thought process is… but provided you’ve worked that all out…