Skip to content
This repository has been archived by the owner on Apr 29, 2018. It is now read-only.

Commit

Permalink
Ball and paddles are separated from the score area
Browse files Browse the repository at this point in the history
Closes #18
  • Loading branch information
Leon Byford committed Mar 30, 2015
1 parent b0bbd05 commit 981c056
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ function getDocCookies(x) {

function initVars() {
score = 0;
lPadY = (480-padH)/2;
lPadY = 32+(480-32-padH)/2;
lPadSpeed = 0;
rPadY = (480-padH)/2;
rPadY = 32+(480-32-padH)/2;
rPadSpeed = 0;
ballX = 640 - padM - padW - ballR;
ballLeft = true;
Expand Down Expand Up @@ -66,7 +66,7 @@ function bounceToLeft() {
topScore = score;
}

var to = Math.round((480-padH)*Math.random());
var to = Math.round(32+(480-32-padH)*Math.random());
rPadSpeed = (to - rPadY) / framesUntilImpact();
lPadSpeed = 0;
ballSpeed++;
Expand All @@ -84,7 +84,7 @@ function bounceToRight() {
topScore = score;
}

var to = Math.round((480-padH)*Math.random());
var to = Math.round(32+(480-32-padH)*Math.random());
lPadSpeed = (to - lPadY) / framesUntilImpact();
rPadSpeed = 0;
ballSpeed++;
Expand All @@ -109,8 +109,8 @@ function animateBall() {
if (mouseY > 480 - ballR) {
ballY = 480 - ballR;
}
else if (mouseY < ballR) {
ballY = ballR;
else if (mouseY < 32 + ballR) {
ballY = 32 + ballR;
}
else {
ballY = mouseY;
Expand Down

0 comments on commit 981c056

Please # to comment.