This page is a mirror of Tepples' nesdev forum mirror (URL TBD).
Last updated on Oct-18-2019 Download

Pong collision troubles *new problem*

Pong collision troubles *new problem*
by on (#42490)
Theres my code. Heres my problem.
1.) the ball goes too "deep" into the right paddle. Any idea why?
2.) it sometimes goes trough the "back" corners of the paddles. Again any idea why?

Also if you see any errors in general tell me :-)

Hope you guys are willing to help.


edit: in an attempt to add score was made.
However it doesnt seem to work (it shouldnt display the score yet) its supposed to count to 3 then reset. Also it should reverse direction of the ball towards the other play which its also not doing. And it for some reason fs up my right paddle making the 3 sprite flip up side down. Help appriciated.

edit2: the slightly cleaner version

edit3: ok loopy helped me out with this one :-)

by on (#42495)
I don't think you should add 8 to the x position of the right paddle to check for it. Because I believe the ball is supposed to collide with the right edge of the left paddle, in which case you'd add 8 to the X position, and the ball is supposed to collide with the left edge of the right paddle, in which case you wouldn't add anything.

by on (#42496)
I think I tried that. I'll recheck.
Main problem is the going trough corner though.

edit: thanks I fixed the going "into" the right paddle problem Now the corner issue.

by on (#42532)
What exactly is happening when you say they go through the corners? Whatever the case, I'm sure what's going on is that the code for some reason does not detect that the bounding boxes are overlapping. I'll look over your code to see if I can find anything, but in the mean time try to think of why there would be no bounding box overlap detection.

EDIT: I noticed in your collision code that all the branches are on bcc. I think some should be on bcs, probably the first and third one.

by on (#42536)
Had to change that cause in some cases I switched aroudn ball and paddle. (so I could add stuff to it)

by on (#42544)
Jeroen wrote:
Had to change that cause in some cases I switched aroudn ball and paddle. (so I could add stuff to it)

edit: yay I got it fixed. Thanks guys :-)

by on (#42716)
Ok I ran into a new weird problem. If anyone can help thanks :-)

by on (#42723)
What's the new weird problem?

by on (#42740)
Fixed it sorta. I described it in the first post (edited it) Its stil there but my counter now works. However eventually when I reset it stil messes up the right paddle. Quitte weird.