File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

need help with my breakout game

 
Semthan Waleed
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4632
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i don't know but its still not working


 
Michael Dunn
Ranch Hand
Posts: 4632
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> 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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic