I use a 3px tall "collision range" in lieu of a single "collision pixel", meaning my only bug occurs when (~1 in every 3 balls, but random) they are able to and do run into the ball with the side of the paddle, and it "rolls" along. Your solution didn't work, but it was because a bit was left out on my part.
That is my current ball generation code:
Code:
Random ran = new Random();
if(ran.nextBoolean())
deltaX = -deltaX;
if(ran.nextBoolean())
deltaY = -deltaY;
x = (float) (ran.nextInt(300) + 25);
//important part
y = (float) (ran.nextInt(200) + 200);
And I need to make it so that it will necessarily touch
y = 60.
This would be done by making it so that both are multiples of
0.04f. 60 is already a multiple (
0.04 *1500). Now I need to make it so that the ball is a multiple.
Therefore, theoretically anyway, it should work to use
Code:
y = (float) ((ran.nextInt(50) + 50) * 4);
using your answer as a base.
However it does not.
Any ideas, now that you have all the information?
(also, I apologize for the delay; I was working on the NetIO class for MP, not to mention family vacation)