-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
73 lines (69 loc) · 2.56 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<!DOCTYPE html>
<html>
<head>
<title>HowToMultiplayerLulz5</title>
<style>
body{background-color: #000;}
canvas{background-color: #222;}
</style>
<script src="/socket.io/socket.io.js"></script>
</head>
<body onload="init();">
<!--<div align="center">
<canvas id="game-canvas" width="600" height="800"></canvas>
</div>-->
<script src="pixi.js"></script>
<script src="Networking.js"></script>
<script src="BackgroundScroller.js"></script>
<script src="Scroller.js"></script>
<script src="Player.js"></script>
<script src="Main.js"></script>
<script>
function init(){
main = new Main();
}
window.onkeydown=function(e){
var unicode = e.keyCode ? e.keyCode : e.charCode;
switch(unicode){
case 37:
player.move_left = 1;
socket.emit('moving', {player: player.getMoves()});
break;
case 39:
player.move_right = 1;
socket.emit('moving', {player: player.getMoves()});
break;
case 38:
player.move_up = 1;
socket.emit('moving', {player: player.getMoves()});
break;
case 40:
player.move_down = 1;
socket.emit('moving', {player: player.getMoves()});
break;
}
}
window.onkeyup=function(e){
var unicode = e.keyCode ? e.keyCode : e.charCode;
switch(unicode){
case 37:
player.move_left = 0;
socket.emit('moving', {player: player.getMoves()});
break;
case 39:
player.move_right = 0;
socket.emit('moving', {player: player.getMoves()});
break;
case 38:
player.move_up = 0;
socket.emit('moving', {player: player.getMoves()});
break;
case 40:
player.move_down = 0;
socket.emit('moving', {player: player.getMoves()});
break;
}
}
</script>
</body>
</html>