The distance was returning various numbers between 200-700 even when the paddle was next to the ball.
I even changed the code so it detects if x>required/x<required and it only detects collision on the first frame (as soon as the sketch is played the detection for those coordinates are detected).
So you're needing to know if the boundary of a circle is touching or otherwise past the boundary of a "paddle". You can think of the paddle as having two interactive lines, a top line and a bottom line. If a point along one of these lines is inside the circle then a collision has taken place.
Thank you but I've already done that euclidean distance formula and it makes no difference to my program as to what I'm doing now. My problem is that only on the first frame if there's collision the 'velocity' will reverse and the ball jitters at the top.
if(distance< 40)
once this is true, if the velocity is not huge, it will just sit there.
dist = 20;
reverse velocity, move a little, but dist = 23, so its still true, revers, dist is 19, still true, reverse, dist is 25, reverse, 15, ... whatever... it will oscillate here.
you need to change the condition once its met, to a new condition... what will it hit after it rebounds (the velocity flip?).
I come here to learn too. I learned c++ way before the STL existed, and put it aside a few years ago, trying to refresh my skills. Ive learned tons already. Its a give and take.