Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Bad Bounce

 
Peter Powers
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, I am working through the Stanford java You tube series, and am currently on the Breakout game - got it working fine except for one very irritating thing. When the ball bounces off the paddle it goes through the paddle then bounces as only the top left coordinates of the GOval ball is being read. Why are the rest being ignored?- Thanks in advance .. been pulling my hair our for hours.... suspect code below..



PS - could it be the paddle?

 
Stevens Miller
Bartender
Posts: 1244
24
C++ Java Netbeans IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does getElementAt ever return null?
 
Peter Powers
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes it does, I checked that by inserting an if null - system.out print.
 
Peter Powers
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Found the problem.... need to update ball position.
 
Stevens Miller
Bartender
Posts: 1244
24
C++ Java Netbeans IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Peter Powers wrote:Found the problem.... need to update ball position.

That was going to be my next suggestion.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic