This repository has been archived by the owner on Aug 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
executable file
·59 lines (49 loc) · 1.76 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
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
<head>
<title>GameJine</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
*{
margin: 0px;
padding: 0px;
}
</style>
</head>
<body>
<canvas id="game" width="1800" height="900" style="border: 1px solid black;"></canvas>
</body>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.12.0.min.js"></script>
<script type="text/javascript" src="source/Game.js"></script>
<script type="text/javascript" src="source/Drawable.js"></script>
<script type="text/javascript" src="source/Player.js"></script>
<script type="text/javascript" src="source/Object.js"></script>
<script type="text/javascript" src="http://localhost:8080/socket.io/socket.io.js"></script>
<script type="text/javascript">
socket = io.connect('localhost:8080');
c = document.getElementById("game");
ctx = c.getContext("2d");
p = new Player();
p.name = prompt("Choose your username: ");
p.race = prompt("Choose your race: (Magician, Humanoid)");
$.getJSON("sprites/"+p.race+".json", function(result){
p.load(p, result);
});
p.keyHandler();
Game = new Game(ctx);
Game.objects.push(p);
Game.start();
setInterval(function(){
socket.emit("update", p);
}, 10);
socket.on("update", function(data){
Game.objects = data
});
</script>
</html>