-
Notifications
You must be signed in to change notification settings - Fork 9
/
index.html
65 lines (54 loc) · 1.78 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
git st<html>
<script src="jaws.js"></script>
<script src="/socket.io/socket.io.js"></script>
<body>
<h1>Invash Cho Base!</h1>
<canvas width=500 height=300></canvas>
<div id="info">
<h1>ViewPort and TileMap</h1>
</div>
<script>
<script>
function MyGameState() {
var player;
var fps;
var viewport;
var tile_map;
var archer_png = "Clash-of-Clans/Troops/Archer/Archer-lvl-1.png";
var archer_queen_stand_png = "Clash-of-Clans/Buildings/Army-Buildings/Archer-Queen-Altar/250px-Queenaltar.png";
var archer_queen_stands;
this.setup = function() {
var live_info = document.getElementById("live_info");
archer_queen_stands = new jaws.SpriteList();
var world = new jaws.Rect(0, 0, 320*10, 320*2);
/* Create the row of archer stands for the archer to stand on */
for(var x = 0; x < world.width; x+=32){
}
player = new jaws.Sprite({image: archer_png, x: 10, y: 200});
robot = new jaws.Sprite({x: 200, y: 200});
robot.animation = new jaws.Animation({sprite_sheet: "images/droid_11x15.png", frame_size: [11,15], frame_duration: 120});
}
this.update = function() {
if(jaws.pressed("left")) { player.x--; }
if(jaws.pressed("right")) { player.x++; }
robot.setImage( robot.animation.next() );
}
this.draw = function() {
player.draw();
robot.draw();
}
}
window.onload = function() {
jaws.assets.add("images/droid_11x15.png");
jaws.assets.add("images/player.png");
jaws.start(MyGameState);
}
jaws.start(myGameState)
var socket = io.connect('http://localhost');
socket.on('news', function(data) {
console.log(data);
socket.emit('my other event', {
my: 'data'
});
});
</script>