-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
75 lines (70 loc) · 3.11 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
67
68
69
70
71
72
73
74
75
<!DOCTYPE html>
<html style="margin: 0px;">
<head>
<title>webq2</title>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<link rel="icon" href="favicon.ico" type="image/x-icon">
<script src="https://cdnjs.cloudflare.com/ajax/libs/pixi.js/4.7.1/pixi.min.js"></script>
<script src="js/Dijkstras.js"></script>
<script src="js/Game.js"></script>
<script src="js/Construction.js"></script>
<script src="js/Particle.js"></script>
<script src="js/Character.js"></script>
<script src="js/Enemy.js"></script>
<style type="text/css">
div {margin-left: 5px;}
a {color: white;}
</style>
</head>
<body style="background: #222; color: white;margin: 0px;">
<script>
const app = new PIXI.Application();
app.renderer.autoResize = true;
app.renderer.resize(1600, 750);
document.body.appendChild(app.view);
// var debug_text = new PIXI.Text('0', new PIXI.TextStyle({fill: '#ffffff'}));
// debug_text.x = 0;
// debug_text.y = 0;
// app.stage.addChild(debug_text);
// load the texture we need
PIXI.loader
.add('bunny', 'bunny.png')
.add('carrot', 'carrot.png')
.add('dead_bunny', 'dead_bunny.png')
.add('circle', 'circle.png')
.add('turret', 'turret.png')
.add('turret_gun', 'turret_gun.png')
.add('gradient', 'gradient.png')
.add('ray', 'ray.png')
.load((loader, resources) => {
init_particle_containers();
start_level();
// Listen for frame updates
app.ticker.add(() => {
const dt = 0.016;//app.ticker.elapsedMS * 0.001;
update_game(dt);
});
//Attach event listeners
document.onkeydown = event => bunny.handle_keydown(event);
document.onkeyup = event => bunny.handle_keyup(event);
document.onmousedown = event => bunny.handle_click(event);
document.onmouseup = event => bunny.handle_unclick(event);
document.onmousemove = event => bunny.handle_mouse(event);
});
</script>
<div style="font-family: Impact;
-webkit-text-fill-color: white; /* Will override color (regardless of order) */
-webkit-text-stroke-width: 1px;
-webkit-text-stroke-color: black;
">
Grab the carrot! Don't get yourself killed!
Use WSAD to move, 1, 2, 3 to select weapons, mouse to aim and shoot.
<br>
Window size should be at least 1600x750. Use your browser zoom if canvas does not fit.
</div>
<div style="font-family: Courier;">
<a href="https://github.com/spidamoo/webq2" target="blank">Source code</a>
© <a href="http://spidamoo.ru" target="blank">Vladimir Zatoloka</a> 2018
</div>
</body>
</html>