From 67c7f4cebd4b08f8b4b4c573b56c219fa484dee2 Mon Sep 17 00:00:00 2001 From: RubixYouTube <111435714+RubixYouTube@users.noreply.github.com> Date: Sat, 21 Sep 2024 20:52:04 -0500 Subject: [PATCH] Imma commit updateness! ;D (v0.2.0a) finally a alpha --- index.html | 105 ++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 95 insertions(+), 10 deletions(-) diff --git a/index.html b/index.html index 435da15..5f004e7 100644 --- a/index.html +++ b/index.html @@ -11,20 +11,23 @@ } .popup { position: fixed; - top: 20px; + top: 50%; left: 50%; - transform: translateX(-50%); - background-color: yellow; - color: black; + transform: translate(-50%, -50%); width: 512px; - height: 52px; + height: 300px; display: flex; + flex-direction: column; align-items: center; justify-content: center; border-radius: 5px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); opacity: 0; - transition: opacity 0.3s ease; + transition: opacity 1.25s ease; + backdrop-filter: blur(10px); + } + .popup.visible { + opacity: 1; } .version { position: fixed; @@ -59,6 +62,17 @@ const popup = document.getElementById('popup'); const achievement = document.getElementById('achievement'); const achievementContent = document.getElementById('achievement-content'); + const saveData = localStorage.getItem('saveData'); + + if (saveData) { + const data = JSON.parse(saveData); + hz = data.hz; + gain = data.gain; + cost = data.cost; + hzDisplay.textContent = `${Math.floor(hz)} Hz`; + gainDisplay.textContent = `Gain: ${gain}Hz/s`; + costDisplay.textContent = `${cost}Hz`; + } function updateHz() { hz += gain / 30; // Update every 1/30 second @@ -68,6 +82,7 @@ achievement.textContent = 'First Hertz Complete'; showPopup('Achievement Complete: First Hertz'); } + saveGame(); } function showPopup(message) { @@ -78,6 +93,15 @@ }, 3000); } + function saveGame() { + const data = { + hz: hz, + gain: gain, + cost: cost + }; + localStorage.setItem('saveData', JSON.stringify(data)); + } + setInterval(updateHz, 1000 / 30); // Update every 1/30 second document.getElementById('upgrade-button').addEventListener('click', function() { @@ -91,6 +115,42 @@ } }); + document.getElementById('max-button').addEventListener('click', function() { + while (hz >= cost) { + hz -= cost; + gain *= 2; + cost *= 2; + } + hzDisplay.textContent = `${Math.floor(hz)} Hz`; + gainDisplay.textContent = `Gain: ${gain}Hz/s`; + costDisplay.textContent = `${cost}Hz`; + }); + + document.getElementById('save-button').addEventListener('click', saveGame); + + document.getElementById('load-button').addEventListener('click', function() { + popup.classList.add('visible'); + }); + + document.getElementById('cancel-button').addEventListener('click', function() { + popup.classList.remove('visible'); + }); + + document.getElementById('submit-button').addEventListener('click', function() { + const saveInput = document.getElementById('save-input').value; + if (saveInput) { + const data = JSON.parse(saveInput); + hz = data.hz; + gain = data.gain; + cost = data.cost; + hzDisplay.textContent = `${Math.floor(hz)} Hz`; + gainDisplay.textContent = `Gain: ${gain}Hz/s`; + costDisplay.textContent = `${cost}Hz`; + saveGame(); + popup.classList.remove('visible'); + } + }); + const tabs = document.querySelectorAll('.tab'); tabs.forEach(tab => { tab.addEventListener('click', function() { @@ -103,14 +163,17 @@ this.classList.add('bg-white', 'text-black'); document.getElementById('hz-content').classList.remove('hidden'); document.getElementById('achievement-content').classList.add('hidden'); + document.getElementById('settings-content').classList.add('hidden'); } else if (this.id === 'tab-achievements') { this.classList.add('bg-green-500', 'text-black'); document.getElementById('hz-content').classList.add('hidden'); document.getElementById('achievement-content').classList.remove('hidden'); + document.getElementById('settings-content').classList.add('hidden'); } else if (this.id === 'tab-settings') { this.classList.add('bg-orange-500', 'text-black'); document.getElementById('hz-content').classList.add('hidden'); document.getElementById('achievement-content').classList.add('hidden'); + document.getElementById('settings-content').classList.remove('hidden'); } }); }); @@ -141,16 +204,38 @@
Double Gain Speed
Double Click Gain
- +
+ + +
10Hz
+ + + + - -
v0.1.0
+
v0.2.0a