-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgame.html
52 lines (39 loc) · 1.14 KB
/
game.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
<!DOCTYPE HTML>
<html>
<head>
<style>
body {
margin: 0px;
padding: 0px;
}
canvas {
border: 1px solid #9C9898;
}
</style>
<script src="/js/lib/kinetic-v3.10.0.js"></script>
<script src="/js/lib/Box2dWeb-2.1.a.3.min.js"></script>
<script src="/socket.io/socket.io.js"></script>
<script src="/js/physics.js"></script>
<script src="/js/graphics.js"></script>
<script src="/js/actors.js"></script>
<script src="/js/game.js"></script>
<script type="text/javascript">
window.onload = function() {
var game = new Game(1200, 500);
game.start();
document.onclick = function(){
game.fireBullet(1, 35, 100) ;
};
var socket = io.connect('/game');
socket.on('fire', function (data) {
console.log(data);
game.fireBullet(data.player, data.shoot.orientation, data.shoot.power) ;
});
} ;
</script>
</head>
<body>
<div id="container"></div>
<canvas id="canvas" width="900" height="200"></canvas><!-- debug view -->
</body>
</html>