-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathasteroids.html
209 lines (198 loc) · 5.05 KB
/
asteroids.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
<head>
<title>Space Blasters!</title>
</head>
<body>
<h1>
Space Blasters!
</h1>
{{> mainLobby }}
{{> modals}}
{{> singleLobby }}
{{> singleLeaderboard }}
{{> multiLobby }}
{{> multiLeaderboard }}
{{> existingGames }}
{{> gamePlay }}
<footer>
<h3>
Created by <a href="https://www.linkedin.com/in/samsweeney">Sam Sweeney</a>
</h3>
<h3>
View source code <a href="https://github.com/shubik22/Space-Blasters">here</a>
</h3>
</footer>
</body>
<template name="mainLobby">
{{#if show}}
{{#if username}}
<h2>Choose Mode</h2>
<div class="button single-player">
Single Player
</div>
<div class="button multiplayer">
Multiplayer (Beta)
</div>
{{else}}
<form class="name">
<div class="name-text">What's your name?</div>
<div class="name-input">
<input type="text" class="username">
<input type="submit" class="button set-name" value="Let's Go!">
</div>
</form>
{{/if}}
{{/if}}
</template>
<template name="modals">
<ul class="nav">
{{#if username}}
<li class="name">
Playing as {{username}}
</li>
{{/if}}
<li class="link instructions">
How to Play
</li>
<li class="link about">
About
</li>
</ul>
<div class="modal about hidden">
<div class="modal-screen"></div>
<div class="modal-content info">
<h3>About Space Blasters</h3>
<div>
Space Blasters is a take on the classic arcade game Asteroids. It was built with <a href="https://www.meteor.com/">Meteor</a> by <a href="https://www.linkedin.com/in/samsweeney">Sam Sweeney</a>.
</div>
<div>
You can check out the source code on Github <a href="https://github.com/shubik22/Space-Blasters">here</a> (if you're into that kind of thing...) or contact me <a href="mailto:[email protected]">here</a>.
</div>
</div>
</div>
<div class="modal instructions hidden">
<div class="modal-screen"></div>
<div class="modal-content how-to-play">
<h3>Objective</h3>
<div>Shoot the asteroids! As fast as you can!</div>
<h3>Scoring</h3>
<div>
<strong>Single Player:</strong> Your score will be the amount of time it takes you to clear all of the asteroids.
</div>
<div>
<strong>Multiplayer:</strong> Your score will be the number of asteroids you hit plus the number of times you hit your opponent minus the number of times your opponent hits you.
</div>
<h3>Controls</h3>
<table>
<tr>
<td>
<strong>←</strong>: Rotate left
</td>
<td>
<strong>→</strong>: Rotate right
</td>
</tr>
<tr>
<td>
<strong>↑</strong>: Accelerate
</td>
<td>
<strong>↓</strong>: Decelerate
</td>
</tr>
</table>
<div class="spacebar">
<strong>Spacebar</strong>: Shoot
</div>
</div>
</div>
</template>
<template name="singleLobby">
{{#if show}}
<h2>Single Player</h2>
<div class="button new-game">
New Game
</div>
<div class="button leaderboard">
Leaderboard
</div>
<div class="button back">
Back
</div>
{{/if}}
</template>
<template name="singleLeaderboard">
{{#if show}}
<h2>Single Player Leaderboard</h2>
<ol class="leaderboard">
{{#each records}}
<li>{{username}} (score: {{score}})</li>
{{/each}}
</ol>
<div class="button back">
Back
</div>
{{/if}}
</template>
<template name="multiLobby">
{{#if show}}
<h2>Multiplayer</h2>
<div class="button new-game">
New Game
</div>
<div class="button existing-games">
Existing Games
</div>
<div class="button leaderboard">
Leaderboard
</div>
<div class="button back">
Back
</div>
{{/if}}
</template>
<template name="existingGames">
{{#if show}}
<h2>Existing Games</h2>
{{#if gamesExist}}
<ul class="existing-games">
{{#each games}}
<li class="join-game" id="{{_id}}">Play against {{opponent}}</li>
{{/each}}
</ul>
{{else}}
<h3 class="no-games">
Sorry, there aren't any available games currently. Start a new one!
</h3>
{{/if}}
<div class="button back">
Back
</div>
{{/if}}
</template>
<template name="multiLeaderboard">
{{#if show}}
<h2>Multiplayer Leaderboard</h2>
<ol class="leaderboard">
{{#each records}}
<li>{{username}} (score: {{score}}, opponent: {{opponent}})</li>
{{/each}}
</ol>
<div class="button back">
Back
</div>
{{/if}}
</template>
<template name="gamePlay">
{{#if show}}
<canvas height="600" width="600"></canvas>
{{#if opponent}}
<div class="game-info">
<div>You are playing against {{opponent.username}}.</div>
<div>Your ship is <span class="{{color}}">{{color}}</span>.</div>
</div>
{{/if}}
<div class="button lobby">
Leave Game
</div>
{{/if}}
</template>