This repository has been archived by the owner on Sep 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
clickergame.html
335 lines (313 loc) · 11.4 KB
/
clickergame.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
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="A place for Freakybob.">
<meta content="Freakybob" property="og:title" />
<meta content="Freakybob Clicker Game" property="og:description" />
<meta content="https://freakybob.site/clickergame" property="og:url" />
<meta content="https://github.com/5quirre1/Freakybob.site/blob/main/Snapshots/Screenshot%202024-08-29%2012.38.20%20AM.png" property="og:image" />
<meta content="#006b79" data-react-helmet="true" name="theme-color" />
<title>Freakybob Clicker</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #e4d501;
color: #bdca02;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
overflow: hidden;
}
#container {
display: flex;
justify-content: center;
align-items: center;
flex-direction: row;
width: 80%;
max-width: 1200px;
background-color: #776607;
border-radius: 10px;
padding: 20px;
}
#shop {
width: 300px;
background-color: #a008ad;
border-radius: 10px;
padding: 10px;
box-shadow: 0 0 10px rgba(10, 10, 0, 0.5);
margin-right: 20px;
}
#click-area {
display: flex;
flex-direction: column;
align-items: center;
width: 100%;
}
#clicker {
width: 200px;
height: 200px;
background-image: url('freaky (1).webp');
background-size: cover;
background-position: center;
cursor: pointer;
margin-bottom: 20px;
border: 2px solid #01b4eb;
border-radius: 50%;
}
#stats, #achievements {
margin-bottom: 20px;
}
button {
background-color: #4a6f8c;
color: #ffffff;
border: none;
padding: 10px;
border-radius: 5px;
cursor: pointer;
margin-top: 10px;
display: block;
}
button:hover:not(.disabled) {
background-color: #3a5e7a;
}
button.disabled {
background-color: #6c757d;
cursor: not-allowed;
}
button.enabled {
background-color: #4a6f8c;
cursor: pointer;
}
#mute-button {
position: fixed;
top: 10px;
right: 10px;
padding: 10px 15px;
background-color: rgb(1, 170, 128);
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 14px;
z-index: 1001;
}
#mute-button.muted {
background-color: #ff4d4d;
}
#achievements p {
background-color: #2a3c5d;
padding: 5px;
border-radius: 5px;
margin: 5px 0;
}
@keyframes slide-in-right {
0% {
transform: translateX(100%);
opacity: 0;
}
100% {
transform: translateX(0);
opacity: 1;
}
}
@keyframes slide-out-right {
0% {
transform: translateX(0);
opacity: 1;
}
100% {
transform: translateX(100%);
opacity: 0;
}
}
.achievement {
background-color: #2a3c5d;
padding: 5px;
border-radius: 5px;
margin: 5px 0;
color: white;
animation: slide-in-right 0.5s forwards;
}
.achievement.out {
animation: slide-out-right 0.5s forwards;
}
</style>
</head>
<body>
<!-- Audio elements without controls, autoplay and preload set -->
<audio id="background-music" loop autoplay preload="auto">
<source src="audio/Sneaky-Snitch(chosic.com).mp3" type="audio/mp3">
</audio>
<audio id="click-sound" src="https://github.com/5quirre1/Freakybob.site/raw/main/i%E2%80%99m-spongebob-made-with-Voicemod.mp3"></audio>
<div id="container">
<div id="shop">
<h2>Shop</h2>
<button id="buy-autoclicker" class="disabled">Buy Autoclicker (100 clicks)</button>
<button id="buy-freakystar" class="disabled">Buy Freaky Star (300 clicks)</button>
<h3>Upgrades</h3>
<button id="buy-multiplier-1" class="disabled">1+ Clicks Multiplier (15 clicks)</button>
<button id="buy-multiplier-8" class="disabled">8+ Clicks Multiplier (120 clicks)</button>
</div>
<div id="click-area">
<div id="clicker"></div>
<div id="stats">
<p>Clicks: <span id="click-count">0</span></p>
<p>Clicks Per Second: <span id="clicks-per-second">0</span></p>
</div>
<div id="achievements">
<h2>Achievements</h2>
</div>
</div>
</div>
<!-- Mute/Unmute Button -->
<button id="mute-button">Mute Music</button>
<script>
let clickCount = 0;
let clicksPerSecond = 0;
let autoClicker = false;
let freakyStar = { owned: false, clicksPerSecond: 0 };
let clickMultiplier = 1;
let multipliers = {
1: { count: 0, max: 3, cost: 15, increment: 1 },
8: { count: 0, max: 3, cost: 120, increment: 8 }
};
const achievements = [
{ name: 'Started this Journey', clicks: 1 },
{ name: 'Beginner Clicker', clicks: 300 },
{ name: 'You must love clicking freakybob', clicks: 900 },
{ name: 'First 1000!', clicks: 1000 },
{ name: 'Finger destroyer', clicks: 3000 },
{ name: 'Intermediate clicker', clicks: 7000 },
{ name: 'Mouse destroyer', clicks: 13000 },
{ name: 'First 20,000!', clicks: 20000 },
{ name: 'Beginner Freakybob', clicks: 27000 },
{ name: 'King clicker', clicks: 70000 },
{ name: "THE ULTIMATE FINGER DESTROYER!!", clicks: 100000 },
{ name: 'Freakybob of the year!', clicks: 117000 },
{ name: 'The literal Freakybob god', clicks: 130000 },
{ name: 'The mouse is not dead yet!', clicks: 135000 },
{ name: 'Freakybob of the century', clicks: 140000 },
{ name: 'Freakybob of the millennium', clicks: 150000 },
{ name: 'The ultimate Freakybob', clicks: 160000 },
{ name: 'Freakybob of the universe', clicks: 190000 },
{ name: 'The Freakybob God', clicks: 217000 },
{ name: 'The..end..?', clicks: 240000 },
{ name: 'For now...', clicks: 260000 }
];
const unlockedAchievements = new Set();
let isMuted = false; // Default to unmuted
function playClickSound() {
if (isMuted) return; // Prevent sound if muted
const clickSound = new Audio('https://github.com/5quirre1/Freakybob.site/raw/main/i%E2%80%99m-spongebob-made-with-Voicemod.mp3');
clickSound.play().catch(err => console.error(err));
}
function toggleMute() {
isMuted = !isMuted;
document.getElementById('mute-button').classList.toggle('muted', isMuted);
document.getElementById('background-music').muted = isMuted;
document.getElementById('mute-button').textContent = isMuted ? 'Unmute Music' : 'Mute Music';
}
function updateStats() {
document.getElementById('click-count').textContent = clickCount;
document.getElementById('clicks-per-second').textContent = clicksPerSecond;
}
function updateAchievements() {
const achievementsContainer = document.getElementById('achievements');
achievements.forEach(achievement => {
if (clickCount >= achievement.clicks && !unlockedAchievements.has(achievement.name)) {
unlockedAchievements.add(achievement.name);
const achievementElement = document.createElement('p');
achievementElement.textContent = achievement.name;
achievementElement.className = 'achievement';
achievementsContainer.appendChild(achievementElement);
setTimeout(() => {
achievementElement.classList.add('out');
setTimeout(() => achievementElement.remove(), 500);
}, 5000); // 5 seconds before fade out
}
});
}
function updateButtonStates() {
document.getElementById('buy-autoclicker').classList.toggle('disabled', clickCount < 100 || autoClicker);
document.getElementById('buy-freakystar').classList.toggle('disabled', clickCount < 300 || freakyStar.owned);
document.getElementById('buy-multiplier-1').classList.toggle('disabled', clickCount < multipliers[1].cost || multipliers[1].count >= multipliers[1].max);
document.getElementById('buy-multiplier-8').classList.toggle('disabled', clickCount < multipliers[8].cost || multipliers[8].count >= multipliers[8].max);
}
function buyItem(cost, itemName, enableNext) {
if (clickCount >= cost) {
clickCount -= cost;
updateButtonStates(); // Update button states after buying an item
if (enableNext) {
document.getElementById(enableNext).classList.remove('disabled');
document.getElementById(enableNext).classList.add('enabled');
}
updateStats();
updateAchievements();
}
}
function handleClick() {
playClickSound();
clickCount += 1 * clickMultiplier;
updateStats();
updateAchievements();
updateButtonStates(); // Update button states after a click
}
// Initialize game
function initialize() {
document.getElementById('clicker').addEventListener('click', handleClick);
document.getElementById('buy-autoclicker').addEventListener('click', function() {
if (clickCount >= 100 && !autoClicker) {
autoClicker = true;
buyItem(100, 'buy-autoclicker', 'buy-freakystar');
}
});
document.getElementById('buy-freakystar').addEventListener('click', function() {
if (clickCount >= 300 && !freakyStar.owned) {
freakyStar.owned = true;
freakyStar.clicksPerSecond = 40;
buyItem(300, 'buy-freakystar', null);
}
});
document.getElementById('buy-multiplier-1').addEventListener('click', function() {
const upgrade = multipliers[1];
if (clickCount >= upgrade.cost && upgrade.count < upgrade.max) {
clickMultiplier += upgrade.increment;
upgrade.count += 1;
buyItem(upgrade.cost, 'buy-multiplier-1', null);
}
});
document.getElementById('buy-multiplier-8').addEventListener('click', function() {
const upgrade = multipliers[8];
if (clickCount >= upgrade.cost && upgrade.count < upgrade.max) {
clickMultiplier += upgrade.increment;
upgrade.count += 1;
buyItem(upgrade.cost, 'buy-multiplier-8', null);
}
});
// Auto-clicker and Freaky Star logic
setInterval(() => {
if (autoClicker) {
clickCount += 1 * clickMultiplier;
updateStats();
updateAchievements();
}
}, 1000);
setInterval(() => {
if (freakyStar.owned) {
clickCount += freakyStar.clicksPerSecond;
updateStats();
updateAchievements();
}
}, 2000);
updateButtonStates(); // Set initial button states
}
initialize();
// Add event listener for mute/unmute
document.getElementById('mute-button').addEventListener('click', toggleMute);
</script>
</body>
</html>