[quote]Yes !
The normal Applet-tag version works fine
Nice game !!!
How did you solve the collision detection (i mean how did you solve to find out from which side exactly the ball hits the brick ?)
[/quote]
Each ball has an X, Y, DX, and DY value (all floats). To move a ball I:
First add DX to X.
Check to see if the new X/old Y falls within a brick, which is as simple as dividing X by 32 (the width of the bricks) and Y by 16 (the height of the bricks) to get indexes into my 2D array of bricks.
If the brick at that location has any hits left, then there is a brick present, so I reverse the sign of DX and add it to X again immediately. Because I’ve only moved it horizontally at this point, I know it had to have hit the left or right side of a brick, and I can use the sign of DX to tell which side.
Then I do the same thing for Y and DY, which tells me if it hit anything from the top or bottom.
Knowing which side got hit is important in my game since bricks can have optional armour plating on one or more sides, which means you can only break them if you hit them from a particular side (should make for some interesting levels later on).