-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
248 lines (225 loc) · 11.8 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
<!DOCTYPE html>
<html manifest="cache.appcache">
<head>
<meta charset="UTF-8">
<meta name="author" content="import-this">
<meta name="application-name" content="Bounce">
<meta name="description" content="A simple HTML5 game inspired by an old version of
Artem Rakhmatulin's Insanity! - #BounceGame">
<meta name="keywords" content="Bounce, clone, port, game, 2D, HTML5, Phaser,
import-this, github, github.io, open source">
<meta name="robots" content="index, follow">
<!-- Mobile devices magic. -->
<meta name="viewport" content="width=device-width, height=device-height, minimal-ui,
initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
<!-- Open Graph for Facebook. -->
<meta property="og:url" content="https://import-this.github.io/bounce/" />
<meta property="og:type" content="website" />
<meta property="og:title" content="Bounce" />
<meta property="og:site_name" content="Bounce" />
<meta property="og:image" content="https://import-this.github.io/bounce/img/wallpaper.png" />
<meta property="og:description" content="A simple HTML5 game inspired by an old version of
Artem Rakhmatulin's Insanity! - #BounceGame" />
<!-- Google Search Console verification method. -->
<meta name="google-site-verification" content="l3FLvijRzmzAxnDb7k-KtuYtiKbbELUQLsvJUs1YOs0" />
<title>Bounce</title>
<link rel="stylesheet" type="text/css" href="css/bounce.css">
<!-- ArrayBuffer and DataView support for IE9, required by P2 Physics. -->
<script type="text/javascript" src="js/dataview-polyfill.js"></script>
<script type="text/javascript" src="js/phaser-bounce.min.js"></script>
<script type="text/javascript" src="js/bounce.js"></script>
<!-- Google Analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-86406339-1', 'auto');
ga('send', 'pageview');
</script>
</head>
<body>
<!-- Facebook JavaScript SDK -->
<div id="fb-root"></div>
<script>
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.8";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<div id="bounce-canvas">
<!-- Phaser will insert the canvas here. -->
</div>
<div id="menu">
<div id="more">
<a href="https://import-this.github.io/">More games</a>
</div>
<div id="top">
<!-- Facebook Like and Share Buttons -->
<div class="fb-like" data-href="https://www.facebook.com/Bounce-592913334247877/" data-layout="button" data-action="like" data-size="small" data-show-faces="false" data-share="true"></div>
<!-- GitHub Star Button (https://ghbtns.com/ with modifications) -->
<iframe src="https://ghbtns.com/github-btn.html?user=import-this&repo=bounce&type=star" scrolling="0" width="50" height="20"></iframe>
</div>
<div id="center">
<div id="start-menu">
<h2 id="bounce">Bounce</h2>
<div id="description">
<div>and don't let them catch you!</div>
A simple HTML5 game inspired by a now pretty old version of
<a href="https://itunes.apple.com/us/app/insanity!/id892935435">Insanity!</a>
</div>
<div id="instructions">
Click anywhere and drag the mouse to move the circle.<br />
Avoid the moving shapes for as long as you can.
</div>
<div id="mutators">
<strong>Mutators:</strong>
<label>
<input id="fast" type="checkbox" name="mutator" value="fast">Fast
</label>
<label>
<input id="speedup" type="checkbox" name="mutator" value="speedup">Speedup
</label>
<label>
<input id="five" type="checkbox" name="mutator" value="five">Five
</label>
<!-- <label>
<input id="big" type="checkbox" name="mutator" value="big">Big
</label> -->
</div>
<div id="ui">
<strong>UI:</strong>
<label>
<input id="mouse" type="radio" name="ui" value="mouse">Mouse
</label>
<label>
<input id="touch" type="radio" name="ui" value="touch">Touch
</label>
</div>
<div>
<button type="button" id="start-button">Play</button>
</div>
</div>
<div id="end-menu">
<h2>Game Over</h2>
<table id="scores">
<tr><td>Score: <span id="curr-score"></span> </td></tr>
<tr><td>High Score: <span id="high-score"></span> </td></tr>
<tr><td>Times played: <span id="times"></span> </td></tr>
</table>
<div>
<button type="button" id="restart-button">Try Again</button>
</div>
</div>
</div>
<div id="bottom">
<a href="about.html" title="About the game">About</a> |
<a href="terms.html" title="About usage rules">Terms of Use</a> |
<a href="privacy.html" title="About collected info">Privacy Policy</a>
</div>
</div>
<script type="text/javascript">
(function(document, Bounce) {
function showStartMenu() {
document.getElementById('start-menu').style.display = 'block';
document.getElementById('menu').style.display = 'block';
}
function hideStartMenu() {
document.getElementById('menu').style.display = 'none';
document.getElementById('start-menu').style.display = 'none';
}
function showEndMenu() {
document.getElementById('curr-score').innerHTML = game.bounce.score.toString();
document.getElementById('high-score').innerHTML = Bounce.storage.getHighScore();
document.getElementById('times').innerHTML = Bounce.storage.getTimesPlayed();
document.getElementById('end-menu').style.display = 'block';
document.getElementById('menu').style.display = 'block';
}
function hideEndMenu() {
document.getElementById('menu').style.display = 'none';
document.getElementById('end-menu').style.display = 'none';
}
var prefix = 'bounce_', game, ui, checkboxes, radioButtons;
// Select the corresponding radio button
ui = window.localStorage.getItem(prefix + 'ui');
if (ui) {
// based on previous settings
document.getElementById(ui).checked = true;
} else {
// or arbitrarily. (Phaser's device detection doesn't work.)
ui = 'mouse';
document.getElementById(ui).checked = true;
}
// Let the game begin!
game = Bounce.play('bounce-canvas', {
onMainMenuOpen: showStartMenu,
onEndMenuOpen: showEndMenu,
isMouse: (ui === 'mouse'),
fast: document.getElementById('fast').checked,
speedup: document.getElementById('speedup').checked,
five: document.getElementById('five').checked,
//big: document.getElementById('big').checked
});
// Handle mutator changes on the fly.
function checkboxChangeHandler(event) {
game.bounce[this.value] = this.checked;
game.state.start('Preloader');
}
checkboxes = document.querySelectorAll('input[name="mutator"]');
Array.prototype.forEach.call(checkboxes, function addEventHandler(checkbox) {
checkbox.addEventListener('change', checkboxChangeHandler);
});
// Handle UI changes on the fly.
function radioChangeHandler(event) {
window.localStorage.setItem(prefix + 'ui', this.value);
game.bounce.isMouse = (this.value === 'mouse');
game.state.start('Preloader');
}
radioButtons = document.querySelectorAll('input[name="ui"]');
Array.prototype.forEach.call(radioButtons, function addEventHandler(radio) {
radio.addEventListener('change', radioChangeHandler);
});
// Setup UI buttons.
document.getElementById('start-button').addEventListener('click', function(event) {
hideStartMenu();
game.state.start('Game');
}, false);
document.getElementById('restart-button').addEventListener('click', function(event) {
function clearSelection() {
if (window.getSelection) {
if (window.getSelection().empty) { // Chrome
window.getSelection().empty();
} else if (window.getSelection().removeAllRanges) { // Firefox
window.getSelection().removeAllRanges();
}
} else if (document.selection) { // IE
document.selection.empty();
}
}
hideEndMenu();
// Dragging on canvas may have caused html selection when the
// end menu pops up, since the player moves the mouse while it
// is still down and the canvas stops receiving input. So, clear
// the selection so as to not move it when the player starts
// dragging again.
// Note: I didn't enjoy this bug.
clearSelection();
game.state.start('Game');
}, false);
}(document, Bounce));
</script>
<!-- Adblock detection -->
<script type="text/javascript" src="js/ads.js"></script>
<script type="text/javascript">
(function() {
if (!window.noAdblock) {
// Adblock detected!
} else {
}
}());
</script>
</body>
</html>