-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
219 lines (200 loc) · 5.88 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
<!DOCTYPE html>
<html>
<head>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap"
rel="stylesheet"
/>
<!-- The core Firebase JS SDK is always required and must be listed first -->
<script src="https://www.gstatic.com/firebasejs/8.7.0/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.6.8/firebase-firestore.js"></script>
<script>
// Your web app's Firebase configuration
var firebaseConfig = {
apiKey: "AIzaSyBONIU4eP_e_YKAaZX2T-NOjELBko2jSPQ",
authDomain: "hackathon-travelling-game.firebaseapp.com",
projectId: "hackathon-travelling-game",
storageBucket: "hackathon-travelling-game.appspot.com",
messagingSenderId: "171503770930",
appId: "1:171503770930:web:748ae99e0400d8ef474b2b",
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
var db = firebase.firestore();
</script>
<script src="highscores.js"></script>
<style>
html,
body {
margin: 0;
height: 100%;
}
* {
padding: 0;
margin: 0;
}
canvas {
background-image: url("images/background.png");
display: block;
margin: 0 auto;
}
p {
font-size: 1em;
}
body {
font-family: "Press Start 2P", cursive;
}
img {
display: none;
}
.life {
display: inline-block;
height: 30px;
width: 30px;
}
.stats {
display: flex;
justify-content: space-between;
padding: 5px;
height: 5%;
}
.instructions {
text-align: center;
padding: 10px;
}
.leaderboard {
text-align: center;
padding: 10px;
list-style: armenian;
}
.leaderboard-list {
list-style-position: inside;
display: table;
text-align: left;
margin: 0 auto;
}
.leaderboard-list > li:first-child {
color: gold;
}
.leaderboard-list > li:nth-child(2) {
color: silver;
}
.leaderboard-list > li:nth-child(3) {
color: #D0A766;
}
.start_screen {
margin-left: auto;
margin-right: auto;
left: 0;
right: 0;
position: absolute;
width: 800px;
background-color: blue;
height: 500px;
text-align: center;
padding-top: 10px;
color: cornsilk;
}
.high-score-input {
font-family: "Press Start 2P";
font-size: 30px;
height: 50px;
text-align: center;
margin-top: 10px;
background-color: #0000b2;
color: cornsilk;
}
.high-score-button {
font-family: "Press Start 2P";
font-size: 20px;
height: 40px;
margin-top: 10px;
background-color: chartreuse;
padding: 10px;
}
.game-title {
margin-top: 80px;
}
</style>
</head>
<body onload="getHighScores()">
<div class="stats">
<p id="time"></p>
<p id="score">Lives:</p>
</div>
<div id="startScreen" class="start_screen">
<h1>Globetrotter Game</h1>
<p class="game-title">See how long you can travel for</p>
<p class="game-title">Hit the space bar to START!</p>
</div>
<div id="endScreen" class="start_screen" style="display: none">
<h1>Game Over!</h1>
<p id="endMessage" class="game-title"></p>
<div id="high-score-submit">
<form onsubmit="submitHighScore(event)" style="margin-top: 10px">
<p style="margin-top: 10px">Enter name:</p>
<input
type="text"
class="high-score-input"
id="input_name"
name="input_name"
minlength="3"
maxlength="20"
autocomplete="off"
required
/><br />
<input
type="submit"
class="high-score-button"
value="Submit high score"
/>
</form>
</div>
<p id="submit-confirm" style="display:none; margin-top: 10px; color: gold">Submitted!</p>
<form onsubmit="reloadPage(event)" style="margin-top: 150px">
<input
type="submit"
class="high-score-button"
value="PLAY AGAIN"
/>
</form>
</div>
<canvas id="gameCanvas" width="1080" height="720"></canvas>
<div class="instructions">
<p>How to play:</p>
<br />
<p>
Travel the world safely, avoiding travel restrictions and getting the
vaccine.
</p>
</div>
<div class="leaderboard">
<p>Leaderboard:</p>
<br />
<ol id="leaderboard-list" class="leaderboard-list">
</ol>
</div>
<img id="explorer_1" src="images/sprite_walking_1.png" />
<img id="explorer_2" src="images/sprite_walking_2.png" />
<img id="explorer_explode" src="images/sprite_explode.png" />
<img id="enemy" src="images/no_entry.png" />
<img id="bonus" src="images/vaccine.png" />
<img id="road-marking" src="images/road-marking.png" />
<img id="palm-tree" src="images/palm-tree.png" />
<img id="empire" src="images/empire.png" />
<img id="big-ben" src="images/big-ben.png" />
<img id="hotel" src="images/hotel.png" />
<img id="eiffel-tower" src="images/eiffel_tower.png" />
<img id="volcano" src="images/volcano.png" />
<img id="rio_jesus" src="images/rio_jesus.png" />
<img id="car-rental" src="images/car-rental.png" />
<img id="pagode" src="images/japanese_pagode.png" />
<script src="sprite.js"></script>
<script src="enemy.js"></script>
<script src="bonus.js"></script>
<script src="scenery.js"></script>
<script src="script.js"></script>
</body>
</html>