File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Game Development and the fly likes need help with my breakout game Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Game Development
Bookmark "need help with my breakout game" Watch "need help with my breakout game" New topic
Author

need help with my breakout game

Semthan Waleed
Greenhorn

Joined: May 13, 2012
Posts: 5
hi guys im new here and i need little help with my "breakout" game


i need a code to move the paddle "easy code" with arrow keys "left and right"





this is my code!!













Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
you press the key, the code changes the location of whatever you want moved, then calls [container].repaint(),
so, the whatever is drawn at the new location.

if you want the whatever to keep moving whilst the key is pressed, you start a timer to do the above, keyReleased stops the timer.

I'd post a bit more detail, but as you've posted this elsewhere, I won't.

also, you may run into problems by mixing awt components with swing components
Semthan Waleed
Greenhorn

Joined: May 13, 2012
Posts: 5
i don't know but its still not working


Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> i don't know but its still not working

you've had a bunch of replies on your other posts (are you up to 10 forums yet?),
so I'm not going to have their time wasted by posting the simple solution.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: need help with my breakout game