-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
61 lines (49 loc) · 2.08 KB
/
index.html
File metadata and controls
61 lines (49 loc) · 2.08 KB
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
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>test</title>
<link rel="stylesheet" type="text/css" href="css/style.css" media="all" />
</head>
<body>
<p>Test</p>
<canvas id="canvas"></canvas>
<!--Socket.io-->
<script type="text/javascript" src="/socket.io/socket.io.js"></script>
<!--game-->
<script src="/js/config.js" type="text/javascript"></script>
<script src="/js/trail.js" type="text/javascript"></script>
<script src="/js/bike.js" type="text/javascript"></script>
<script src="/js/main.js" type="text/javascript"></script>
<script type="text/javascript">
var player = {};
var socket = io.connect("http://localhost:8000");
socket.on("startPlaying", function(data)
{
player.userId = data.userId;
player.color = data.color;
console.log("Je suis connecté! " + player.userId);
main(data);
});
socket.on("updateBikeAngle", function(data){
bikes[data.userId].angle = data.angle;
bikes[data.userId].newTrail();
//console.log(bikes[data.userId].angle);
});
socket.on("newPlayer",function(data){
bikes[data.userId] = new Bike({userId: data.userId, name:data.name, color:data.color}, data.bike.x, data.bike.y, data.bike.width, data.bike.height, data.bike.speed, data.bike.angle, data.color);
});
socket.on("playerLeave", function(userId){
console.log(userId);
console.log(bikes[userId]);
delete bikes[userId];
});
socket.on("test", function(){
alert("dabouss");
});
player.name = prompt("Pseudo :", "Zougouda");
socket.emit("newPlayer", player.name);
// main();
</script>
</body>
</html>