From eece543199ad074775c7653b3d11ccc8ad1f7a63 Mon Sep 17 00:00:00 2001 From: MrEidam Date: Thu, 12 Sep 2024 17:32:47 +0200 Subject: [PATCH] yipee --- main.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/main.js b/main.js index b525bdf..9ffd660 100644 --- a/main.js +++ b/main.js @@ -7,6 +7,8 @@ const Dfood = document.querySelector('#fooN'); const Dclean = document.querySelector('#cleN'); const Dhealth = document.querySelector('#heaN'); +let coins = 0; + let chosenAnimal = 'tiger'; const animalImage = { @@ -72,8 +74,26 @@ window.addEventListener('load',() => { ////choseTime(); display(); time(); + money(); }); +function money(){ + setTimeout (() => { + if(loadMoney != null){ + localStorage.setItem('PetPet-Money', JSON.stringify(coins)); + } + + + display(); + money(); + },1000); +} + +function loadMoney(){ + const boardString = localStorage.getItem('PetPet-Money'); // Retrieve the JSON string from local storage + return boardString ? JSON.parse(boardString) : null; // Parse the JSON string back into an array +} + function choseTime(){//todo Drop down displaying fucken thing console.log('add stuff'); }