feat: add cursor upgrade, fix emoji upgrade

This commit is contained in:
Kirill Siukhin 2025-06-22 22:26:01 +05:00
parent 4c782e999c
commit 1e29447a50
5 changed files with 49 additions and 21 deletions

View File

@ -15,10 +15,9 @@
text-decoration: underline; text-decoration: underline;
} }
#upg-emojis { .upg-emojis {
display: none;
position: absolute; position: absolute;
font-size: 2em; font-size: 2.5em;
animation: 5s emojis linear infinite; animation: 5s emojis linear infinite;
} }
@keyframes emojis { @keyframes emojis {
@ -89,6 +88,7 @@
top: 0; top: 0;
left: 0; left: 0;
overflow: hidden; overflow: hidden;
text-align: center;
} }
.upg-credits-inner { .upg-credits-inner {
display: flex; display: flex;

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

View File

@ -53,7 +53,7 @@
<span id="upg-saves-reset" onclick="onResetProgressClick()">Reset progress</span> <span id="upg-saves-reset" onclick="onResetProgressClick()">Reset progress</span>
</div> </div>
<div id="upg-emojis">😆</div> <div id="upg-emojis"></div>
<div id="upg-mixer"> <div id="upg-mixer">
<b>Mixer</b> <b>Mixer</b>

View File

@ -160,15 +160,26 @@ function onResetProgressClick() {
// emojis // emojis
function enableEmojis() { function getRandomEmoji() {
const emojis = ['😎', '😆', '😛', '😏', '😔', '🥲', '😔', '😒', '😍', '😃', '🤓', '😊', '😁', '😄']; const emojis = ['😎', '😆', '😛', '😏', '😔', '🥲', '😔', '😒', '😍', '😃', '🤓', '😊', '😁', '😄'];
return emojis[Math.floor(Math.random() * emojis.length)];
}
function addEmoji() {
const upgEmojis = document.getElementById('upg-emojis'); const upgEmojis = document.getElementById('upg-emojis');
upgEmojis.style.display = 'block'; upgEmojis.style.display = 'block';
const emoji = document.createElement('span');
emoji.innerText = getRandomEmoji();
emoji.className = 'upg-emojis';
setTimeout(() => {
upgEmojis.append(emoji);
}, Math.random() * 1000);
setInterval(() => { setInterval(() => {
mood += 200; mood += Math.floor(Math.random() * 1000);
const randomEmoji = emojis[Math.floor(Math.random() * emojis.length)]; emoji.innerText = getRandomEmoji();
upgEmojis.innerText = randomEmoji;
updateMoodCounter(); updateMoodCounter();
}, 5000); }, 5000);
} }
@ -231,6 +242,15 @@ function showCredits() {
credits.style.display = 'block'; credits.style.display = 'block';
} }
// cursor
function enableCursor() {
var allElements = document.querySelectorAll('body, .btn, .click-btn');
for (var i = 0; i < allElements.length; i++) {
allElements[i].style.cursor = 'url("./assets/img/cursors/cursor.png"), auto';
}
}
let upgrades = [ let upgrades = [
{ {
@ -252,10 +272,10 @@ let upgrades = [
{ {
id: 'emojis', id: 'emojis',
name: 'Emoji Thruster', name: 'Emoji Thruster',
description: 'Flying emoji +200mood/5s', description: 'Flying emoji. Gives some amount of mood every 5 seconds.',
image: '../assets/img/upgrades/emojis.png', image: '../assets/img/upgrades/emojis.png',
cost: 500, cost: 500,
onPurchase: enableEmojis, onPurchase: addEmoji,
}, },
{ {
id: 'rain', id: 'rain',
@ -265,36 +285,44 @@ let upgrades = [
cost: 1000, cost: 1000,
onPurchase: enableRain, onPurchase: enableRain,
}, },
{
id: 'emojis2',
name: 'More Emoji Thrusters',
description: 'Let the emojis flyyyyyyy-- and get some more mood',
image: '../assets/img/upgrades/emojis2.png',
cost: 1500,
onPurchase: addEmoji,
},
{ {
id: 'calm_music', id: 'calm_music',
name: 'Old Radio', name: 'Old Radio',
description: 'Listen to the hand-made music', description: 'Listen to the hand-made music',
image: '../assets/img/upgrades/calm_music.png', image: '../assets/img/upgrades/calm_music.png',
cost: 1500, cost: 3000,
onPurchase: enableMusic, onPurchase: enableMusic,
}, },
{
id: 'cursor',
name: 'Cursor',
description: 'Click Clack. +400 mood/click',
image: '../assets/img/upgrades/cursor.png',
cost: 4000,
onPurchase: enableCursor,
},
{ {
id: 'mixer', id: 'mixer',
name: 'Mixer', name: 'Mixer',
description: 'Control the sounds', description: 'Control the sounds',
image: '../assets/img/upgrades/mixer.png', image: '../assets/img/upgrades/mixer.png',
cost: 3000, cost: 4500,
onPurchase: enableMixer, onPurchase: enableMixer,
}, },
{
id: 'emojis2',
name: 'More Emoji Thrusters',
description: 'Let the emojis flyyyyyyy +200mood/5s',
image: '../assets/img/upgrades/emojis2.png',
cost: 4000,
onPurchase: enableEmojis,
},
{ {
id: 'cuteface', id: 'cuteface',
name: 'Cuteface', name: 'Cuteface',
description: 'A little bit... unusual background... no?..', description: 'A little bit... unusual background... no?..',
image: '../assets/img/upgrades/cuteface.png', image: '../assets/img/upgrades/cuteface.png',
cost: 15000, cost: 8000,
onPurchase: showCuteface, onPurchase: showCuteface,
}, },
{ {