Hi, I’m programming an arkanoid/breakout clone (very basic since this is my first game) and for the collision detection between the ball and the bricks, I wrapped each ot these objects with a rectangle (Rectangle class) and used its intersects() method.
I am not using any angles or anything, only position and speed variables. The thing is that if the ball hits a brick on its top or bottom, then I multiply its ySpeed by -1, and if it hits the brick on its side, the same has to be done with the ball’s xSpeed.
Is this the best approach for this type of game? Also, how can I detect on which side the ball has hit the bricks? If there is a more efficient way of doing this, please let me know.
Thanks.