/
index.html
56 lines (55 loc) · 2.57 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
<!DOCTYPE html>
<html>
<head>
<title>The Game</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=.5, maximum-scale=.0, minimum-scale=.5, user-scalable=no"/>
<link href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" rel="stylesheet" />
<link href="css/style.css" rel="stylesheet" />
<script src="https://code.jquery.com/jquery-3.2.1.js" integrity="sha256-DZAnKJ/6XZ9si04Hgrsxu/8s717jcIzLy3oi35EouyE=" crossorigin="anonymous"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js" integrity="sha256-T0Vest3yCU7pafRw9r+settMBX6JkKN06dqBnpQ8d30=" crossorigin="anonymous"></script>
<script src="js/Game.js"></script>
</head>
<body>
<script>
$(function () {
$("#start-button").on("click", function () {
$("#shot,#stage,#score").empty();
$("#start-button").hide();
$("#toolbar").append("<button id='button-shot'>Shot</button>");
$("#toolbar").append("<button id='button-heal'>Heal</button>");
$("#toolbar").append("<button id='button-pause'>Pause</button>");
var game = new Game();
$("#button-shot").on("click", function () {
var target = game.player.target;
if (!target) {
game.notify(game.player, "select a target");
return;
}
if (target.attr("id") === "me")
return;
game.player.shot(target);
});
$("#button-heal").on("click", function () {
var target = game.player.target;
if (!target) {
game.notify(game.player, "select a target");
return;
}
game.player.heal(target);
});
$("#button-pause").on("click", function () {
if (!confirm("Paused, click ok to resume"))
window.location.reload(1);
});
game.start();
});
});
</script>
<div id="shot"></div>
<div id="stage"></div>
<button id="start-button">Start</button>
<div id="score"></div>
<div id="toolbar"></div>
</body>
</html>