Replies To: would this work?

Re: would this work?

I'm sure that is not compilable. You are using logical operators between numbers. They should be evaluating booleans.

Edit: Not java forum, sorry.

However, it shouldn't work. I believe in C++ a non-zero number equates to true. True/False is above or equal to True/False. Also, you place ballY with width, and x with height which makes no sense.

What you need to do is:

if (ballX + ball_width >= paddleX)
// this would be if the ball is going right and hits the paddle. If you are going left, you will need to account for the paddles width, but not the balls width. This is the same for up and down.