diff --git a/mdn-breakout/index.html b/mdn-breakout/index.html
index 57491bf..5a6481b 100644
--- a/mdn-breakout/index.html
+++ b/mdn-breakout/index.html
@@ -185,10 +185,25 @@ canvas { background: #eee; display: block; margin: 0 auto; }
else if(e.keyCode == 37) {
leftPressed = false;
}
+ else if(e.keyCode == 27) {
+ if(isPaused) {
+ isPaused = false;
+ } else {
+ pauseWithMessage("PAUSE (ESC)");
+ }
+ }
+ }
+
+ function mouseMoveHandler(e) {
+ var relativeX = e.clientX - canvas.offsetLeft;
+ if(relativeX > (0-paddleWidth) && relativeX < (canvas.width+paddleWidth)) {
+ paddleX = relativeX - paddleWidth/2;
+ }
}
document.addEventListener("keydown", keyDownHandler, false);
document.addEventListener("keyup", keyUpHandler, false);
+ document.addEventListener("mousemove", mouseMoveHandler, false);
setInterval(draw, 10);
})();