Brixtar - Day 2

Published May 22, 2007
Advertisement
Collision detection is still not working properly. I've implemented a method that should in theory deal with multiple balls travelling at high speed. When given a time interval to update the ball's movement, the algorithm checks to see if the ball can touch a new grid space that could potentially contain a brick. If so, it updates the ball's movement to the point where it touches said grid space, checks for any collisions, and then repeats the process with the remaining time left in the given time interval.

I think it should work fine; I've currently only enabled reaction to collision with the border of the screen, and it almost works. Unfortunately every once in a while the ball completely ignores the top of the screen and flies off into the unknown. The figures from the internal data are bizarre, so I'm not sure exactly what's going on in there. I'll come up with a solution later today, even if it means rolling this back to something simpler.

Additional

I took another quick look at the code this morning with a clearer head and found the problem - a combination an off-by-one mismatch and a sign error in the mathematics. My usual bug hunting method is to systematically step through the code and try modifying everything one thing at a time (a system honed from a childhood playing graphical adventure games [smile]), but it falls flat when there are two errors.

Now the ball is merrily bouncing away, colliding with bricks and making them disappear. Looks like I'll have a functioning game by the next update.
Previous Entry Brixtar - Day 1
Next Entry Brixtar - Day 3
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement
Advertisement