-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
281 lines (246 loc) · 9.37 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
<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Sifo Adventure</title>
<link rel="stylesheet" type="text/css" href="Style-Sheets/JS_game.css">
<link rel="stylesheet" type="text/css" href="Style-Sheets/InstructionsModal.css">
<link rel="stylesheet" type="text/css" href="Style-Sheets/GameOverModal.css">
<link rel="stylesheet" type="text/css" href="Style-Sheets/GameCompleteModal.css">
<link href="https://fonts.googleapis.com/css?family=Share+Tech+Mono" rel="stylesheet">
<!--Main game script-->
<script type="text/javascript" src="Game.js"></script>
</head>
<!--On page load call showInstructions method-->
<body onload="showInstructions()" onkeydown="KeyDown(event)" onkeyup="KeyUp(event)" ondragend="onMouseUp()">
<!-- Banner -->
<img id="banner" src="Pictures/logo_game.png">
<!--Audio elements-->
<audio id="bgm" style="display: none" controls>
<source src="Audio/game_msc.mp3" type="audio/mp3">
Your browser does not support the audio element.
</audio>
<audio id="jump" style="display: none" controls>
<source src="Audio/jump.mp3" type="audio/mp3">
Your browser does not support the audio element.
</audio>
<audio id="coinpickup" style="display: none" controls>
<source src="Audio/coin.mp3" type="audio/mp3">
Your browser does not support the audio element.
</audio>
<audio id="gameover" style="display: none" controls>
<source src="Audio/over_game.mp3" type="audio/mp3">
Your browser does not support the audio element.
</audio>
<audio id="gamewon" style="display: none" controls>
<source src="Audio/win.wav" type="audio/wav">
Your browser does not support the audio element.
</audio>
<audio id="enemykilled" style="display: none" controls>
<source src="Audio/enemy.mp3" type="audio/mp3">
Your browser does not support the audio element.
</audio>
<!--Restart button on game page-->
<canvas id="canvas" width=300 height=300></canvas>
<!--button id="restartButtonNearScore" class="button" onClick="restartGame()">
<img class="buttonImages" src="Pictures/restart.png" alt="RestartButton" />
</button-->
<div id="instructionsModal" class="modal">
<div class="modal-content">
<h3>Intruksi</h3>
<p>Bagaimana cara bermain:</p>
<ul>
<li>Selesaikan setiap level dengan menghindari musuh</li>
<li>Kalahkan musuh dengan melompati mereka</li>
<li>Mengalahkan musuh dapat memberikan poin</li>
</ul>
<p>Kontrol:</p>
<ul>
<li>Tombol pada layar</li>
<li>Panah keyboard dan WASD: Bergerak ke kiri dan kanan, melompat, dan menunduk</li>
<li>Tekan 'p' untuk menjeda permainan</li>
<li>Tekan 'm' untuk beralih musik</li>
<li>Tekan 'Spasi' untuk memulai ulang permainan</li>
</ul>
<!--Play button-->
<div class="startButton">
<img class="buttonImages" src="Pictures/play.png" width="100%" onClick="initialize_game()" alt="PlayButton" />
</div>
</div>
</div>
<div id="gameOverModal" class="modal">
<div class="modal-content">
<img class="gameOverLabel" src="Pictures/game_over.png" alt="GAME OVER">
<p class="gameOverDesc">Press RESTART button or Space to restart the game.</p>
<div class="restartButton">
<img class="buttonImages" src="Pictures/restart.png" width="100%" onClick="initialize_game()" alt="RestartButton" />
</div>
</div>
</div>
<div id="gameCompleteModal" class="modal">
<div class="modal-content">
<img class="gameOverLabel" src="Pictures/victory.png" alt="VICTORY">
<p class="gameOverDesc">You completed the game! Awesome Work!</p>
<div class="restartButton">
<img src="Pictures/restart.png" width="100%" onClick="initialize_game()" alt="RestartButton" />
</div>
</div>
</div>
<div id="gamePauseModal" class="modal">
<p class="gamePause">You paused the game!</p>
<p class="gamePlayPause">Press p to play</p>
<div class="resumeButton">
<img class="button" src="Pictures/resume.png" width="100%" onClick="pauseGame()" alt="ResumeGame" />
</div>
</div>
<div id="optionsModal" class="modal">
<div class="modal-content">
<div class="gameOptions"><h2>OPTIONS</h2></div>
<div class="mess">
<label id="mess"></label>
</div>
<div class="row">
<div class="col-25">
<label for="Up1">Up</label>
</div>
<div class="col-75">
<input type="text" id="UP" name="up1Key" value="Up" onclick="dispMess('UP','UP')" readonly>
</div>
</div>
<div class="row">
<div class="col-25">
<label for="Down1">Down</label>
</div>
<div class="col-75">
<input type="text" id="DOWN" name="down1Key" value="Down" onclick="dispMess('DOWN','DOWN')" readonly>
</div>
</div>
<div class="row">
<div class="col-25">
<label for="Left1">Left</label>
</div>
<div class="col-75">
<input type="text" id="LEFT" name="left1Key" value="Left" onclick="dispMess('LEFT','LEFT')" readonly>
</div>
</div>
<div class="row">
<div class="col-25">
<label for="Right1">Right</label>
</div>
<div class="col-75">
<input type="text" id="RIGHT" name="Right1Key" value="Right" onclick="dispMess('RIGHT','RIGHT')" readonly>
</div>
</div>
<div class="row">
<div class="col-25">
<label for="Up2">Up (Alt.)</label>
</div>
<div class="col-75">
<input type="text" id="W" name="wKey" value="W" onclick="dispMess('W','UP')" readonly>
</div>
</div>
<div class="row">
<div class="col-25">
<label for="Down2">Down (Alt.)</label>
</div>
<div class="col-75">
<input type="text" id="S" name="sKey" value="S" onclick="dispMess('S','DOWN')" readonly>
</div>
</div>
<div class="row">
<div class="col-25">
<label for="Left2">Left (Alt.)</label>
</div>
<div class="col-75">
<input type="text" id="A" name="left2Key" value="A" onclick="dispMess('A','LEFT')" readonly>
</div>
</div>
<div class="row">
<div class="col-25">
<label for="Right2">Right (Alt.)</label>
</div>
<div class="col-75">
<input type="text" id="D" name="Right2Key" value="D" onclick="dispMess('D','RIGHT')" readonly>
</div>
</div>
<div class="row">
<div class="col-25">
<label for="Restart">Restart</label>
</div>
<div class="col-75">
<input type="text" id="SPACE" name="SpaceKey" value="Space" onclick="dispMess('SPACE','SPACE')" readonly>
</div>
</div>
<div class="row">
<div class="col-25">
<label for="Pause">Pause</label>
</div>
<div class="col-75">
<input type="text" id="P" name="PauseKey" value="P" onclick="dispMess('P','PAUSE')" readonly>
</div>
</div>
<div class="row">
<div class="col-25">
<label for="Sound">Sound</label>
</div>
<div class="col-75">
<input type="text" id="M" name="SoundKey" value="M" onclick="dispMess('M','SND')" readonly>
</div>
</div>
<div class="row">
<div class="col-25">
<label ><img class="Sound" src="Pictures/audioOn.png" alt="OptionGame" onclick="dispMess('M','SOUND')" id="MImg"></label>
</div>
<div class="col-75">
<button class="button" id="buttonOptions" onClick="gameOptions()">
<img class="back" src="Pictures/Backbtn.png" alt="OptionGame">
</button>
</div>
</div>
</div>
</div>
<div id="levelTransitionModal" class="modal">
<div id="levelTransitionModalContent" class="modal-content">
<img class="gameOverLabel" src="Pictures/victory.png" alt="VICTORY">
<p class="levelTransitionMessage">Level complete!</p>
<p class="levelTransitionMessage">Press c to continue</p>
<div class="resumeButton">
<img class="button" src="Pictures/resume.png" width="100%" onClick="resumeGame()" alt="ResumeGame" />
</div>
</div>
</div>
<!--Game play buttons-->
<div id="buttonWrapper">
<div id="buttonRestart">
<button id="restartButtonLeft" class="button" onClick="restartGame()">
<img class="buttonImages" src="Pictures/restart.png" alt="RestartButton" />
</button>
</div>
<div id="buttonController">
<button class="button" onmousedown="moveLeftMouse()" onmouseup="onMouseUp()" ontouchstart="moveLeftMouse()" ontouchend="onMouseUp()">
<img class="buttonImages" src="Pictures/left.png" alt="LEFT">
</button>
<button class="button" onmousedown="moveUp()" ontouchstart="moveUp()">
<img class="buttonImages" src="Pictures/jump.png" alt="JUMP">
</button>
<button class="button" onmousedown="duck()" onmouseup="duckMouseUp()" ontouchstart="duck()" ontouchend="duckMouseUp()">
<img class="buttonImages" src="Pictures/duck.png" alt="DUCK">
</button>
<button class="button" onmousedown="moveRightMouse()" onmouseup="onMouseUp()" ontouchstart="moveRightMouse()" ontouchend="onMouseUp()">
<img class="buttonImages" src="Pictures/right.png" alt="RIGHT">
</button>
</div>
<div id="buttonPauseAudio">
<button class="button" id="buttonAudio" onClick="muteMusic()" >
<img class="buttonImages" id="audioButton" src="Pictures/audioOn.png" alt="MuteMusic">
</button>
<button class="button" id="buttonPause" onClick="pauseGame()">
<img class="buttonImages" src="Pictures/pause.png" alt="PauseGame">
</button>
<button class="button" id="buttonOptions" onClick="gameOptions()">
<img class="buttonImages" src="Pictures/Settingsbtn.png" alt="OptionGame">
</button>
</div>
</div>
</body>
</html>