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(); };