forked from roeioved/Xonix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
66 lines (56 loc) · 2.32 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
66
<html>
<head>
<title>HTML5 XoniX</title>
<link rel="stylesheet" type="text/css" href="style/reset.min.css">
<link rel="stylesheet" type="text/css" href="style/style.css">
<script type="text/javascript" src="scripts/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="scripts/event_handler.js"></script>
<script type="text/javascript" src="scripts/movable.js"></script>
<script type="text/javascript" src="scripts/vector.js"></script>
<script type="text/javascript" src="scripts/grid.js"></script>
<script type="text/javascript" src="scripts/ball.js"></script>
<script type="text/javascript" src="scripts/monster.js"></script>
<script type="text/javascript" src="scripts/player.js"></script>
<script type="text/javascript" src="scripts/game.js"></script>
<script>
var canvasWidth = 640,
canvasHeight = 460,
frame = 20,
blockSize = 10;
var game;
function updateScore(value) {
$('#score').html(value);
}
function updateLives(value) {
$('#lives').html(value);
}
function updateConquered(value) {
$('#conqured').html(value);
}
function updateTimer(value) {
$('#timer').html(value);
}
function gameOver(value) {
}
$(document).ready(function() {
var canvas = document.getElementById("canvas");
var ctx = canvas.getContext("2d");
var game = new Game(canvasHeight / blockSize, canvasWidth / blockSize, blockSize, frame / blockSize, ctx);
game.addEventListener('conquer', updateConquered, this);
game.addEventListener('fail', updateLives, this);
game.addEventListener('score', updateScore, this);
game.addEventListener('end', gameOver, this);
game.addEventListener('timer', updateTimer, this);
game.start();
});
</script>
</head>
<body>
<div id="container">
<canvas id="canvas" width="640" height="460"></canvas>
<div id="status">
Score: <span id="score">0</span> Xn: <span id="lives">3</span> Full: <span id="conqured">0</span>% Time: <span id="timer">90</span>
</div>
</div>
</body>
</html>