Detecting edges of frame, bouncing balls
Posted on 2011-02-14
I'm working on assignment, I'm trying to get a unfilled circle to bounce around the inside of a jframe, I'm using the usual rules that if the balls pos x/y are under 0 to reverse the direction and if they are over the frames width - Radius to do the same, but I'm still having the problem where the circle goes well beyond the bottom and and more than half the way off the right.
I've looked at many examples and they all seem to use the same method as I'm doing? I'm not using threads.
Can anyone offer any clue to what is wrong. Don't have code to hand at present; but is this a typical problem.