Jump to content


- - - - -

HTML 5 Breakout game


2 replies to this topic

#1 Awilum

    New Member

  • Members
  • Pip
  • 1 posts

Posted 08 January 2011 - 12:03 PM

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.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;
    }


#2 tobeythorn

    Valued Member

  • Members
  • PipPipPip
  • 189 posts

Posted 08 January 2011 - 04:42 PM

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

#3 touch_the_sky

    Valued Member

  • Members
  • PipPipPip
  • 156 posts

Posted 12 January 2011 - 01:12 PM

Excellent;)

The only thing is the url you posted is dead already, I found v2 there though:
http://awilum.webdev...s/arcanoid.html





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users