diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/.vscode/launch.json b/.vscode/launch.json old mode 100644 new mode 100755 diff --git a/.vscode/tasks.json b/.vscode/tasks.json old mode 100644 new mode 100755 diff --git a/Sierra.jpg b/Sierra.jpg old mode 100644 new mode 100755 diff --git a/chuckdries.asc b/chuckdries.asc old mode 100644 new mode 100755 diff --git a/css/style.css b/css/style.css old mode 100644 new mode 100755 diff --git a/game.html b/game.html old mode 100644 new mode 100755 index ddbfe46..b8853db --- a/game.html +++ b/game.html @@ -23,22 +23,25 @@ cc = c.getContext('2d'); c.height = window.innerHeight; c.width = window.innerWidth; - setInterval(update, 1000 / 30); c.addEventListener('mousemove', function(e) { p1y = e.clientY - ph / 2; - }) + }); - //game setup + lastTime = Date.now(); + deltaTime = 0; + fps = 0; + + //gameplay variables p1y = p2y = 40; pt = 10; ph = 100; - bx = by = xv = yv = 10; - reset(); - bd = 6; + bx = by = xv = yv = 500;//just making sure bx and by exist, they'll be reset when the game first starts + bd = 12; score1 = score2 = 0; ais = 5; + function reset() { bx = c.width / 2; by = c.height / 2; @@ -47,9 +50,14 @@ } function update() { + //measure timing + now = Date.now(); + deltaTime = (now-lastTime)/1000; + lastTime = now; + fps = 1/deltaTime; //move ball - bx += xv; - by += yv; + bx += xv * deltaTime; + by += yv * deltaTime; if (by < 0 && yv < 0) { yv = -yv; } @@ -61,7 +69,7 @@ if (by > p2y && by < p2y + ph) { xv = -xv; dy = by - (p2y + ph / 2); - yv = dy * .3; + yv = dy * 10; } else { score1++; reset(); @@ -71,7 +79,7 @@ if (by > p1y && by < p1y + ph) { xv = -xv; dy = by - (p1y + ph / 2); - yv = dy * .3; + yv = dy * 10;//.3 } else { score2++ reset(); @@ -84,18 +92,33 @@ p2y -= ais; } //draw background - cc.fillStyle = 'black'; + var gradient=cc.createLinearGradient(0,0,c.width,c.height); + gradient.addColorStop("0","#ff146e"); + gradient.addColorStop("1","#145aff"); + cc.fillStyle=gradient; +// cc.fillStyle="white"; cc.fillRect(0, 0, c.width, c.height); //draw paddles - cc.fillStyle = 'white'; + cc.fillStyle = 'cyan'; cc.fillRect(0, p1y, pt, ph); + cc.fillStyle = 'red'; cc.fillRect(c.width - pt, p2y, pt, ph); //draw ball + cc.fillStyle = 'lightgreen'; cc.fillRect(bx - bd / 2, by - bd / 2, bd, bd); + //draw scores + cc.fillStyle = 'white'; + cc.font = '20px Times' cc.fillText(score1, 100, 100); cc.fillText(score2, c.width - 100, 100); + //draw framerate + cc.fillText("framerate: " + fps, c.width/2 - 100, 100); + + window.requestAnimationFrame(update); //Keep the game running } + reset() //prepare the game + update() //start the game - \ No newline at end of file + diff --git a/go.php b/go.php old mode 100644 new mode 100755 diff --git a/gulpfile.js b/gulpfile.js old mode 100644 new mode 100755 diff --git a/icons/apple-touch-icon-114x114.png b/icons/apple-touch-icon-114x114.png old mode 100644 new mode 100755 diff --git a/icons/apple-touch-icon-120x120.png b/icons/apple-touch-icon-120x120.png old mode 100644 new mode 100755 diff --git a/icons/apple-touch-icon-144x144.png b/icons/apple-touch-icon-144x144.png old mode 100644 new mode 100755 diff --git a/icons/apple-touch-icon-152x152.png b/icons/apple-touch-icon-152x152.png old mode 100644 new mode 100755 diff --git a/icons/apple-touch-icon-57x57.png b/icons/apple-touch-icon-57x57.png old mode 100644 new mode 100755 diff --git a/icons/apple-touch-icon-60x60.png b/icons/apple-touch-icon-60x60.png old mode 100644 new mode 100755 diff --git a/icons/apple-touch-icon-72x72.png b/icons/apple-touch-icon-72x72.png old mode 100644 new mode 100755 diff --git a/icons/apple-touch-icon-76x76.png b/icons/apple-touch-icon-76x76.png old mode 100644 new mode 100755 diff --git a/icons/code.txt b/icons/code.txt old mode 100644 new mode 100755 diff --git a/icons/favicon-128.png b/icons/favicon-128.png old mode 100644 new mode 100755 diff --git a/icons/favicon-16x16.png b/icons/favicon-16x16.png old mode 100644 new mode 100755 diff --git a/icons/favicon-196x196.png b/icons/favicon-196x196.png old mode 100644 new mode 100755 diff --git a/icons/favicon-32x32.png b/icons/favicon-32x32.png old mode 100644 new mode 100755 diff --git a/icons/favicon-96x96.png b/icons/favicon-96x96.png old mode 100644 new mode 100755 diff --git a/icons/favicon.ico b/icons/favicon.ico old mode 100644 new mode 100755 diff --git a/icons/mstile-144x144.png b/icons/mstile-144x144.png old mode 100644 new mode 100755 diff --git a/icons/mstile-150x150.png b/icons/mstile-150x150.png old mode 100644 new mode 100755 diff --git a/icons/mstile-310x150.png b/icons/mstile-310x150.png old mode 100644 new mode 100755 diff --git a/icons/mstile-310x310.png b/icons/mstile-310x310.png old mode 100644 new mode 100755 diff --git a/icons/mstile-70x70.png b/icons/mstile-70x70.png old mode 100644 new mode 100755 diff --git a/images/Chuck.jpg b/images/Chuck.jpg old mode 100644 new mode 100755 diff --git a/images/ChuckNew.jpg b/images/ChuckNew.jpg old mode 100644 new mode 100755 diff --git a/images/cd.ai b/images/cd.ai old mode 100644 new mode 100755 diff --git a/images/cd.png b/images/cd.png old mode 100644 new mode 100755 diff --git a/images/chuck2.png b/images/chuck2.png old mode 100644 new mode 100755 diff --git a/images/keyality.jpg b/images/keyality.jpg old mode 100644 new mode 100755 diff --git a/images/laurelleft.png b/images/laurelleft.png old mode 100644 new mode 100755 diff --git a/images/laurelright.png b/images/laurelright.png old mode 100644 new mode 100755 diff --git a/images/laurelwreath.psd b/images/laurelwreath.psd old mode 100644 new mode 100755 diff --git a/images/ohackscreenshot.png b/images/ohackscreenshot.png old mode 100644 new mode 100755 diff --git a/index.html b/index.html old mode 100644 new mode 100755 diff --git a/learn.html b/learn.html old mode 100644 new mode 100755 diff --git a/max.py b/max.py old mode 100644 new mode 100755 diff --git a/oldstyle.css b/oldstyle.css old mode 100644 new mode 100755 diff --git a/package.json b/package.json old mode 100644 new mode 100755 diff --git a/readme.md b/readme.md old mode 100644 new mode 100755 diff --git a/roboticchuck.html b/roboticchuck.html old mode 100644 new mode 100755 diff --git a/rocks.html b/rocks.html old mode 100644 new mode 100755 diff --git a/sass/animations.scss b/sass/animations.scss old mode 100644 new mode 100755 diff --git a/sass/covers.scss b/sass/covers.scss old mode 100644 new mode 100755 diff --git a/sass/responsive.scss b/sass/responsive.scss old mode 100644 new mode 100755 diff --git a/sass/style.scss b/sass/style.scss old mode 100644 new mode 100755 diff --git a/scroll.js b/scroll.js old mode 100644 new mode 100755 diff --git a/secretsnip.html b/secretsnip.html old mode 100644 new mode 100755 diff --git a/spooky.html b/spooky.html old mode 100644 new mode 100755 diff --git a/spookyno.html b/spookyno.html old mode 100644 new mode 100755 diff --git a/spookyredir.php b/spookyredir.php old mode 100644 new mode 100755 diff --git a/ui-snapshot-06232017.mp4 b/ui-snapshot-06232017.mp4 new file mode 100644 index 0000000..e3bb0f5 Binary files /dev/null and b/ui-snapshot-06232017.mp4 differ