Spaces:
Sleeping
Sleeping
class GameStage { | |
constructor(canvas) { | |
this.canvas = canvas; | |
this.ctx = canvas.getContext("2d"); | |
this.resources = { food: 0 }; | |
this.population = 1; | |
this.maxPopulation = 5; | |
} | |
updateUI() { | |
document.getElementById("resources").textContent = `Food: ${this.resources.food}`; | |
document.getElementById("population").textContent = `Tribe: ${this.population}/${this.maxPopulation}`; | |
} | |
loadAsset(path) { | |
const img = new Image(); | |
img.src = path; | |
return img; | |
} | |
} | |
// Global functions for UI buttons | |
function gatherFood() { | |
game.gatherFood(); | |
} | |
function buildHut() { | |
game.buildHut(); | |
} |