-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
executable file
·328 lines (248 loc) · 9.19 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
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
<!DOCTYPE html>
<html>
<head>
<title>Space Invaders</title>
<link rel="stylesheet" type="text/css" href="css/core.css">
<link rel="stylesheet" type="text/css" href="css/typeography.css">
<!-- Leapmotion Stuff -->
<!-- <script src="http://js.leapmotion.com/leap-0.4.1.js"></script> -->
<!-- Add local version -->
<script src = "js/leap.js"></script>
<link rel="icon"
type="image/png"
href="favicon.ico">
<style>
/* Styling needed for a fullscreen canvas and no scrollbars. */
body, html {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
overflow: hidden;
}
#starfield {
width:100%;
height:100%;
z-index: -1;
position: absolute;
left: 0px;
top: 0px;
}
#gamecontainer {
width: 800px;
margin-left: auto;
margin-right: auto;
border: solid 10px white ;
margin-top:3%;
background-color: rgba(200, 255, 200, 0.3);
}
#gamecanvas {
width: 800px;
height: 600px;
}
#info {
width: 800px;
margin-left: auto;
margin-right: auto;
}
.invisible {
display: none;
}
.pbjleft {
float: left;
}
.leapenabledImage {
border: 10px solid white;
border-radius: 3px;
}
.leapenabledImage:hover {
border: 2px solid white;
border-radius: 1px;
box-shadow: 0 0 10px blue;
}
.pbjright {
outline: 0;
float: right;
margin-top: 4%;
margin-right: 1.5%;
border: none;
height: 30%;
padding: 4%;
font-family: Arial;
color: white;
font-size: 160%;
border-radius: 7px;
background-color: rgba(255, 40, 40, 0.5);
border: 7px solid white;
box-shadow: 0 0 70px white;
}
.pbjright img {
height: 80px;
}
.pbjright:hover {
outline: 0;
color: rgba(255, 40, 40, 0.6);
background-color: rgba(255, 40, 40, .9);
border: 7px solid rgba(255, 40, 40, 1);
box-shadow: 0 0 70px rgba(255, 40, 40, 1);
}
.pbjright:active {
color: rgba(255, 40, 40, 0.6);
background-color: rgba(255, 40, 40, 0.7);;
border: 7px solid rgba(255, 40, 40, 0.7);
}
.rules {
width: 15%;
background-color: rgba(255, 255, 255, 0.7);
height: 55%;
margin-left: 2%;
border-radius: 5px;
float: left;
position: absolute;
margin-top: 19%;
text-align: center;
color: black;
font-family: Century Gothic;
}
.credits {
width: 15%;
background-color: rgba(255, 255, 255, 0.7);
height: 55%;
margin-right: 2%;
margin-left: 84%;
border-radius: 5px;
position: absolute;
margin-top: 19%;
text-align: center;
color: black;
font-family: Century Gothic;
}
.title {
text-align: center;
font-size: 500%;
color: white;
margin-top: 3%;
}
#loadingPageCover {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index:99;
background-color: black;
}
.centeredImage {
margin-left: 35%;
height: 200px;
width: 200px;
margin-top:15%;
}
.centeredImage > img {
width:200%;
}
#parent {
}
</style>
</head>
<body>
<img class = "pbjleft" src="img/pbj.gif">
<button id = "shuffleButton" onClick="shuffle();" class = "pbjright"> <img src="img/shuffleWhite.png"> </button>
<div class = "title"> Space Leap Invaders </div>
<!-- Loading page -->
<div id = "parent">
<div id="loadingPageCover">
<div class="centeredImage">
<img class = "largerBetterGiffer" src="loading.gif">
</div>
</div>
</div>
<div class = "rules">
<h2> How to play: </h2>
<a href = "http://www.leapmotion.com">
<img src="img/leap_enabled.jpg"class = "leapenabledImage" width = "60%">
</a>
<h4> Wave hands over leap horizontally and pretend to tap air with pointer finger </h4>
<h2> OR </h2>
<h4> WASD and Space Bar </h4>
<h2> OR </h2>
<h4> A combination of both </h4>
</div>
<div class = "credits">
<h2> Credits: </h2>
<h4> Original Code: </h4>
<h6> <a href="http://bit.ly/1f2RyK9"> http://bit.ly/1f2RyK9 </a> </h6>
<h4> Motivation Credits: </h4>
<h6> <a href="http://www.pennapps.com"> PennApps </a> and <a href="http://www.leapmotion.com"> Leapmotion </a> </h6>
<h4> Image Credits: </h4>
<h6> Sprite Sheet: <a href = "http://fontvir.us/x/invaders.gif"> Fontvir </a>
Peanut Butter Jelly Time: <a href = "http://knowyourmeme.com/memes/peanut-butter-jelly-time"> GIF </a> </h6>
<h5> Created by </h5> <h4> Aakash Adesara </h4>
</div>
<div id="starfield"></div>
<div id="gamecontainer">
<canvas id="gameCanvas"></canvas>
<img id="ship" src="img/ship.png" class = "invisible"/>
<img id="monster11" src="img/monster11.png" class = "invisible"/>
<img id="monster12" src="img/monster12.png" class = "invisible" />
<img id="monster21" src="img/monster21.png" class = "invisible"/>
<img id="monster22" src="img/monster22.png" class = "invisible" />
</div>
<div id="info">
<!-- PUT INFO HERE -->
</div>
<script src="js/starfield.js"></script>
<script src="js/spaceinvaders.js"></script>
<script>
// Create the starfield.
var container = document.getElementById('starfield');
var starfield = new Starfield();
starfield.initialise(container);
starfield.start();
// Setup the canvas.
var canvas = document.getElementById("gameCanvas");
canvas.width = 800;
canvas.height = 600;
// Create the game.
var game = new Game();
// Initialise it with the game canvas.
game.initialise(canvas);
// Start the game.
game.start();
// Listen for keyboard events.
window.addEventListener("keydown", function keydown(e) {
var keycode = e.which || window.event.keycode;
// Supress further processing of left/right/space (37/29/32)
if(keycode == 37 || keycode == 39 || keycode == 32) {
e.preventDefault();
}
game.keyDown(keycode);
});
window.addEventListener("keyup", function keydown(e) {
var keycode = e.which || window.event.keycode;
game.keyUp(keycode);
});
function toggleMute() {
game.mute();
document.getElementById("muteLink").innerText = game.sounds.mute ? "unmute" : "mute";
}
</script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-41728580-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<script type="text/javascript">
var child = document.getElementById("loadingPageCover");
var parent = document.getElementById("parent");
child.addEventListener('click', function() { /* do stuff here*/
parent.removeChild(child);
}, false);
</script>
</body>
</html>