-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
251 lines (190 loc) · 10.4 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dress Up Kiki</title>
<style>
body {
position: center;
margin: 50px;
padding: 0;
justify-content: center;
align-items: center;
background-color:#bdc3ff; /* Optional: Set background color */
transform: scale(0.4); /* Zoom out by % */
}
#container {
position: relative;
}
#avatar, #background, #start, #clothes-select, #buttons, #finish {
position: absolute;
}
.dress {
position: absolute;
}
</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/dom-to-image/2.6.0/dom-to-image.min.js"></script>
</head>
<body>
<div id="container">
<!-- Background image -->
<img id="background" src="background.png" alt="Background">
<!-- Kiki avatar -->
<div id="avatarContainer">
<img id="avatar" src="kiki.png" alt="Avatar">
</div>
<!-- Start image -->
<img id="start" src="start.gif" alt="Start Screen" usemap="#start-map">
<!-- Define an image map for clickable areas -->
<map name="start-map">
<!-- Define clickable area for starting the game -->
<area target="" alt="" title="" href="javascript:void(0);" onclick="loadClothes()" coords="810,797,1279,979" shape="rect">
</map>
<!-- Clothes selection area -->
<img id="clothes-select" src="clothes_select.png" alt="Clothes Select" usemap="#clothes-select-map" style="display: none;">
<map name="clothes-select-map">
<!-- Finish Screen -->
<area target="" alt="" title="" href="javascript:void(0);" onclick="loadFinishScreen()" coords="12,1287,237,1365" shape="rect">
<!-- Strawberry hat -->
<area target="" alt="" title="" href="javascript:void(0);" onclick="toggleDress('strawberry_hat.png')" coords="875,101,947,206" shape="rect">
<!-- Flower hat -->
<area target="" alt="" title="" href="javascript:void(0);" onclick="toggleDress('flower_hat.png')" coords="1161,113,1236,208" shape="rect" >
<!-- Party hat -->
<area target="" alt="" title="" href="javascript:void(0);" onclick="toggleDress('party_hat.png')" coords="856,220,934,355" shape="rect">
<!-- Black hat -->
<area target="" alt="" title="" href="javascript:void(0);" onclick="toggleDress('black_hat.png')" coords="1014,349,944,248,1002,221,1031,271,1065,267,1130,188,1109,357,1048,335" shape="poly">
<!-- Bow -->
<area target="" alt="" title="" href="javascript:void(0);"onclick="toggleDress('bow.png')" coords="981,108,1104,186" shape="rect">
<!-- Beanie -->
<area target="" alt="" title="" href="javascript:void(0);" onclick="toggleDress('beanie.png')" coords="1153,250,1254,346" shape="rect">
<!-- Strawberry eyes -->
<area target="" alt="" title="" href="javascript:void(0);" onclick="toggleDress('strawberry_eyes.png')" coords="871,541,1009,598" shape="rect">
<!-- Blush -->
<area target="" alt="" title="" href="javascript:void(0);" onclick="toggleDress('blush.png')" coords="1199,626,1339,666" shape="rect">
<!-- Clown makeup -->
<area target="" alt="" title="" href="javascript:void(0);" onclick="toggleDress('clown_makeup.png')" coords="1187,452,1344,604" shape="rect">
<!-- Pale skin -->
<area target="" alt="" title="" href="javascript:void(0);" onclick="toggleDress('pale_skin.png')" coords="1041,480,1173,591" shape="rect">
<!-- Blue eyes -->
<area target="" alt="" title="" href="javascript:void(0);" onclick="toggleDress('blue_eyes.png')" coords="864,473,1001,525" shape="rect">
<!-- Snow goggles -->
<area target="" alt="" title="" href="javascript:void(0);" onclick="toggleDress('snow_goggles.png')" coords="1035,612,1180,662" shape="rect">
<!-- Eyes closed -->
<area target="" alt="" title="" href="javascript:void(0);" onclick="toggleDress('eyes_closed.png')" coords="843,613,997,672" shape="rect">
<!-- Strawberry dress -->
<area target="" alt="" title="" href="javascript:void(0);" onclick="toggleDress('strawberry_dress.png')" coords="801,788,910,917" shape="rect">
<!-- Flower dress -->
<area target="" alt="" title="" href="javascript:void(0);"onclick="toggleDress('flower_dress.png')" coords="1072,824,1175,950" shape="rect">
<!-- Clown dress -->
<area target="" alt="" title="" href="javascript:void(0);" onclick="toggleDress('clown_dress.png')" coords="1197,781,1300,907" shape="rect">
<!-- Goth dress -->
<area target="" alt="" title="" href="javascript:void(0);" onclick="toggleDress('goth_dress.png')" coords="938,773,1041,899" shape="rect">
<!-- Bow dress -->
<area target="" alt="" title="" href="javascript:void(0);" onclick="toggleDress('bow_dress.png')" coords="801,945,904,1071" shape="rect">
<!-- Snow jacket -->
<area target="" alt="" title="" href="javascript:void(0);" onclick="toggleDress('snow_jacket.png')" coords="1041,1063,1091,970,1159,978,1195,1069" shape="poly">
<!-- Cat dress -->
<area target="" alt="" title="" href="javascript:void(0);" onclick="toggleDress('cat_dress.png')" coords="1216,924,1319,1050" shape="rect">
<!-- Pumpkin dress -->
<area target="" alt="" title="" href="javascript:void(0);" onclick="toggleDress('pumpkin_dress.png')" coords="924,928,1034,1036" shape="rect">
<!-- Brown boots -->
<area target="" alt="" title="" href="javascript:void(0);" onclick="toggleDress('brown_boots.png')" coords="739,1186,913,1249" shape="rect" >
<!-- Clown boots -->
<area target="" alt="" title="" href="javascript:void(0);" onclick="toggleDress('clown_boots.png')" coords="1132,1175,1371,1240" shape="rect">
<!-- Goth boots -->
<area target="" alt="" title="" href="javascript:void(0);" onclick="toggleDress('goth_boots.png')" coords="962,1175,1099,1251" shape="rect">
<!-- Heart boots -->
<area target="" alt="" title="" href="javascript:void(0);" onclick="toggleDress('heart_boots.png')" coords="745,1271,935,1345" shape="rect">
<!-- Snow boots -->
<area target="" alt="" title="" href="javascript:void(0);" onclick="toggleDress('snow_boots.png')" coords="1148,1270,1338,1344" shape="rect">
<!-- White boots -->
<area target="" alt="" title="" href="javascript:void(0);" onclick="toggleDress('white_boots.png')" coords="953,1283,1128,1356" shape="rect">
</map>
<!-- Finish image -->
<img id="finish" src="finish.png" alt="Finish" usemap="#finish-map" style="display: none;">
<map name="finish-map">
<!-- Refresh area -->
<area target="" alt="" title="" href="javascript:void(0);" onclick="refreshPage()" coords="861,1145,1282,1244" shape="rect">
<!-- Screenshot area -->
<area target="" alt="" title="" href="javascript:void(0);" onclick="downloadPageAsPNG()" coords="1009,962,1145,1095" shape="rect">
</map>
</map>
<script>
var selectedClothes = [];
// Preload the start audio
var startAudio = new Audio('start.mp3');
startAudio.loop = true; // Loop the start audio
// Play the start audio when the document is loaded
document.addEventListener('DOMContentLoaded', function() {
startAudio.play();
});
// Play music.mp3 when clothes_select.png is displayed
function loadClothes() {
// Stop the start audio
startAudio.pause();
startAudio.currentTime = 0; // Reset the audio to the beginning
// Start playing music.mp3
var musicAudio = new Audio('music.mp3');
musicAudio.loop = true; // Loop the music
musicAudio.play();
// Show the clothes select screen
document.getElementById('start').style.display = 'none';
document.getElementById('clothes-select').style.display = 'block';
document.getElementById('buttons').style.display = 'block';
}
function toggleDress(dress) {
var avatarContainer = document.getElementById('avatarContainer');
// Check if the dress is already selected
var existingDress = document.getElementById(dress);
if (existingDress) {
// If it's selected, remove it
existingDress.remove();
var index = selectedClothes.indexOf(dress);
if (index !== -1) {
selectedClothes.splice(index, 1);
}
} else {
// If it's not selected, add it
var dressImage = new Image();
dressImage.src = dress;
dressImage.className = 'dress';
dressImage.id = dress;
avatarContainer.appendChild(dressImage);
selectedClothes.push(dress);
}
}
function loadStartScreen() {
// Implement the logic to load the start screen
// Hide other screens if visible
}
function loadFinishScreen() {
document.getElementById('clothes-select').style.display = 'none';
document.getElementById('finish').style.display = 'block';
}
function refreshPage() {
location.reload(); // This reloads the current page
}
function downloadPageAsPNG() {
// Capture the entire body using dom-to-image
domtoimage.toPng(document.body)
.then(function (dataUrl) {
// Create a temporary anchor element
const link = document.createElement('a');
link.href = dataUrl;
link.download = 'Dressed_Up_Kiki.png'; // Set the filename for the downloaded image
link.click(); // Trigger the download
})
.catch(function (error) {
console.error('Error capturing page:', error);
});
}
// Play start.mp3 when start.png is displayed
var startAudio = new Audio('start.mp3');
startAudio.loop = true;
document.getElementById('start').addEventListener('load', function() {
startAudio.play();
});
</script>
</body>
</html>