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

Bad Bounce  RSS feed

 
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: 1443
30
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: 1443
30
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!