Every file but they're all identical and this commit is confusing me
0
.gitignore
vendored
Normal file → Executable file
0
.vscode/launch.json
vendored
Normal file → Executable file
0
.vscode/tasks.json
vendored
Normal file → Executable file
0
Sierra.jpg
Normal file → Executable file
Before Width: | Height: | Size: 13 MiB After Width: | Height: | Size: 13 MiB |
0
chuckdries.asc
Normal file → Executable file
0
css/style.css
Normal file → Executable file
49
game.html
Normal file → Executable file
@ -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
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</html>
|
||||
|
0
gulpfile.js
Normal file → Executable file
0
icons/apple-touch-icon-114x114.png
Normal file → Executable file
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
0
icons/apple-touch-icon-120x120.png
Normal file → Executable file
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
0
icons/apple-touch-icon-144x144.png
Normal file → Executable file
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 41 KiB |
0
icons/apple-touch-icon-152x152.png
Normal file → Executable file
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 45 KiB |
0
icons/apple-touch-icon-57x57.png
Normal file → Executable file
Before Width: | Height: | Size: 8.0 KiB After Width: | Height: | Size: 8.0 KiB |
0
icons/apple-touch-icon-60x60.png
Normal file → Executable file
Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 8.8 KiB |
0
icons/apple-touch-icon-72x72.png
Normal file → Executable file
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
0
icons/apple-touch-icon-76x76.png
Normal file → Executable file
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
0
icons/code.txt
Normal file → Executable file
0
icons/favicon-128.png
Normal file → Executable file
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 33 KiB |
0
icons/favicon-16x16.png
Normal file → Executable file
Before Width: | Height: | Size: 905 B After Width: | Height: | Size: 905 B |
0
icons/favicon-196x196.png
Normal file → Executable file
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 70 KiB |
0
icons/favicon-32x32.png
Normal file → Executable file
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
0
icons/favicon-96x96.png
Normal file → Executable file
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
0
icons/favicon.ico
Normal file → Executable file
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
0
icons/mstile-144x144.png
Normal file → Executable file
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 41 KiB |
0
icons/mstile-150x150.png
Normal file → Executable file
Before Width: | Height: | Size: 122 KiB After Width: | Height: | Size: 122 KiB |
0
icons/mstile-310x150.png
Normal file → Executable file
Before Width: | Height: | Size: 246 KiB After Width: | Height: | Size: 246 KiB |
0
icons/mstile-310x310.png
Normal file → Executable file
Before Width: | Height: | Size: 445 KiB After Width: | Height: | Size: 445 KiB |
0
icons/mstile-70x70.png
Normal file → Executable file
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 33 KiB |
0
images/Chuck.jpg
Normal file → Executable file
Before Width: | Height: | Size: 4.1 MiB After Width: | Height: | Size: 4.1 MiB |
0
images/ChuckNew.jpg
Normal file → Executable file
Before Width: | Height: | Size: 890 KiB After Width: | Height: | Size: 890 KiB |
0
images/cd.ai
Normal file → Executable file
0
images/cd.png
Normal file → Executable file
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
0
images/chuck2.png
Normal file → Executable file
Before Width: | Height: | Size: 8.0 MiB After Width: | Height: | Size: 8.0 MiB |
0
images/keyality.jpg
Normal file → Executable file
Before Width: | Height: | Size: 107 KiB After Width: | Height: | Size: 107 KiB |
0
images/laurelleft.png
Normal file → Executable file
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
0
images/laurelright.png
Normal file → Executable file
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
0
images/laurelwreath.psd
Normal file → Executable file
0
images/ohackscreenshot.png
Normal file → Executable file
Before Width: | Height: | Size: 117 KiB After Width: | Height: | Size: 117 KiB |