In a breakout game, the simplest way to determine if the ball hits the block is define the coordinates of the block, and when the ball is in the specific coordinate, the ball hits the block. The ball direction will be invert by positive/ negative 'speed'.

ex: if(hit==true)

speed *= -1;

But what if the ball is go straight into a corner of the block, what direction would the ball head to??? I've been dealing with this matter for like a week already and still haven't figure out. The speed of the ball also relative to the coordinate of the place where collision occur. The speed is faster, the colliding areas must be bigger.

when i want to determine if the ball only hit the left side of the block. I would create a bounding box around the left side of the block. Let just say "block.x" and "block.y" are the top-left of the block. "Ball.x" and "Ball.y" are the center of the ball, the ball has a radius of 10. Block's length is 30, width is 15.

The code works at certain point but it always goes wrong when it's near the corner.Code:if( (Ball.x+10 >= block.x-1) && (Ball.x <= block.x-11)) { if( (Ball.y+10 <= block.y+25) && (Ball.y-10 >= block.y)) return NormalLeft; }

So can anyone point out how can i fix this problem. By the way, i don't use the "invert speed" way to change the direction of the ball, but actually calculate the ball's angle with the blocks' normal.