Wow! Thank you for your quick reply and detailed help. I really appreciate it. Now I have the ball bouncing off the edges of the screen.
Yeah, those extra calls to checkBoundaries were redundant.
I am not sure I understand how using abs() avoids stuttering - can you elaborate on that a bit.
Once I get that I will move on to adding logic to detect collisions between the ball and the paddle and have the ball bounce off the paddle. My paddle is 100 pixels wide. So if the x position of the ball - radius is equal to any point between the x position of the paddle and the x position of the paddle + 100 the ball would bounce off of it.
Does this make sense? I will try writing the code for that.
I am thinking that if, for example I want the player to have 5 lives I can use a counter. I’d decrement the counter each time a ball drops off the screen and then start off with a new ball.
However one problem I can think of in advance is that when balls drop off the screen they don’t really disappear - there is still a ball taking up memory and moving through coordinates that are off screen, right? So how do I destroy a ball after it falls off the screen? Would I be better off using an arraylist and removing the ball from it each time it drops off screen?
Thanks again for your time and help.
Marc