From c38ea064a0a02341a976753fccd3bcdf66a07119 Mon Sep 17 00:00:00 2001 From: Sergey Sidorkin Date: Fri, 21 Mar 2025 19:32:20 +0200 Subject: [PATCH 1/2] Adding features --- src/pages/CookieClicker.vue | 135 ++++++++++++++++++++++++++++++------ 1 file changed, 115 insertions(+), 20 deletions(-) diff --git a/src/pages/CookieClicker.vue b/src/pages/CookieClicker.vue index 0727f08..ab159ff 100644 --- a/src/pages/CookieClicker.vue +++ b/src/pages/CookieClicker.vue @@ -1,7 +1,10 @@ + \ No newline at end of file + + + From d623c286faa52039d99a22f3dde0829d977f3793 Mon Sep 17 00:00:00 2001 From: Sergey Sidorkin Date: Sun, 23 Mar 2025 15:12:26 +0200 Subject: [PATCH 2/2] solving issues --- src/pages/CookieClicker.vue | 66 ++++++++++++++++++++++++++++--------- 1 file changed, 51 insertions(+), 15 deletions(-) diff --git a/src/pages/CookieClicker.vue b/src/pages/CookieClicker.vue index ab159ff..2cccafe 100644 --- a/src/pages/CookieClicker.vue +++ b/src/pages/CookieClicker.vue @@ -6,15 +6,29 @@ const goldenCookies = ref([]); const achievements = ref([]); const achievementNotifications = ref([]); const buildings = ref([ - { name: 'Cursor', price: 15, cps: 0.1, count: 0}, - { name: 'Grandma', price: 100, cps: 1, count: 0}, - { name: 'Farm', price: 1000, cps: 10, count: 0}, - { name: 'Factory', price: 10_000, cps: 100, count: 0}, + { name: 'Cursor', price: 15, cps: 0.1, count: 0 }, + { name: 'Grandma', price: 100, cps: 1, count: 0 }, + { name: 'Farm', price: 1000, cps: 10, count: 0 }, + { name: 'Factory', price: 10_000, cps: 100, count: 0 }, ]); const upgrades = ref([ - { name: 'Better Cursors', price: 500, effect: () => buildings.value[0].cps *= 2, bought: false }, - { name: 'Cheaper Buildings', price: 1000, effect: () => buildings.value.forEach(b => b.price *= 0.9), bought: false } + { + name: 'Better Cursors', + price: 500, + effect: () => { + const cheapestBuilding = buildings.value.find(b => b.count > 0) || buildings.value[0]; + cheapestBuilding.cps *= 2; + }, + bought: false + }, + { + name: 'Cheaper Buildings', + price: 1000, + effect: () => + buildings.value.forEach(b => b.price *= 0.9), + bought: false + }, ]); const achievementList = [ @@ -30,6 +44,10 @@ function buyBuilding(building) { cookies.value -= building.price; building.price += Math.ceil(building.price * 0.15); building.count++; + + //Resort buildings by price (so the cheapest one is always first) + buildings.value.sort((a, b) => a.price - b.price); + checkAchievements(); } @@ -88,23 +106,28 @@ function checkAchievements() {

{{ cookies.toFixed(1) }} cookies

{{ cps.toFixed(1) }} cps

- +
- +
-
@@ -121,10 +144,17 @@ function checkAchievements() { font-size: 20px; animation: blink 0.5s infinite alternate; } + @keyframes blink { - 0% { opacity: 1; } - 100% { opacity: 0.5; } + 0% { + opacity: 1; + } + + 100% { + opacity: 0.5; + } } + .achievement-popup { position: fixed; top: 10px; @@ -137,8 +167,14 @@ function checkAchievements() { box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); animation: fadeOut 3s forwards; } + @keyframes fadeOut { - 0% { opacity: 1; } - 100% { opacity: 0; } + 0% { + opacity: 1; + } + + 100% { + opacity: 0; + } }