-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
37 lines (37 loc) · 1.21 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<html>
<head>
<title>Ping Pong</title>
<link type="text/css" rel="stylesheet" href="style.css"/>
<script defer src="https://unpkg.com/p5"></script>
<script defer src='https://unpkg.com/p5.collide2d'></script>
<script src="sketch(dev).js"></script>
</head>
<body>
<main>
<h1>Ping Pong - By Prajwal Agrawal</h1>
<input id='shi' type='button' onclick='showInstructions()' value='Show/hide instructions'>
<div id='ins'><p>Instructions:
<br>Use the W and S keys to move your paddle.
<br>You can also move your mouse.
<br>If you are on a touch device, drag to move the <br>paddle.
<br>Press ESC or click the button to pause/resume the game.
<br>For 2 players:
<br>W/S to move Player 1
<br>Up/Down to move Player 2
<br>tap and drag left side of screen to move Player 1
<br>tap and drag right side of screen to move Player 2</p></div>
<input type="button" id='sp' onclick="pause()" value="Start/Pause">
<h2 id='scr'></h2>
<script>
function showInstructions() {
var x = document.getElementById("ins");
if (x.style.display === "none") {
x.style.display = "block";
} else {
x.style.display = "none";
}
}
</script>
</main>
</body>
</html>