Log In  

Cart #31327 | 2016-10-20 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

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.

P#31329 2016-10-20 15:17 ( Edited 2016-10-21 23:59)

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.

P#31349 2016-10-20 21:02 ( Edited 2016-10-21 01:02)

Probably not. But I left it in because it was in my learning experience.

P#31408 2016-10-21 17:52 ( Edited 2016-10-21 21:52)

Funny, I was doing this yesterday

P#31418 2016-10-21 19:59 ( Edited 2016-10-21 23:59)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-28 19:33:19 | 0.008s | Q:15