-
Notifications
You must be signed in to change notification settings - Fork 0
/
howplay.html
244 lines (215 loc) · 10.7 KB
/
howplay.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
<!--Karina Shannon X23216760 & Ruth Woods X23174382-->
<!--sources, google, youtube, NCI notes-->
<!--Images = https://unsplash.com/s/photos/cakes-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Welcome to Naturally Sweet</title>
<!-- Meta Tags for SEO -->
<meta name="description" content="Naturally Sweet - Delicious Vegan Treats for Everyone">
<meta property="og:title" content="Welcome to Naturally Sweet">
<meta property="og:description" content="Explore a variety of vegan bakery delights from Naturally Sweet">
<meta property="og:image" content="path/to/image.jpg">
<meta property="og:type" content="website">
<meta property="og:url" content="http://www.naturallysweet.com">
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<!-- Font Awesome CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" integrity="sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<!-- Custom CSS -->
<link href="style.css" rel="stylesheet">
</head>
<body>
<!-- Header Section from index.html -->
<header class="custom-header py-3">
<div class="container">
<div class="row align-items-center">
<div class="col-md-4">
<div class="logo">
<h1 class="mb-1"><i class="fa-solid fa-cake-candles"></i> Naturally Sweet</h1>
</div>
</div>
<div class="col-md-8 text-md-end">
<nav>
<ul class="list-inline mb-0">
<li class="list-inline-item"><a href="index.html"><i class="fa-solid fa-cake-candles"></i> Home</a></li>
<li class="list-inline-item"><a href="makecake.html"><i class="fa-solid fa-wand-magic-sparkles"></i> Make your cake</a></li>
<li class="list-inline-item" style="color: gray;"><i class="fa-solid fa-kitchen-set"></i> How to Play</li>
<li class="list-inline-item"><a href="game.html"><i class="fa-solid fa-burst"></i> Game</a></li>
<li class="list-inline-item"><a href="cart.html"><i class="fa-solid fa-bag-shopping"></i> cart</a></li>
</ul>
</nav>
</div>
</div>
</div>
</header>
<main>
<div class="container mt-5">
<div class="welcome-text-container">
<h1 class="text-center mb-4">How to Play Cake Catching</h1>
</div>
<div class="mb-3">
<h2>Objective</h2>
<p>Catch as many cakes as possible before the timer runs out!</p>
</div>
<div class="mb-3">
<h2>Gameplay</h2>
<table class="table">
<tbody>
<tr>
<td>
<div class="cake" style="
background-image: url('flaticon/007-roll-cake-1.png');
animation: 1.5s linear 0s infinite normal none running spin;
position: relative;
height: 50px;
width: 50px;
display: inline-block;
"></div>
</td>
<td>
Cakes will pop up from the bottom of the screen and move across
the screen in an arc.
</td>
</tr>
<tr>
<td>
<div id="timer" style="position: relative; display: inline-block; left: 0">11.9</div>
</td>
<td>
<br />
Keep an eye on the timer in the center top of the screen, which
counts down from 20 seconds.
</td>
</tr>
<tr>
<td>
<div id="score" style="position: relative">You scored 0</div>
</td>
<td>
Watch your score counter in the top left corner of the screen.
</td>
</tr>
</tbody>
</table>
</div>
<div class="mb-3">
<h2>How to Score</h2>
<p>Click on a cake to receive points:</p>
<ul class="list-unstyled">
<li><strong>1 point</strong> is added to your score for each cake caught.</li>
<li><strong>2 seconds</strong> are added to your timer for each cake caught.</li>
</ul>
</div>
<div class="mb-3">
<h2>Increasing Difficulty</h2>
<p>The game will get more difficult as time goes on:</p>
<ul class="list-unstyled">
<li>The speed of the cakes will increase every second.</li>
</ul>
</div>
<div class="mb-3">
<h2>Good Luck!</h2>
<p>Prepare for a challenge and try to get the highest score possible!</p>
</div>
</div>
<section>
<div class="container mt-5">
<h2>Let's pick your cake character</h2>
<p class="lead text-center">Enter your name to pick your character.</p>
<div class="text-center mt-4">
<label for="playerName">Your Name:</label>
<input type="text" id="playerName" placeholder="Enter your name" class="form-control">
<button id="pickTeamButton">Pick Team</button>
</div>
<div id="teamSelection" class="mt-4">
<!-- Team selection content will be dynamically added here -->
</div>
</div>
</section>
</main>
<footer class="footer mt-5 py-3 bg-light">
<div class="container text-center">
<span class="text-muted">© 2023 Naturally Sweet</span>
</div>
</footer>
<!-- Bootstrap JavaScript dependencies -->
<script src="https://code.jquery.com/jquery-3.6.4.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js"></script>
<!-- Bootstrap JavaScript -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.min.js"></script>
<!-- Custom JavaScript -->
<script>
document.addEventListener("DOMContentLoaded", function () {
// Add event listener for the "Pick Team" button
document.getElementById("pickTeamButton").addEventListener("click", pickTeam);
// Add event listener for "Enter" key press in the input field
document.getElementById("playerName").addEventListener("keypress", function (event) {
if (event.key === "Enter") {
pickTeam();
}
});
// Add event listener for all buttons inside the teamSelectionDiv
document.getElementById("teamSelection").addEventListener("click", function (event) {
if (event.target && event.target.nodeName === "BUTTON") {
var image = event.target.dataset.image;
selectAbility(image);
}
});
});
function pickTeam() {
var playerName = document.getElementById("playerName").value;
if (!playerName.trim()) {
alert("Please enter your name to pick your team.");
return;
}
// Define the player
var player = {
name: "Player One",
number: 1,
abilities: [
{ thumbnail: "LemonCake", details: ["Tangy zest", "Refreshing presence", "Versatile adaptability"], image: "images/LemonCake.jpg" },
{ thumbnail: "rainbowCake", details: ["Colorful Personality", "Harmony & Inclusivity:", "Symbol of Hope"], image: "images/rainbowCake.png" },
{ thumbnail: "mintCake", details: ["Cool & refreshing", "Adaptive", "Soothing Presence"], image: "images/mintCake.jpg" },
]
};
displayChosenTeam(playerName, player);
}
function displayChosenTeam(playerName, player) {
var teamSelectionDiv = document.getElementById("teamSelection");
teamSelectionDiv.innerHTML = `
<h4>Hello, ${playerName}!</h4>
<p>Please pick your character.</p>
<div class="row mt-4">
${player.abilities.map(ability => `
<div class="col-md-4">
<div class="card ability-card">
<div class="card-body">
<div class="ability-image">
<img src='${ability.image}' alt='${ability.thumbnail} Image' class="img-fluid mb-3">
</div>
<ul class="list-group">
${ability.details.map(detail => `<li class="list-group-item">${detail}</li>`).join('')}
</ul>
<button data-image="${ability.image}" class="btn">Select ${removeFileExtension(ability.thumbnail)}</button>
</div>
</div>
</div>
`).join('')}
</div>
`;
}
// Function to remove file extension
function removeFileExtension(fileName) {
return fileName.split('.').slice(0, -1).join('.');
}
function selectAbility(image) {
alert(`You selected: ${image}, good choice, now let's go shoot some cakes`);
// Redirect to game.html
window.location.href = 'game.html';
}
</script>
</body>
</html>