Spaces:
Sleeping
Sleeping
File size: 687 Bytes
ad41998 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
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();
} |