Joe 589b989b36 Fixed collision detection (game-breaking bug)
Fixed an issue with the ball occasionally clipping through the paddle/bricks or bouncing from a position inside the paddle/bricks
This should never happen, as the ball should be updated to move in a different direction if the ball is clipping in the next frame
This was being caused by a rounding error in the vertexWithinQuad function, where adding the compared volumes introduced a small imprecision and meant the test volume and original volume were not always exactly equal
Cast the two areas as integers when comparing, such that only a discrepancy > 1px would be considered a collision (perfect since we are ultimately rendering bitmaps). Could also be solved by adding a percentage margin of error or increasing precision (both more costly)
2018-01-09 18:36:05 +00:00
..
2017-12-07 14:23:35 +00:00

Breakout

breakout.c

Compile using make