File size: 1,194 Bytes
ad41998
 
 
 
 
 
 
8a26058
ad41998
 
 
 
 
8a26058
ad41998
 
8a26058
ad41998
8a26058
 
ad41998
 
 
 
8a26058
 
 
 
 
 
 
 
ad41998
8a26058
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
30
31
32
33
34
class GameStage {
    constructor(canvas) {
        this.canvas = canvas;
        this.ctx = canvas.getContext("2d");
        this.resources = { food: 0 };
        this.population = 1;
        this.maxPopulation = 5;
        this.relations = "Neutral"; // Tribal relations
    }

    updateUI() {
        document.getElementById("resources").textContent = `Food: ${this.resources.food}`;
        document.getElementById("population").textContent = `Tribe: ${this.population}/${this.maxPopulation}`;
        document.getElementById("relations").textContent = `Relations: ${this.relations}`;
    }

    loadAsset(url) {
        const img = new Image();
        img.crossOrigin = "Anonymous"; // For CORS compatibility
        img.src = url;
        return img;
    }
}

// Global UI functions
function gatherFood() { game.gatherFood(); }
function buildHut() { game.buildHut(); }
function attackTribe() { game.attackTribe(); }
function socializeTribe() { game.socializeTribe(); }
function toggleEditor() {
    const editor = document.getElementById("editor");
    editor.style.display = editor.style.display === "none" ? "block" : "none";
}
function applyChanges() { game.applyCreatureChanges(); }