-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathkeysArray.html
More file actions
48 lines (43 loc) · 937 Bytes
/
Copy pathkeysArray.html
File metadata and controls
48 lines (43 loc) · 937 Bytes
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
38
39
40
41
42
43
44
45
46
47
48
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>keysArray.html</title>
<script type = "text/javascript"
src = "simpleGame.js"></script>
<script type = "text/javascript">
var game;
var scene;
var output;
function init(){
output = document.getElementById("output");
game = document.getElementById("game");
scene = new Scene(game);
scene.start();
} // end init
function update(){
message = ""
if (keysDown[K_LEFT]){
message = "left, ";
} // end if
if (keysDown[K_RIGHT]){
message = "right, ";
} // end if
if (keysDown[K_UP]){
message = "up, ";
} // end if
if (keysDown[K_DOWN]){
message = "down, ";
} // end if
output.innerHTML = message;
} // end update
</script>
</head>
<body onload = "init()">
<h1>KeyDown Array Check</h1>
<canvas id = "game"
height = "300"
width = "400"></canvas>
<div id = "output">default</div>
</body>
</html>