+ 2

How would i find collision between circles?

In my newest code I made two balls bounce around the canvas while displaying their x and y value on the screen along with their x and y velocity values. I cannot figure out how to see if they collided or not. I established the x and y variables as ballX, ballY, squareX, and square Y. I tried if(ballX==squareX && ballY == squareY) { alert("collision detected"); } but it wont work

6th Mar 2018, 4:15 AM
Someone Else
Someone Else - avatar
2 ответов
+ 2
Good question 🔵🔴⚪ 💥💥💥
11th Sep 2018, 4:33 AM
NimWing Yuan
NimWing Yuan - avatar
0
Why are you checking only equality?
6th Mar 2018, 4:32 AM
Leshark
Leshark - avatar