HTML 5 Breakout game

E00bfea768975c1df642ad4c562371c1
0
Awilum 101 Jan 08, 2011 at 12:03

Hello:)
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 :( Collisions bricks and ball…

Play: http://awilum.webdevart.ru/games/arcanoid/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;
    }

2 Replies

Please log in or register to post a reply.

A77e71b962cd6c7c3b885f0488452f1f
0
tobeythorn 101 Jan 08, 2011 at 16:42

cool man. this is exciting. can’t wait until html5 is well supported!

Ffe16f497018b21d87cf101c9c49cfe0
0
touch_the_sky 103 Jan 12, 2011 at 13:12

Excellent;)

The only thing is the url you posted is dead already, I found v2 there though:

http://awilum.webdevart.ru/games/arcanoid/games/arcanoid.html