|
|
|
@@ -77,6 +77,7 @@ function eatMicro() { |
|
|
|
|
|
|
|
function setup() { |
|
|
|
initializeData(); |
|
|
|
createButtons(); |
|
|
|
registerListeners(); |
|
|
|
|
|
|
|
console.log(belongings) |
|
|
|
@@ -98,6 +99,35 @@ function registerListeners() { |
|
|
|
document.querySelector("#tasty-micro").addEventListener("click", eatMicro); |
|
|
|
} |
|
|
|
|
|
|
|
function createButtons() { |
|
|
|
createBuildings(); |
|
|
|
createUpgrades(); |
|
|
|
} |
|
|
|
|
|
|
|
function createBuildings() { |
|
|
|
let container = document.querySelector("#buildings-area"); |
|
|
|
|
|
|
|
for (const [key, value] of Object.entries(buildings)) { |
|
|
|
console.log(key, value) |
|
|
|
let button = document.createElement("div"); |
|
|
|
button.classList.add("building-button"); |
|
|
|
button.id = "building-" + key; |
|
|
|
let buttonName = document.createElement("div"); |
|
|
|
buttonName.classList.add("building-button-name"); |
|
|
|
let buttonCost = document.createElement("div"); |
|
|
|
buttonCost.classList.add("building-button-cost"); |
|
|
|
|
|
|
|
button.appendChild(buttonName); |
|
|
|
button.appendChild(buttonCost); |
|
|
|
|
|
|
|
container.appendChild(button); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function createUpgrades() { |
|
|
|
// wat |
|
|
|
} |
|
|
|
|
|
|
|
window.onload = function() { |
|
|
|
setup(); |
|
|
|
|
|
|
|
|