Spaces:
Sleeping
Sleeping
Update static/tribalStage.js
Browse files- static/tribalStage.js +8 -0
static/tribalStage.js
CHANGED
@@ -8,6 +8,7 @@ class TribalStage extends GameStage {
|
|
8 |
this.creatureImg = this.loadAsset("https://kenney.nl/assets/rpg-character/character.png");
|
9 |
this.hutImg = this.loadAsset("https://opengameart.org/sites/default/files/hut.png");
|
10 |
this.rivalImg = this.loadAsset("https://kenney.nl/assets/rpg-enemies/enemy.png");
|
|
|
11 |
}
|
12 |
|
13 |
init() {
|
@@ -97,6 +98,13 @@ class TribalStage extends GameStage {
|
|
97 |
if (this.hutImg.complete) this.ctx.drawImage(this.hutImg, hut.x, hut.y, 48, 48);
|
98 |
});
|
99 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
// Draw rival tribes
|
101 |
this.rivalTribes.forEach(tribe => {
|
102 |
if (this.rivalImg.complete) this.ctx.drawImage(this.rivalImg, tribe.x, tribe.y, 32, 32);
|
|
|
8 |
this.creatureImg = this.loadAsset("https://kenney.nl/assets/rpg-character/character.png");
|
9 |
this.hutImg = this.loadAsset("https://opengameart.org/sites/default/files/hut.png");
|
10 |
this.rivalImg = this.loadAsset("https://kenney.nl/assets/rpg-enemies/enemy.png");
|
11 |
+
this.firepitImg = this.loadAsset("https://opengameart.org/sites/default/files/campfire.png");
|
12 |
}
|
13 |
|
14 |
init() {
|
|
|
98 |
if (this.hutImg.complete) this.ctx.drawImage(this.hutImg, hut.x, hut.y, 48, 48);
|
99 |
});
|
100 |
|
101 |
+
// Draw firepits (optional decoration)
|
102 |
+
this.huts.forEach((hut, i) => {
|
103 |
+
if (i % 2 === 0 && this.firepitImg.complete) {
|
104 |
+
this.ctx.drawImage(this.firepitImg, hut.x + 20, hut.y + 20, 32, 32);
|
105 |
+
}
|
106 |
+
});
|
107 |
+
|
108 |
// Draw rival tribes
|
109 |
this.rivalTribes.forEach(tribe => {
|
110 |
if (this.rivalImg.complete) this.ctx.drawImage(this.rivalImg, tribe.x, tribe.y, 32, 32);
|