Circle Collision Javascript
问题 Hello I need to make for school a program in Javascript that says if circles had an collision. It doesn't need to be shown graphical. I gave it a try but my code doesn't seem to work. Hope you could help me out with a script. Here's my code what I produced. function collision (p1x, p1y, r1, p2x, p2y, r2) { var a; var x; var y; a = r1 + r2; x = p1x - p2x; y = p1y - p2y; if (a > (x*x) + (y*y)) { return true; } else { return false; } } var collision = collision(5, 500, 10, 1000, 1500, 1500);