-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
62 lines (50 loc) · 1.66 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
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="/socket.io/socket.io.js"></script>
<!-- PLEASE NO CHANGES BELOW THIS LINE (UNTIL I SAY SO) -->
<script src =
"https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.9.1/underscore-min.js" >
</script>
<script language="javascript" type="text/javascript" src="/libraries/p5.min.js"></script>
<script language="javascript" type="text/javascript" src="/p5_js.js"></script>
<!-- OK, YOU CAN MAKE CHANGES BELOW THIS LINE AGAIN -->
<!-- This line removes any default padding and style.
You might only need one of these values set. -->
<style> body { padding: 0; margin: 0; } </style>
</head>
<body>
<a href="https://github.com/matheuscamarques/tilemap/blob/master/index.html">GITHUB</a>
</body>
</html>
<script>
setTimeout(
()=>{
socket.emit('start',jogador);
socket.on('receivedMessage',(data)=>{
if(data.id != jogador.id){
if(players.length){
var achou = 0;
for(let i=0;i<players.length;i++){
//console.log(players[i].id == data.id);
if(players[i].id == data.id){
achou = 1;
players[i] = data
}
}
if(!achou){
players.push(data);
}
}else{
players.push(data);
}
}
})
setInterval( ()=>{
socket.emit('sendMessage',jogador)
},0);
},
1000
);
</script>