This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets 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.
 
 
subject: need help with my breakout game
 
Similar Threads
Double Buffering help!
beginner / mouse listener, ears are plugged
placing images in applets
Applet refuses to repaint
Gray box where my applet should be