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
Lester Burnham
Rancher
Joined: Oct 14, 2008
Posts: 1337
posted
0
You're not adding a KeyListener anywhere. There should be an "addKeyListener(this)" statement in the MyBall constructor.
komaravolu raju
Greenhorn
Joined: Oct 25, 2010
Posts: 11
posted
0
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.
thanks in advance.
Lester Burnham
Rancher
Joined: Oct 14, 2008
Posts: 1337
posted
0
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).
komaravolu raju
Greenhorn
Joined: Oct 25, 2010
Posts: 11
posted
0
Thanks for your support.
I got up to the movement of the paddle and displaying the bricks in the screen.
But, I could not manage to make the bricks vanish when they are each one is hit by the ball.
here is the code for that.
can any one give me some suggestion......
That would be of great help...
komaravolu raju
Greenhorn
Joined: Oct 25, 2010
Posts: 11
posted
0
oh..
finally I have done the game..
and from there, I have also done the target bouncer game also with the same concept...