I've been trying to use
this answer to check if a point is inside the circle but it doesn't seem to be working correctly. Here's my equation:
var r = Math.pow((conn.snake.body.x - 0), 2) + Math.pow((conn.snake.body.y - 0), 2);
. It seems to work fine but when I check if it's less than
Radius^2
, I always get true. Strangely, when I try to output Radius^2 inside the console, I always get 2, even when I add text before/after it.