-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
318 lines (286 loc) · 13.2 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
<!DOCTYPE html>
<html>
<head>
<link rel="shortcut icon" type="image/x-icon" href="https://images5.alphacoders.com/859/859417.jpg">
<link rel="shortcut icon" type="image/x-icon" href="https://images6.alphacoders.com/103/1033709.jpg">
<link rel="shortcut icon" type="image/x-icon" href="https://images4.alphacoders.com/102/1029460.jpg">
<link rel="shortcut icon" type="image/x-icon" href="https://images4.alphacoders.com/706/706163.jpg">
<link rel="shortcut icon" type="image/x-icon" href="https://images4.alphacoders.com/556/556993.jpg">
<link rel="shortcut icon" type="image/x-icon" href="https://images.pling.com/img/00/00/63/00/40/1662284/747f5fe2a9f88f827009192082476067f10bfe1cf8dc59f69896fdde527647228d94.jpg">
<meta charset="UTF-8">
<title>Space Invaders Game</title>
<link rel="stylesheet" type="text/css" href="Styling/home.css" />
<link rel="stylesheet" type="text/css" href="Styling/navigation.css" />
<link rel="stylesheet" type="text/css" href="Styling/footer.css" />
<link rel="stylesheet" type="text/css" href="Styling/login.css" />
<link rel="stylesheet" type="text/css" href="Styling/register.css" />
<link rel="stylesheet" type="text/css" href="Styling/config.css" />
<link rel="stylesheet" type="text/css" href="Styling/game.css" />
<link rel="stylesheet" type="text/css" href="Styling/about.css" />
<link rel="stylesheet" type="text/css" href="Styling/login_pop_up.css" />
<link rel="stylesheet" type="text/css" href="Styling/register_pop_up.css" />
<link rel="stylesheet" type="text/css" href="Styling/end_game_pop_up.css" />
<link rel="stylesheet" type="text/css" href="Styling/endGame.css" />
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ENjdO4Dr2bkBIFxQpeoTz1HIcje39Wm4jDKdf19U8gI4ddQ3GYNS7NTKfAdVQSZe" crossorigin="anonymous"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
</head>
<body>
<div id="game_logo">
<header>
<img class="logo_picture" src="https://images8.alphacoders.com/829/829758.jpg">
<div class="names">
<h1 id="nams">
<br/>
Saar Buium- 208994616
<br/>
Lior Mishutin- 314968306
</h1>
</div>
</header>
</div>
<button id="welcome_login_button">Login</button>
<button id="welcome_register_button">Sign up</button>
<nav>
<div class="navigation_logo">
<p>Guardians of the galaxy game</p>
</div>
<ul>
<li><a href="#" id="homeButton">Home</a></li>
<li><a href="#" id="loginButton">Login</a></li>
<li><a href="#" id="registerButton">New player?</a></li>
<li><a href="#" id="aboutButton">About us</a></li>
</ul>
</nav>
<div id="aboutDiv" style="display: none;">
<h1>About Us</h1>
<h3>Creators: Saar Buium & Lior Mishutin</h3>
<p>
Welcome to Guardians of the Galaxy game! We are a group of superhero protectors of the universe.
<br/>
</p>
<p>
In our game the player can select a hero to fight with and the difficulty level of his enemies.
<br/>
We added the functionality of moving and shooting diagonally.
<br/>
JQuery was used for certain functionalities in the game.
</p>
<br/>
<p>
We faced some challenges while developing the game.
<br/>
First is the switching between screens and hiding the others.
<br/>
Second is controlling the game elements when pausing or stopping the game and resuming from the same point.
<br/>
</p>
<button id="closeButton">Close</button>
</div>
<div id="gameDiv" style="display: none;">
<p id="scoreParaElement">
<span>Score:</span>
<span id="ScoreText" style="margin-right: 2vh;">0</span>
<span>Time Left:</span>
<span id="TimeText" style="margin-right: 2vh;">0</span>
<span>Player Lives Left:</span>
<span id="LivesText"> </span>
<button id="restart_game_button">Restart Game</button>
</p>
<canvas id="gameCanvas"></canvas>
</div>
<audio id="game_audio" src="Audio/audio1.mp3" preload="auto" loop></audio>
<audio id="player_dead_audio" src="Audio/player_dead.mp3" preload="auto" loop></audio>
<audio id="enemy_dead_audio" src="Audio/enemy_dead.mp3" preload="auto" loop></audio>
<div id="endGameDiv" style="display: none;">
<h1>Play to see your scores</h1>
<br/>
<h2>My Scores</h2>
<div id="scores"></div>
<button id="restartBtn">Restart Game</button>
<button id="changeConfigBtn">Back to Game Settings</button>
<button id="exitBtn">Exit Game</button>
</div>
<div id="end_game_pop_up" style="display: none;">
<h1>Are you sure you want to finish the game?</h1>
<br/>
<button id="end_game_pop_up_continue_button">Continue</button>
<br/>
<button id="end_game_pop_up_cancel_button">Cancel</button>
</div>
<div class="center_login" id="loginDiv" style="display: none;">
<h1>Welcome To Space! <br/>Please Login</h1>
<form method="post" id="login_form" onsubmit="return false">
<div class="txt_field">
<input type="text" id="loginUsername" required>
<span></span>
<label>Username</label>
</div>
<div class="txt_field">
<input type="password" autocomplete="off" id="loginPassword" required>
<span></span>
<label>Password</label>
</div>
<input type="submit" id="loginSubmit" value="Login">
</form>
</div>
<div id="login_pop_up" style="display: none;">
<h1>Successfully Logged In</h1>
<br/>
<h3>Welcome to Guardians of the Galaxy game!</h3>
<br/>
<button id="login_pop_up_continue_button">Continue</button>
</div>
<div class="center_register" id="registerDiv" style="display: none;">
<h1>Register</h1>
<form method="post" id="register_form" onsubmit="return false">
<div class="txt_field">
<input type="text" required pattern="^[a-zA-Z\s]*$" title="Please enter a correct name with alphabets.">
<span></span>
<label>First Name</label>
</div>
<div class="txt_field">
<input type="text" required pattern="^[a-zA-Z\s]*$" title="Please enter a correct name with alphabets.">
<span></span>
<label>Last Name</label>
</div>
<div class="txt_field">
<input type="email" id="registerEmail" required pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}$" title="Please enter a correct Email address as: abc@mail.com">
<span></span>
<label>Email</label>
</div>
<div class="txt_field">
<input type="date" required>
<span></span>
<label></label>
</div>
<div class="txt_field">
<input type="text" id="registerUsername" required>
<span></span>
<label>Username</label>
</div>
<div class="txt_field">
<input type="password" autocomplete="off" id="registerPassword" required pattern="^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,}$" title="Please enter a password with at least 8 characters including at least one letter and one number.">
<span></span>
<label>Password</label>
</div>
<div class="txt_field">
<input type="password" autocomplete="off" id="repeat-password" required>
<span></span>
<label>Confirm Password</label>
</div>
<input type="submit" id="registerSubmit" value="Submit">
</form>
</div>
<div id="register_pop_up" style="display: none;">
<h1>Successfully Registered</h1>
<br/>
<h3>Please login and start playing.</h3>
<br/>
<button id="register_pop_up_continue_button">Continue</button>
</div>
<div class="center_config" id="configDiv" style="display: none;">
<h1>Configure The Game</h1>
<form method="post" id="configForm" onsubmit="return false">
<div class="txt_field">
<input type="text" autocomplete="off" id="fireButtonInput" name="fireButtonInput" maxlength="1" pattern="[A-Za-z\s]" required value="s">
<span></span>
<label id="fireButton_text">Choose a button to fire at enemies:</label>
</div>
<div class="txt_field">
<input type="number" autocomplete="off" id="timeLimit" name="timeLimit" min="2" max="20" required value="5">
<span></span>
<label id="timeLimit_text">Choose game time limit (minimum 2 minutes):</label>
</div>
<div class="selector">
<div id="selectField">
<p id="selectText">Select Your Player</p>
<img src="Images/arrow.png" id="arrowIcon">
</div>
<ul id="list" class="hide">
<li class="options">
<img src="Images/player1.png">
<p>Star Lord</p>
</li>
<li class="options">
<img src="Images/player2.png">
<p>Rocket Raccoon</p>
</li>
<li class="options">
<img src="Images/player3.png">
<p>Groot</p>
</li>
</ul>
<div id="selectField_level">
<p id="selectText_level">Game Level</p>
<img src="Images/arrow.png" id="arrowIcon_level">
</div>
<ul id="list_level" class="hide">
<li class="options_level">
<p>Easy</p>
</li>
<li class="options_level">
<p>Normal</p>
</li>
<li class="options_level">
<p>Hard</p>
</li>
</ul>
</div>
<input type="submit" id="startGameButton" value="Start Game">
</form>
</div>
<script>
var selectField = document.getElementById("selectField")
var selectText = document.getElementById("selectText")
var options = document.getElementsByClassName("options")
var list = document.getElementById("list")
var arrowIcon = document.getElementById("arrowIcon")
selectField.onclick = function(){
list.classList.toggle("hide")
arrowIcon.classList.toggle("rotate")
}
for (option of options){
option.onclick = function(){
selectText.innerHTML = this.textContent;
list.classList.toggle("hide")
arrowIcon.classList.toggle("rotate")
}
}
</script>
<script>
var selectField_level = document.getElementById("selectField_level")
var selectText_level = document.getElementById("selectText_level")
var options_level = document.getElementsByClassName("options_level")
var list_level = document.getElementById("list_level")
var arrowIcon_level = document.getElementById("arrowIcon_level")
selectField_level.onclick = function(){
list_level.classList.toggle("hide")
arrowIcon_level.classList.toggle("rotate")
}
for (option of options_level){
option.onclick = function(){
selectText_level.innerHTML = this.textContent;
list_level.classList.toggle("hide")
arrowIcon_level.classList.toggle("rotate")
}
}
</script>
<footer id="footer" class="footer">
<div class="container">
<ul class="social-icons">
<label>Contact Lior :</label>
<li><a href="https://www.facebook.com/lior.mish" target="_blank" title="Lior's Facebook"><img src="Images/facebook-icon.png" alt="Facebook"></a></li>
<li><a href="https://www.instagram.com/mishutinlior/" target="_blank" title="Lior's Instegram"><img src="Images/instegram-icon.png" alt="Instagram"></a></li>
<li><a href="https://www.linkedin.com/in/lior-mishutin-94a2021a9/" target="_blank" title="Lior's Linkedin"><img src="Images/linkedin-icon.png" alt="LinkedIn"></a></li>
<label> Contact Saar :</label>
<li><a href="https://www.facebook.com/SaarBuium" target="_blank" title="Saar's Facebook"><img src="Images/facebook-icon.png" alt="Facebook"></a></li>
<li><a href="https://www.instagram.com/saarbuium/" target="_blank" title="Saar's Instegram"><img src="Images/instegram-icon.png" alt="Instagram"></a></li>
<li><a href="https://www.linkedin.com/in/saar-buium-0825a2167/" target="_blank" title="Saar's Linkedin"><img src="Images/linkedin-icon.png" alt="LinkedIn"></a></li>
</ul>
</div>
</footer>
<script src="config.js"></script>
<script src="management.js"></script>
<script src="spacewars.js"></script>
</body>
</html>