Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

need help with my breakout game  RSS feed

 
Semthan Waleed
Greenhorn
Posts: 5
  • 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
  • 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
  • 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
  • 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.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!