Spaces:
Running
Running
undefined - Initial Deployment
Browse files- README.md +6 -4
- index.html +486 -19
README.md
CHANGED
@@ -1,10 +1,12 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
colorTo: green
|
6 |
sdk: static
|
7 |
pinned: false
|
|
|
|
|
8 |
---
|
9 |
|
10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
---
|
2 |
+
title: hugging-clicker
|
3 |
+
emoji: π³
|
4 |
+
colorFrom: red
|
5 |
colorTo: green
|
6 |
sdk: static
|
7 |
pinned: false
|
8 |
+
tags:
|
9 |
+
- deepsite
|
10 |
---
|
11 |
|
12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
@@ -1,19 +1,486 @@
|
|
1 |
-
<!
|
2 |
-
<html>
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>Hugs Clicker - Get Virtual Hugs!</title>
|
7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
8 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css"/>
|
9 |
+
<style>
|
10 |
+
.hugger {
|
11 |
+
transition: all 0.1s ease;
|
12 |
+
cursor: pointer;
|
13 |
+
}
|
14 |
+
.hugger:active {
|
15 |
+
transform: scale(0.95);
|
16 |
+
}
|
17 |
+
.floating-hug {
|
18 |
+
position: absolute;
|
19 |
+
pointer-events: none;
|
20 |
+
animation: floatUp 2s forwards;
|
21 |
+
opacity: 0.8;
|
22 |
+
}
|
23 |
+
@keyframes floatUp {
|
24 |
+
0% {
|
25 |
+
transform: translateY(0) rotate(0deg);
|
26 |
+
opacity: 1;
|
27 |
+
}
|
28 |
+
100% {
|
29 |
+
transform: translateY(-100px) rotate(10deg);
|
30 |
+
opacity: 0;
|
31 |
+
}
|
32 |
+
}
|
33 |
+
.progress-bar {
|
34 |
+
transition: width 0.3s ease;
|
35 |
+
}
|
36 |
+
.unlock-notification {
|
37 |
+
animation: bounce 0.5s ease;
|
38 |
+
}
|
39 |
+
@keyframes bounce {
|
40 |
+
0%, 100% { transform: scale(1); }
|
41 |
+
50% { transform: scale(1.1); }
|
42 |
+
}
|
43 |
+
</style>
|
44 |
+
</head>
|
45 |
+
<body class="bg-gradient-to-b from-pink-100 to-purple-100 min-h-screen font-sans">
|
46 |
+
<div class="container mx-auto px-4 py-8">
|
47 |
+
<header class="text-center mb-8">
|
48 |
+
<h1 class="text-4xl md:text-5xl font-bold text-purple-800 mb-2">Hugs Clicker</h1>
|
49 |
+
<p class="text-lg text-purple-600">Spread love one hug at a time!</p>
|
50 |
+
</header>
|
51 |
+
|
52 |
+
<div class="flex flex-col lg:flex-row gap-8">
|
53 |
+
<!-- Main hugger section -->
|
54 |
+
<div class="flex-1 flex flex-col items-center">
|
55 |
+
<div class="relative mb-4">
|
56 |
+
<div id="hug-counter" class="text-3xl font-bold text-purple-700 mb-4 text-center">0 Hugs</div>
|
57 |
+
<div id="hugger" class="hugger w-64 h-64 md:w-80 md:h-80 bg-white rounded-full shadow-xl flex items-center justify-center overflow-hidden">
|
58 |
+
<img id="hugger-image" src="https://em-content.zobj.net/source/microsoft-teams/363/hugging-face_1f917.png" alt="Hugging face" class="w-full h-full object-contain p-6">
|
59 |
+
</div>
|
60 |
+
<div id="hug-effects" class="absolute inset-0 pointer-events-none"></div>
|
61 |
+
</div>
|
62 |
+
|
63 |
+
<div class="text-center text-purple-600 mb-6">
|
64 |
+
<p id="hugs-per-second" class="text-lg">0 hugs per second</p>
|
65 |
+
</div>
|
66 |
+
|
67 |
+
<div class="w-full max-w-md bg-white bg-opacity-70 rounded-lg p-4 shadow-md mb-6">
|
68 |
+
<h3 class="text-xl font-semibold text-purple-800 mb-2">Hug Power</h3>
|
69 |
+
<div class="h-4 bg-purple-200 rounded-full mb-2">
|
70 |
+
<div id="power-bar" class="h-full bg-purple-500 rounded-full progress-bar" style="width: 0%"></div>
|
71 |
+
</div>
|
72 |
+
<p id="power-text" class="text-sm text-purple-600">Click faster to increase your hug power!</p>
|
73 |
+
</div>
|
74 |
+
</div>
|
75 |
+
|
76 |
+
<!-- Upgrades section -->
|
77 |
+
<div class="flex-1 bg-white bg-opacity-80 rounded-xl p-6 shadow-lg">
|
78 |
+
<h2 class="text-2xl font-bold text-purple-800 mb-4 border-b-2 border-purple-100 pb-2">Hug Upgrades</h2>
|
79 |
+
|
80 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
81 |
+
<div class="upgrade-card" data-cost="20" data-id="auto-hugger" data-cps="1">
|
82 |
+
<div class="flex items-center gap-3">
|
83 |
+
<img src="https://em-content.zobj.net/source/microsoft-teams/363/smiling-face-with-hearts_1f970.png" alt="Auto hugger" class="w-12 h-12">
|
84 |
+
<div>
|
85 |
+
<h3 class="font-semibold text-purple-700">Auto Hugger</h3>
|
86 |
+
<p class="text-sm text-purple-600">Gives 1 hug per second</p>
|
87 |
+
</div>
|
88 |
+
</div>
|
89 |
+
<div class="ml-auto text-right">
|
90 |
+
<p class="cost text-lg font-bold text-purple-800">20 Hugs</p>
|
91 |
+
<p class="owned text-xs text-purple-600">Owned: 0</p>
|
92 |
+
</div>
|
93 |
+
</div>
|
94 |
+
|
95 |
+
<div class="upgrade-card" data-cost="100" data-id="hug-buddy" data-cps="5">
|
96 |
+
<div class="flex items-center gap-3">
|
97 |
+
<img src="https://em-content.zobj.net/source/microsoft-teams/363/smiling-face-with-smiling-eyes_1f60a.png" alt="Hug buddy" class="w-12 h-12">
|
98 |
+
<div>
|
99 |
+
<h3 class="font-semibold text-purple-700">Hug Buddy</h3>
|
100 |
+
<p class="text-sm text-purple-600">Gives 5 hugs per second</p>
|
101 |
+
</div>
|
102 |
+
</div>
|
103 |
+
<div class="ml-auto text-right">
|
104 |
+
<p class="cost text-lg font-bold text-purple-800">100 Hugs</p>
|
105 |
+
<p class="owned text-xs text-purple-600">Owned: 0</p>
|
106 |
+
</div>
|
107 |
+
</div>
|
108 |
+
|
109 |
+
<div class="upgrade-card" data-cost="500" data-id="hug-team" data-cps="10">
|
110 |
+
<div class="flex items-center gap-3">
|
111 |
+
<img src="https://em-content.zobj.net/source/microsoft-teams/363/smiling-face-with-heart-eyes_1f60d.png" alt="Hug team" class="w-12 h-12">
|
112 |
+
<div>
|
113 |
+
<h3 class="font-semibold text-purple-700">Hug Team</h3>
|
114 |
+
<p class="text-sm text-purple-600">Gives 10 hugs per second</p>
|
115 |
+
</div>
|
116 |
+
</div>
|
117 |
+
<div class="ml-auto text-right">
|
118 |
+
<p class="cost text-lg font-bold text-purple-800">500 Hugs</p>
|
119 |
+
<p class="owned text-xs text-purple-600">Owned: 0</p>
|
120 |
+
</div>
|
121 |
+
</div>
|
122 |
+
|
123 |
+
<div class="upgrade-card" data-cost="2000" data-id="hug-factory" data-cps="50">
|
124 |
+
<div class="flex items-center gap-3">
|
125 |
+
<img src="https://em-content.zobj.net/source/microsoft-teams/363/star-struck_1f929.png" alt="Hug factory" class="w-12 h-12">
|
126 |
+
<div>
|
127 |
+
<h3 class="font-semibold text-purple-700">Hug Factory</h3>
|
128 |
+
<p class="text-sm text-purple-600">Gives 50 hugs per second</p>
|
129 |
+
</div>
|
130 |
+
</div>
|
131 |
+
<div class="ml-auto text-right">
|
132 |
+
<p class="cost text-lg font-bold text-purple-800">2000 Hugs</p>
|
133 |
+
<p class="owned text-xs text-purple-600">Owned: 0</p>
|
134 |
+
</div>
|
135 |
+
</div>
|
136 |
+
</div>
|
137 |
+
</div>
|
138 |
+
</div>
|
139 |
+
|
140 |
+
<!-- Achievements section -->
|
141 |
+
<div class="mt-8 bg-white bg-opacity-80 rounded-xl p-6 shadow-lg">
|
142 |
+
<h2 class="text-2xl font-bold text-purple-800 mb-4 border-b-2 border-purple-100 pb-2">Hug Achievements</h2>
|
143 |
+
<div class="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-4">
|
144 |
+
<div class="achievement" data-threshold="10">
|
145 |
+
<div class="achievement-icon bg-purple-200 rounded-full w-16 h-16 flex items-center justify-center mx-auto mb-2">
|
146 |
+
<img src="https://em-content.zobj.net/source/microsoft-teams/363/smiling-face_263a-fe0f.png" alt="First Hugs" class="w-10 h-10">
|
147 |
+
</div>
|
148 |
+
<p class="text-center text-sm font-medium text-purple-700">First Hugs</p>
|
149 |
+
<p class="text-center text-xs text-purple-500">10 hugs</p>
|
150 |
+
</div>
|
151 |
+
<div class="achievement" data-threshold="50">
|
152 |
+
<div class="achievement-icon bg-purple-200 rounded-full w-16 h-16 flex items-center justify-center mx-auto mb-2">
|
153 |
+
<img src="https://em-content.zobj.net/source/microsoft-teams/363/smiling-face-with-halo_1f607.png" alt="Hug Apprentice" class="w-10 h-10">
|
154 |
+
</div>
|
155 |
+
<p class="text-center text-sm font-medium text-purple-700">Hug Apprentice</p>
|
156 |
+
<p class="text-center text-xs text-purple-500">50 hugs</p>
|
157 |
+
</div>
|
158 |
+
<div class="achievement" data-threshold="100">
|
159 |
+
<div class="achievement-icon bg-purple-200 rounded-full w-16 h-16 flex items-center justify-center mx-auto mb-2">
|
160 |
+
<img src="https://em-content.zobj.net/source/microsoft-teams/363/smiling-face-with-sunglasses_1f60e.png" alt="Hug Expert" class="w-10 h-10">
|
161 |
+
</div>
|
162 |
+
<p class="text-center text-sm font-medium text-purple-700">Hug Expert</p>
|
163 |
+
<p class="text-center text-xs text-purple-500">100 hugs</p>
|
164 |
+
</div>
|
165 |
+
<div class="achievement" data-threshold="500">
|
166 |
+
<div class="achievement-icon bg-purple-200 rounded-full w-16 h-16 flex items-center justify-center mx-auto mb-2">
|
167 |
+
<img src="https://em-content.zobj.net/source/microsoft-teams/363/partying-face_1f973.png" alt="Hug Master" class="w-10 h-10">
|
168 |
+
</div>
|
169 |
+
<p class="text-center text-sm font-medium text-purple-700">Hug Master</p>
|
170 |
+
<p class="text-center text-xs text-purple-500">500 hugs</p>
|
171 |
+
</div>
|
172 |
+
</div>
|
173 |
+
</div>
|
174 |
+
</div>
|
175 |
+
|
176 |
+
<!-- Unlock notification -->
|
177 |
+
<div id="unlock-notification" class="fixed top-4 left-1/2 transform -translate-x-1/2 bg-purple-600 text-white px-6 py-3 rounded-full shadow-lg hidden unlock-notification">
|
178 |
+
New hugger unlocked!
|
179 |
+
</div>
|
180 |
+
|
181 |
+
<script>
|
182 |
+
// Game state
|
183 |
+
let hugs = 0;
|
184 |
+
let hugsPerSecond = 0;
|
185 |
+
let clickPower = 1;
|
186 |
+
let powerLevel = 0;
|
187 |
+
let maxPower = 100;
|
188 |
+
let powerDecayRate = 0.5;
|
189 |
+
|
190 |
+
// Upgrades data
|
191 |
+
const upgrades = {
|
192 |
+
'auto-hugger': { cost: 20, cps: 1, owned: 0 },
|
193 |
+
'hug-buddy': { cost: 100, cps: 5, owned: 0 },
|
194 |
+
'hug-team': { cost: 500, cps: 10, owned: 0 },
|
195 |
+
'hug-factory': { cost: 2000, cps: 50, owned: 0 }
|
196 |
+
};
|
197 |
+
|
198 |
+
// Achievements data
|
199 |
+
const achievements = {
|
200 |
+
10: { unlocked: false, name: "First Hugs" },
|
201 |
+
50: { unlocked: false, name: "Hug Apprentice" },
|
202 |
+
100: { unlocked: false, name: "Hug Expert" },
|
203 |
+
500: { unlocked: false, name: "Hug Master" }
|
204 |
+
};
|
205 |
+
|
206 |
+
// Different hugger images
|
207 |
+
const huggerImages = [
|
208 |
+
'https://em-content.zobj.net/source/microsoft-teams/363/hugging-face_1f917.png',
|
209 |
+
'https://em-content.zobj.net/source/microsoft-teams/363/smiling-face-with-hearts_1f970.png',
|
210 |
+
'https://em-content.zobj.net/source/microsoft-teams/363/smiling-face-with-smiling-eyes_1f60a.png',
|
211 |
+
'https://em-content.zobj.net/source/microsoft-teams/363/smiling-face-with-heart-eyes_1f60d.png',
|
212 |
+
'https://em-content.zobj.net/source/microsoft-teams/363/star-struck_1f929.png'
|
213 |
+
];
|
214 |
+
let currentHuggerIndex = 0;
|
215 |
+
|
216 |
+
// DOM elements
|
217 |
+
const hugCounter = document.getElementById('hug-counter');
|
218 |
+
const hugsPerSecondDisplay = document.getElementById('hugs-per-second');
|
219 |
+
const hugger = document.getElementById('hugger');
|
220 |
+
const hugEffects = document.getElementById('hug-effects');
|
221 |
+
const powerBar = document.getElementById('power-bar');
|
222 |
+
const powerText = document.getElementById('power-text');
|
223 |
+
const upgradeCards = document.querySelectorAll('.upgrade-card');
|
224 |
+
const achievementElements = document.querySelectorAll('.achievement');
|
225 |
+
const unlockNotification = document.getElementById('unlock-notification');
|
226 |
+
|
227 |
+
// Initialize the game
|
228 |
+
function init() {
|
229 |
+
loadGame();
|
230 |
+
updateDisplay();
|
231 |
+
setupEventListeners();
|
232 |
+
startGameLoop();
|
233 |
+
}
|
234 |
+
|
235 |
+
// Set up event listeners
|
236 |
+
function setupEventListeners() {
|
237 |
+
// Click on hugger
|
238 |
+
hugger.addEventListener('click', () => {
|
239 |
+
addHugs(clickPower);
|
240 |
+
powerLevel = Math.min(powerLevel + 2, maxPower);
|
241 |
+
updatePower();
|
242 |
+
createClickEffect(event);
|
243 |
+
|
244 |
+
// Random chance to change hugger image
|
245 |
+
if (Math.random() < 0.05 && currentHuggerIndex < huggerImages.length - 1) {
|
246 |
+
currentHuggerIndex++;
|
247 |
+
document.getElementById('hugger-image').src = huggerImages[currentHuggerIndex];
|
248 |
+
showUnlockNotification();
|
249 |
+
}
|
250 |
+
});
|
251 |
+
|
252 |
+
// Buy upgrades
|
253 |
+
upgradeCards.forEach(card => {
|
254 |
+
card.addEventListener('click', () => {
|
255 |
+
const upgradeId = card.dataset.id;
|
256 |
+
buyUpgrade(upgradeId);
|
257 |
+
});
|
258 |
+
});
|
259 |
+
}
|
260 |
+
|
261 |
+
// Game loop
|
262 |
+
function startGameLoop() {
|
263 |
+
setInterval(() => {
|
264 |
+
// Add passive hugs
|
265 |
+
if (hugsPerSecond > 0) {
|
266 |
+
addHugs(hugsPerSecond / 10);
|
267 |
+
}
|
268 |
+
|
269 |
+
// Power decay
|
270 |
+
if (powerLevel > 0) {
|
271 |
+
powerLevel = Math.max(0, powerLevel - powerDecayRate);
|
272 |
+
updatePower();
|
273 |
+
}
|
274 |
+
|
275 |
+
// Check achievements
|
276 |
+
checkAchievements();
|
277 |
+
|
278 |
+
// Save game every 5 seconds
|
279 |
+
if (Date.now() % 5000 < 50) {
|
280 |
+
saveGame();
|
281 |
+
}
|
282 |
+
}, 100);
|
283 |
+
}
|
284 |
+
|
285 |
+
// Add hugs to the total
|
286 |
+
function addHugs(amount) {
|
287 |
+
hugs += amount;
|
288 |
+
updateDisplay();
|
289 |
+
}
|
290 |
+
|
291 |
+
// Buy an upgrade
|
292 |
+
function buyUpgrade(upgradeId) {
|
293 |
+
const upgrade = upgrades[upgradeId];
|
294 |
+
|
295 |
+
if (hugs >= upgrade.cost) {
|
296 |
+
hugs -= upgrade.cost;
|
297 |
+
upgrade.owned++;
|
298 |
+
hugsPerSecond += upgrade.cps;
|
299 |
+
|
300 |
+
// Increase cost for next purchase
|
301 |
+
upgrade.cost = Math.floor(upgrade.cost * 1.15);
|
302 |
+
|
303 |
+
updateDisplay();
|
304 |
+
updateUpgradeCards();
|
305 |
+
}
|
306 |
+
}
|
307 |
+
|
308 |
+
// Check for unlocked achievements
|
309 |
+
function checkAchievements() {
|
310 |
+
for (const threshold in achievements) {
|
311 |
+
if (!achievements[threshold].unlocked && hugs >= parseInt(threshold)) {
|
312 |
+
achievements[threshold].unlocked = true;
|
313 |
+
showAchievement(threshold);
|
314 |
+
}
|
315 |
+
}
|
316 |
+
}
|
317 |
+
|
318 |
+
// Show achievement notification
|
319 |
+
function showAchievement(threshold) {
|
320 |
+
const achievement = achievements[threshold];
|
321 |
+
const achievementElements = document.querySelectorAll(`.achievement[data-threshold="${threshold}"]`);
|
322 |
+
|
323 |
+
achievementElements.forEach(el => {
|
324 |
+
el.classList.add('animate__animated', 'animate__bounce');
|
325 |
+
setTimeout(() => {
|
326 |
+
el.classList.remove('animate__animated', 'animate__bounce');
|
327 |
+
}, 1000);
|
328 |
+
|
329 |
+
// Change style to show it's unlocked
|
330 |
+
const icon = el.querySelector('.achievement-icon');
|
331 |
+
icon.classList.remove('bg-purple-200');
|
332 |
+
icon.classList.add('bg-purple-400', 'shadow-md');
|
333 |
+
});
|
334 |
+
}
|
335 |
+
|
336 |
+
// Show unlock notification
|
337 |
+
function showUnlockNotification() {
|
338 |
+
unlockNotification.classList.remove('hidden');
|
339 |
+
unlockNotification.classList.add('animate__animated', 'animate__bounce');
|
340 |
+
|
341 |
+
setTimeout(() => {
|
342 |
+
unlockNotification.classList.add('hidden');
|
343 |
+
unlockNotification.classList.remove('animate__animated', 'animate__bounce');
|
344 |
+
}, 2000);
|
345 |
+
}
|
346 |
+
|
347 |
+
// Create visual effect when clicking
|
348 |
+
function createClickEffect(event) {
|
349 |
+
const effect = document.createElement('div');
|
350 |
+
effect.className = 'floating-hug';
|
351 |
+
|
352 |
+
// Random hug emoji
|
353 |
+
const hugEmojis = ['β€οΈ', 'π€', 'π«', 'π', 'π'];
|
354 |
+
const randomEmoji = hugEmojis[Math.floor(Math.random() * hugEmojis.length)];
|
355 |
+
|
356 |
+
effect.textContent = `+${clickPower} ${randomEmoji}`;
|
357 |
+
effect.style.left = `${event.clientX - 20}px`;
|
358 |
+
effect.style.top = `${event.clientY - 20}px`;
|
359 |
+
effect.style.color = ['#8b5cf6', '#ec4899', '#6366f1', '#f43f5e'][Math.floor(Math.random() * 4)];
|
360 |
+
effect.style.fontSize = `${14 + Math.random() * 10}px`;
|
361 |
+
|
362 |
+
hugEffects.appendChild(effect);
|
363 |
+
|
364 |
+
// Remove after animation
|
365 |
+
setTimeout(() => {
|
366 |
+
effect.remove();
|
367 |
+
}, 2000);
|
368 |
+
}
|
369 |
+
|
370 |
+
// Update power display
|
371 |
+
function updatePower() {
|
372 |
+
const percentage = (powerLevel / maxPower) * 100;
|
373 |
+
powerBar.style.width = `${percentage}%`;
|
374 |
+
|
375 |
+
// Update click power based on power level
|
376 |
+
clickPower = 1 + Math.floor(powerLevel / 20);
|
377 |
+
powerText.textContent = powerLevel > 0
|
378 |
+
? `Hug Power: ${clickPower}x (${Math.floor(powerLevel)}%)`
|
379 |
+
: 'Click faster to increase your hug power!';
|
380 |
+
}
|
381 |
+
|
382 |
+
// Update all displays
|
383 |
+
function updateDisplay() {
|
384 |
+
// Update hug counter
|
385 |
+
hugCounter.textContent = `${Math.floor(hugs)} Hug${hugs !== 1 ? 's' : ''}`;
|
386 |
+
|
387 |
+
// Update HPS display
|
388 |
+
hugsPerSecondDisplay.textContent = `${hugsPerSecond.toFixed(1)} hugs per second`;
|
389 |
+
|
390 |
+
// Update upgrade cards
|
391 |
+
updateUpgradeCards();
|
392 |
+
}
|
393 |
+
|
394 |
+
// Update upgrade cards state
|
395 |
+
function updateUpgradeCards() {
|
396 |
+
upgradeCards.forEach(card => {
|
397 |
+
const upgradeId = card.dataset.id;
|
398 |
+
const upgrade = upgrades[upgradeId];
|
399 |
+
|
400 |
+
// Update cost display
|
401 |
+
card.querySelector('.cost').textContent = `${Math.floor(upgrade.cost)} Hugs`;
|
402 |
+
|
403 |
+
// Update owned count
|
404 |
+
card.querySelector('.owned').textContent = `Owned: ${upgrade.owned}`;
|
405 |
+
|
406 |
+
// Disable if can't afford
|
407 |
+
if (hugs < upgrade.cost) {
|
408 |
+
card.classList.add('opacity-50');
|
409 |
+
} else {
|
410 |
+
card.classList.remove('opacity-50');
|
411 |
+
}
|
412 |
+
});
|
413 |
+
}
|
414 |
+
|
415 |
+
// Save game to localStorage
|
416 |
+
function saveGame() {
|
417 |
+
const gameData = {
|
418 |
+
hugs,
|
419 |
+
hugsPerSecond,
|
420 |
+
upgrades,
|
421 |
+
achievements,
|
422 |
+
currentHuggerIndex,
|
423 |
+
lastSave: Date.now()
|
424 |
+
};
|
425 |
+
|
426 |
+
localStorage.setItem('hugsClickerSave', JSON.stringify(gameData));
|
427 |
+
}
|
428 |
+
|
429 |
+
// Load game from localStorage
|
430 |
+
function loadGame() {
|
431 |
+
const savedData = localStorage.getItem('hugsClickerSave');
|
432 |
+
|
433 |
+
if (savedData) {
|
434 |
+
const gameData = JSON.parse(savedData);
|
435 |
+
|
436 |
+
hugs = gameData.hugs || 0;
|
437 |
+
hugsPerSecond = gameData.hugsPerSecond || 0;
|
438 |
+
|
439 |
+
// Merge upgrades
|
440 |
+
for (const id in gameData.upgrades) {
|
441 |
+
if (upgrades[id]) {
|
442 |
+
upgrades[id].cost = gameData.upgrades[id].cost;
|
443 |
+
upgrades[id].owned = gameData.upgrades[id].owned;
|
444 |
+
}
|
445 |
+
}
|
446 |
+
|
447 |
+
// Merge achievements
|
448 |
+
for (const threshold in gameData.achievements) {
|
449 |
+
if (achievements[threshold]) {
|
450 |
+
achievements[threshold].unlocked = gameData.achievements[threshold].unlocked;
|
451 |
+
}
|
452 |
+
}
|
453 |
+
|
454 |
+
currentHuggerIndex = gameData.currentHuggerIndex || 0;
|
455 |
+
document.getElementById('hugger-image').src = huggerImages[currentHuggerIndex];
|
456 |
+
|
457 |
+
// Calculate offline progress (up to 24 hours)
|
458 |
+
if (gameData.lastSave) {
|
459 |
+
const offlineTime = Math.min(Date.now() - gameData.lastSave, 86400000); // Max 24 hours
|
460 |
+
const offlineHugs = (hugsPerSecond * offlineTime) / 1000;
|
461 |
+
|
462 |
+
if (offlineHugs > 0) {
|
463 |
+
addHugs(offlineHugs);
|
464 |
+
alert(`Welcome back! You earned ${Math.floor(offlineHugs)} hugs while you were away!`);
|
465 |
+
}
|
466 |
+
}
|
467 |
+
|
468 |
+
// Update achievements display
|
469 |
+
for (const threshold in achievements) {
|
470 |
+
if (achievements[threshold].unlocked) {
|
471 |
+
const achievementElements = document.querySelectorAll(`.achievement[data-threshold="${threshold}"]`);
|
472 |
+
achievementElements.forEach(el => {
|
473 |
+
const icon = el.querySelector('.achievement-icon');
|
474 |
+
icon.classList.remove('bg-purple-200');
|
475 |
+
icon.classList.add('bg-purple-400', 'shadow-md');
|
476 |
+
});
|
477 |
+
}
|
478 |
+
}
|
479 |
+
}
|
480 |
+
}
|
481 |
+
|
482 |
+
// Start the game
|
483 |
+
init();
|
484 |
+
</script>
|
485 |
+
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 𧬠<a href="https://enzostvs-deepsite.hf.space?remix=FranckAbgrall/hugging-clicker" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
486 |
+
</html>
|