Browse Source

Allow for stats to be hidden

tags/v0.1.3
Fen Dweller 5 years ago
parent
commit
1de392dc57
1 changed files with 9 additions and 0 deletions
  1. +9
    -0
      game.js

+ 9
- 0
game.js View File

@@ -86,6 +86,15 @@ function renderTime(time) {
function updateStatDisplay(stats, statType) {
Object.entries(stats).forEach(([key, val]) => {

if (val.hidden === true) {
const field = document.querySelector("#" + statType + "-info-" + key);
field.style.display = "none";
} else if (val.hidden === false) {
const field = document.querySelector("#" + statType + "-info-" + key);
field.style.display = "block";
}

if (val.type == "meter") {
const field = document.querySelector("#" + statType + "-info-" + key + " > .stat-bar");
field.style.width = (val.value / val.max * 100) + "%";


Loading…
Cancel
Save