From b16dc17037e084393f535f888eb6e073225939ca Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Tue, 3 Jan 2017 16:02:32 -0500 Subject: [PATCH] MDN breakout step 7 --- mdn-breakout/index.html | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/mdn-breakout/index.html b/mdn-breakout/index.html index ec0c943..4efb584 100644 --- a/mdn-breakout/index.html +++ b/mdn-breakout/index.html @@ -37,7 +37,7 @@ canvas { background: #eee; display: block; margin: 0 auto; } for(c=0; c canvas.width-ballRadius || x + dx < ballRadius) { dx = -dx; @@ -142,6 +146,21 @@ canvas { background: #eee; display: block; margin: 0 auto; } } } + function collisionDetection() { + for(c=0; c b.x && x < b.x+brickWidth && y > b.y && y < b.y+brickHeight) { + dy = -dy; + b.status = 0; + } + } + } + } + document.addEventListener("keydown", keyDownHandler, false); document.addEventListener("keyup", keyUpHandler, false); setInterval(draw, 10);