-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
75 lines (62 loc) · 2.41 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
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
<script type="text/javascript" src="js/two.js"></script>
<script type="text/javascript" src="js/fps.js"></script>
<script type="text/javascript" src="js/utils.js"></script>
<script type="text/javascript" src="js/bee.js"></script>
<script type="text/javascript" src="js/systemParameters.js"></script>
<script type="text/javascript" src="js/target.js"></script>
<script type="text/javascript" src="js/mouseTarget.js"></script>
<script type="text/javascript" src="js/targetGroup.js"></script>
<script type="text/javascript" src="js/beeCollection.js"></script>
<script type="text/javascript" src="js/targetCollection.js"></script>
<script type="text/javascript" src="js/targetGroupCache.js"></script>
<style>
body {
background-color: black;
color: white;
}
#canvas {
height: 90%;
width: 90%;
}
</style>
</head>
<body>
<div id="canvas" style="background: black"></div>
<script type="text/javascript">
var utils = new Utils(),
systemParameters = new SystemParameters(utils);
var elem = document.getElementById('canvas');
var playArea = {
width: $(window).width() - 20,
height: $(window).height() - 40
};
var two = new Two(playArea).appendTo(elem);
var beeCollection = new BeeCollection(two, playArea, utils, systemParameters),
targetCollection = new TargetCollection(two, playArea, utils, systemParameters);
targetCollection.spawnMouseTarget();
for (var i = 0; i < systemParameters.targets; i++) {
targetCollection.spawnTarget();
};
for(var i = 0; i < systemParameters.bees; i ++) {
beeCollection.spawnBee();
};
var targetGroupCache = new TargetGroupCache(targetCollection, systemParameters);
two.bind('update', function () {
targetCollection.update();
var groupedBees = targetGroupCache.getGroup(beeCollection.bees);
beeCollection.update(groupedBees);
fps.Count();
});
if(systemParameters.frameThrottle) {
two.play();
} else {
// will run the game as fast as possible.
// used for debugging perf
setInterval(function () { two.update(); }, 0);
}
</script>
</body>
</html>