I study the JS and HTML5, and wrote such a toy, its breakout.
Demo yet. All three levels.
Please test in terms of gameplay, and physics. It seems to me that physics has turned out not very good
Play: http://awilum.webdev...d/arcanoid.html
Collisions ball with bricks
// Collissions with bricks
rowheight = bricks.height + bricks.padding;
colwidth = bricks.width + bricks.padding;
row = Math.floor(ball.y/rowheight);
col = Math.floor(ball.x/colwidth);
// Ball collision with brick
if (ball.y < bricks.rows * rowheight && row >= 0 && col >= 0 && level_bricks[row][col] == 1) {
ball.dy = -ball.dy;
level_bricks[row][col] = 0;
score += 50;
bricks_destroed++;
}
// Ball collision with rock
if (ball.y < bricks.rows * rowheight && row >= 0 && col >= 0 && level_bricks[row][col] == 2) {
ball.dy = -ball.dy;
level_bricks[row][col] = 1;
}











