-
Notifications
You must be signed in to change notification settings - Fork 0
/
game.html
165 lines (149 loc) · 5.18 KB
/
game.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Task 2</title>
<link rel="stylesheet" href="app.css">
<link rel="stylesheet" href="styles.css">
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f0f0f0;
}
.dialog {
display: none;
position: fixed;
top: 10%;
left: 10%;
width: 80%;
height: 80%;
background: white;
padding: 20px;
border: 1px solid #ccc;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
z-index: 1000;
display: flex;
flex-direction: column;
justify-content: space-around;
align-items: center;
text-align: center;
font-size: 30px;
border-radius: 8px;
overflow: auto;
}
.dialog button {
margin-top: 10px;
padding: 10px 20px;
cursor: pointer;
background-color: #007BFF;
color: white;
border: none;
border-radius: 5px;
transition: background-color 0.3s ease, transform 0.3s ease;
}
.dialog button:hover {
background-color: #0056b3;
transform: scale(1.05);
}
.overlay {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.5);
z-index: 999;
}
canvas {
border: 1px solid black;
display: block;
margin: 20px auto;
}
.leaderboard {
text-align: left;
margin-top: 20px;
}
.leaderboard h3 {
margin-bottom: 10px;
}
.leaderboard ul {
list-style: none;
padding: 0;
}
.leaderboard ul li {
padding: 5px 0;
border-bottom: 1px solid #ccc;
}
</style>
</head>
<body>
<div class="overlay" id="overlay"></div>
<div class="dialog" id="startDialog">
<h2 style="color:red">Last Stand</h2>
<p>Welcome to Last Stand where there is one and only one goal,</p>
<p style="color:red">KILL AND DON'T GET KILLED</p>
<p>Survive again a horde of zombies as long as you can.The captain has equipped you with some
basic supplies to defend yourself but at the end of the day, it is up to you.
</p>
<p>Lucky for you, there is an inventory spacecraft right above you where you can purchase powerups in the middle of the fight</p>
<p style="color:red">YOU ARE HUMANITY'S LAST HOPE, DON'T LET US DOWN, WE ARE COUNTING ON YOU!!!</p>
<button onclick="startGame()">Instructions</button>
</div>
<div class="dialog" id="instructionsDialog" style="display:none">
<h2 style="color:red">Instructions</h2>
<h3>Movement</h3>
<p>A:Left   D:Right   Spacebar:Jump</p>
<h3>JetPack</h3>
<p>W:To fly   S:Fall back</p>
<h3>Inventory</h3>
<p>I:Open Inventory, <span style="color:red">Beware:It can be opened only during the preparatory phase</span></p>
<h3>Powerups</h3>
<p>P:Open Powerups, <span style="color:red">Beware:They are not FREE!!!</span></p>
<h3>Weaponserups</h3>
<p>There are 3 weapons.1:</span></p>
<button onclick="closeInstructions()">Start Game</button>
</div>
<div class="dialog" id="gameOverDialog" style="display:none">
<h2>Game Over</h2>
<p>Thanks for playing! Click the button below to restart.</p>
<button onclick="restartGame()">Restart Game</button>
<div class="leaderboard">
<h3>Leaderboard</h3>
<ul id="leaderboardList">
</ul>
</div>
</div>
<div class="dialog" id="inventoryDialog" style="display:none">
<div class="dialog-content">
<h2>Inventory</h2>
<div class="inventory-section">
<h3>Potions</h3>
<div class="inventory-buttons">
<button class="inventory-item">Mines</button>
<button class="inventory-item">Traps</button>
<button class="inventory-item">Blocks</button>
</div>
</div>
<div class="inventory-section">
<h3>Towers</h3>
<div class="inventory-buttons">
<button class="inventory-item">Tower 1</button>
<button class="inventory-item">Tower 2</button>
<button class="inventory-item">Tower 3</button>
</div>
</div>
<br>
<div class="inventory-section">
<button class="inventory-item">Close</button>
</div>
</div>
</div>
<canvas id="canvas" width="800" height="600"></canvas>
<script src="classes.js"></script>
<script src="app.js"></script>
</body>
</html>