Now, I am trying to write a program for ball breaker game.
I have read some pages in after searching google.com and found, instead of using ball (round), we can also use the squares.
So, trying to write the code.
here is the code
Now, the issue is that I want to add some keyboard events to the paddle and make it move.
I tried to add the action Listeners to to it and the paddle is not working.
can any one help me how to do it???
More over when the ball touches the ground, the game should be over and
I am sorry. I did not notice it...
thanks for your help.
I did that.
But, after adding the action listener, I could move the paddle only 1 time in both left and right.
and please let me know how to approach for other questions.
But, after adding the action listener, I could move the paddle only 1 time in both left and right.
That's explained by this code:
Hitting the left/right keys moves the paddle to an absolute position; what it should do is to move it to a position relative to the current one (which you would have to track in some variable).