forked from kevinroast/Asteroids-Reloaded
-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
246 lines (227 loc) · 7.81 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0" />
<title>As-Toroids</title>
<script>
var a = navigator.userAgent;
if (a.indexOf("iPhone;") != -1 || a.indexOf("iPod;") != -1 || a.indexOf("iPad;") != -1)
{
window.location.href = "index-ios.html";
}
</script>
<script src="scripts/mathlib.js"></script>
<script src="scripts/gamelib.js"></script>
<script src="scripts/asteroids_main.js"></script>
<script src="scripts/asteroids_player.js"></script>
<script src="scripts/asteroids_weapons.js"></script>
<script src="scripts/asteroids_enemies.js"></script>
<script src="scripts/asteroids_effects.js"></script>
<script src="scripts/asteroids_prerender.js"></script>
<script async defer src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
<script async defer src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=xa-4e4813104686cad8"></script>
<style type="text/css">
body
{
font-family: Segoe UI Light, Arial, Helvetica;
font-size: 1.1em;
background-color: #000;
color: #ddd;
background-image: url(images/asteroid_bg.jpg);
background-repeat: no-repeat;
margin: 0;
}
.box-shadow
{
-moz-box-shadow: 3px 3px 6px #222;
-webkit-box-shadow: 3px 3px 6px #222;
box-shadow: 3px 3px 6px #222;
}
canvas
{
background-color: #000;
border: 1px solid #888;
}
.wrapper
{
padding-top: 12px;
text-align: center;
}
.info
{
text-align: left;
display: inline-block;
vertical-align: top;
margin-left: 0.5em;
}
.infopanel
{
max-width: 22em;
margin-top: 64px;
background-color: rgba(40,40,50,.85);
color: #fff;
line-height: 1.25em;
padding: 0.5em;
}
.title
{
font-size: 1.75em;
padding-top: 6px;
padding-bottom: 12px;
text-align: center;
color: #fff;
text-shadow: 1px 1px 4px rgb(60,60,60);
line-height: 1em;
}
.topology
{
color: #ffccff;
}
.highlight
{
color: #ffff88;
}
.section
{
padding-top: 0.5em;
}
.heading
{
font-size: 1.2em;
text-shadow: 1px 1px 3px rgba(55,55,55, .5);
}
.credits-wrapper
{
text-align: center;
}
.credits
{
display: inline-block;
padding: 12px 16px 4px 4px;
margin: 8px;
text-align: justify;
background-color: rgba(40,40,50,.85);
font-size: 0.8em;
}
P
{
padding-left: 1em;
padding-top: 0;
padding-bottom: 0;
line-height: 1.1em;
margin-top: 0;
margin-bottom: 0.66em;
}
P.left
{
padding-left: 0.5em;
line-height: 1.25em;
}
a, a:visited, a:active, a:hover
{
color: #ddddff;
}
.results
{
color: white;
padding-bottom: 0.25em;
}
.results-wrapper
{
display: none;
font-size: 1.0em;
border: 2px solid grey;
background-color: rgba(48,48,48,0.75);
padding: 0.5em;
margin-top: 1em;
line-height: 1.25em;
text-align: center;
}
.button-overlay
{
position: absolute;
right: 8em;
}
</style>
<meta name="description" content="Asteroids - HTML5 Canvas and JavaScript game demo by Kevin Roast - an example of what can be achieved without a Flash plugin using the canvas 2D APIs" />
</head>
<body style="background-color: #000000">
<a href="https://github.com/edemaine/as-toroids"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://github-camo.global.ssl.fastly.net/e7bbb0521b397edbd5fe43e7f760759336b5e05f/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f677265656e5f3030373230302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_green_007200.png"></a>
<div class="button-overlay">
<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style addthis_32x32_style">
<a class="addthis_button_preferred_1"></a>
<a class="addthis_button_preferred_2"></a>
<a class="addthis_button_compact"></a>
<a class="addthis_counter addthis_bubble_style"></a>
</div>
<!-- AddThis Button END -->
</div>
<div class="wrapper">
<canvas class="box-shadow" id="canvas" width="640" height="640"></canvas>
<div class="info">
<div class="infopanel box-shadow">
<div class="title">As-Toroids</div>
<div class="settings">
<p class="left heading">Instructions:</p>
<p>Left and Right Arrows: Rotate ship</p>
<p>Up Arrow: Thrust</p>
<p>SPACE: Fire main weapon(s)</p>
<p>Z: Fire bomb weapon (area effect, uses energy)</p>
<p>Down Arrow or SHIFT: Shield (will recharge...)</p>
<p class="topology section">G: Increase genus (add handle)</p>
<p class="topology">F: Decrease genus (remove handle)</p>
<p class="highlight section">S: Enable or disable sound effects</p>
<p class="highlight">R: Switch between Modern and Retro graphics</p>
<p class="highlight">Escape: Pause the game</p>
</div>
<div id="results-wrapper" class="results-wrapper">
<div class="results" id="results"></div>
<div class="results"><a id="tweetlink" href="#" target="new">Tweet your high score...</a></div>
</div>
<div>
<p class="left section"><a href="./index-debug.html">As-Toroids DEBUG page</a> (cheats, etc.)</p>
</div>
<div>
<p class="left"><a href="asteroids-src.zip">Download JavaScript source code</a></p>
</div>
<div>
<p class="left"><a href="../index.html">HTML5 Canvas demos and experiments</a></p>
</div>
</div>
</div>
</div>
<div class="credits-wrapper">
<div class="credits box-shadow">
<p>
This game is a quick experiment to see what it's like to play the classic
video game
<a href="https://en.wikipedia.org/wiki/Asteroids_(video_game)">Asteroids</a>
on <b>higher-genus surfaces, beyond the usual torus</b>.
Regular Asteroids is played on a rectangular screen where anything flying off
the top side of the screen returns at the same coordinate on the bottom side of the screen, and similarly for the left and right sides. This usual
connectivity describes the
<a href="https://en.wikipedia.org/wiki/Torus#Flat_torus">flat torus</a>,
or genus 1. This game starts in that mode.
<p>
This game implements a more general boundary condition that defines a
<a href="https://en.wikipedia.org/wiki/Torus#Genus_g_surface">genus-<i>g</i>
orientable surface</a> for any <i>g</i> (not just 1): just press "G" to
increase genus, and "F" to decrease it again.
It all started when <a href="http://jeffe.cs.illinois.edu/">Jeff Erickson</a>
said (on June 20, 2019) "what we really need is Asteroids on a double torus"
along with his favorite
<a href="https://en.wikipedia.org/wiki/Surface_(topology)#Construction_from_polygons">fundamental polygon</a> for it.
An early version of this implementation emerged less than an hour later,
thanks to input from Erin Wolf Chambers, David Eppstein, and Jeff Erickson.
<p>
The code is a very light edit of the excellent
<a href="http://www.kevs3d.co.uk/dev/asteroid">Asteroids [Reloaded]</a>
developed by <a href="http://www.kevs3d.co.uk/">Kevin Roast</a>.
All credit for the gameplay, graphics, sound, etc. goes to him!
The main purpose of this experiment is as an educational tool
for teaching topology.
</div>
</div>
</body>
</html>