wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Bad Bounce Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Bad Bounce" Watch "Bad Bounce" New topic
Author

Bad Bounce

Peter Powers
Greenhorn

Joined: Jan 10, 2013
Posts: 13
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
Ranch Hand

Joined: Jul 26, 2012
Posts: 523
    
    3

Does getElementAt ever return null?
Peter Powers
Greenhorn

Joined: Jan 10, 2013
Posts: 13
Yes it does, I checked that by inserting an if null - system.out print.
Peter Powers
Greenhorn

Joined: Jan 10, 2013
Posts: 13
Found the problem.... need to update ball position.
Stevens Miller
Ranch Hand

Joined: Jul 26, 2012
Posts: 523
    
    3

Peter Powers wrote:Found the problem.... need to update ball position.

That was going to be my next suggestion.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Bad Bounce