From 3d97fbb73c258f86e62623e1516d82a917cbbea5 Mon Sep 17 00:00:00 2001 From: zyl Date: Mon, 24 Jun 2024 23:24:19 -0700 Subject: [PATCH] wowie fixed some bugs whoopsie --- site/root/js/pet.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/site/root/js/pet.js b/site/root/js/pet.js index aa1e4f9..f6f1e8d 100644 --- a/site/root/js/pet.js +++ b/site/root/js/pet.js @@ -122,7 +122,7 @@ /** how much mess the pet has made */ messCounter = 0; /** the pet's current happiness */ - #happiness = MAX_HAPPINESS; + _happiness = MAX_HAPPINESS; /** the time the pet was last updated */ lastUpdate = Date.now(); /** the time the egg was found */ @@ -312,7 +312,7 @@ /** the pet's happiness */ get happiness() { - return this.#happiness; + return this._happiness; } set happiness(amount) { @@ -321,7 +321,7 @@ } else if (amount > MAX_HAPPINESS) { amount = MAX_HAPPINESS; } - this.#happiness = amount; + this._happiness = amount; } } @@ -386,6 +386,11 @@ btn.addEventListener("click", advance); } + passedAwayInfo.querySelector("button").addEventListener("click", () => { + pet = new Pet(); + pet.updateDom(); + }); + const update = () => { pet.update(); };