• Post Reply Bookmark Topic Watch Topic
  • New Topic

Bouncing Balls problem

 
Sam Hackett
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to figure out how to have multiple balls bouncing in a frame simultaneously. I know how to have one ball bouncing but I can't figure out the logic to having more than one ball. I know my code is kind of mess. I appreciate any help. Thanks



 
Fred Kleinschmidt
Bartender
Posts: 451
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to add methods in Ball to alter the Ball's x and y.
Also, your moveBall() method doesn't do anything - it calculates new values for x and y, then discards the result.
 
Campbell Ritchie
Marshal
Posts: 52512
118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't use java.util.Timer; use a javax.swing.Timer.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!