• entries
    383
  • comments
    1075
  • views
    352191

Brixtar - Day 2

Sign in to follow this  
Trapper Zoid

59 views

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.
Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now