Who says that smashing your head against a brick wall for a while doesn't yield results.
So in my attempt to go teh old school I decided to see how well I could implement some hit detection. Using all code with hard coded images.
First issue. The centre point is literal.
Yeah this means that trying to keep the ball in play field will always result in some overhang. Which doesn't look good.
Enter arrays!
and the second issue. They are a twat to work with. In a good kind of way.
I ended up making some markers to make a kind of hit point. Once this point goes past the screen bounds it keeps the ball in the field.
as the markers leave the field it forces the middle of the ball to a neutral area in the field close to the edge. Giving the impression the ball is staying put.
Anyway. Have a play and look at the code. I have tried to annotate as much as possible and left debugging info on the screen.
Nice. It works well.
I don't think you actually need the initial ct.b1, b2, etc sets because you sent those when the player pushes a button, and you can't leave the boundary unless you press a button.
Probably not. But I left it in because it was in my learning experience.
[Please log in to post a comment]