User prompt
Delete night
User prompt
Improve night
User prompt
Improve
User prompt
Fix Bug: 'TypeError: self.decideNextAction is not a function' in this line: 'self.decideNextAction(self.villagers[i]);' Line Number: 313
User prompt
Fix Bug: 'TypeError: self.decideNextAction is not a function' in this line: 'self.decideNextAction(self.villagers[i]);' Line Number: 312
User prompt
Fix Bug: 'TypeError: villager.decideNextAction is not a function' in this line: 'villager.decideNextAction();' Line Number: 303
User prompt
Fix Bug: 'TypeError: villager.decideNextAction is not a function' in this line: 'villager.decideNextAction();' Line Number: 303
User prompt
Improve
User prompt
Delete background
User prompt
Create background
User prompt
Fix Bug: 'Uncaught TypeError: self.initializeVillager is not a function' in this line: 'self.initializeVillager();' Line Number: 187
User prompt
Fix
User prompt
Fix Bug: 'TypeError: self.updateResourceDisplay is not a function' in this line: 'self.updateResourceDisplay();' Line Number: 327
User prompt
Fix
User prompt
Fix
User prompt
Fix
User prompt
Fix background
User prompt
Fix villager dont moving
User prompt
Fix villager dont moving
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'updateCycle')' in this line: 'self.dayNightCycle.updateCycle();' Line Number: 437
User prompt
Fix Bug: 'TypeError: self.updateDayNightCycle is not a function' in this line: 'self.updateDayNightCycle();' Line Number: 437
User prompt
Improve
User prompt
Remove kiss and all kiss référence
User prompt
Delete kiss
User prompt
Fix Bug: 'TypeError: villagerA.kiss is not a function' in this line: 'villagerA.kiss(villagerB);' Line Number: 331
===================================================================
--- original.js
+++ change.js
@@ -211,29 +211,35 @@
villager.home = this;
this.scheduleVillagerWork(villager);
};
});
-var DayNightCycle = Container.expand(function () {
+var DayNightCycleManager = Container.expand(function () {
var self = Container.call(this);
self.cycleDuration = 5000;
- self.updateCycle = function () {
- var time = (Date.now() - self.startTime) % self.cycleDuration;
- var dayProgress = time / self.cycleDuration * 2 * Math.PI;
- var alpha = 0.15 + 0.2 * Math.cos(dayProgress - Math.PI) * -0.5;
- LK.stageContainer.alpha = alpha;
- var hours = Math.floor(time / 3600000) % 24;
- var minutes = Math.floor(time % 3600000 / 60000);
- self.timeOfDayText.setText('Time of Day: ' + hours.toString().padStart(2, '0') + ':' + minutes.toString().padStart(2, '0'));
- };
- self.timeOfDayText = new Text2('Time of Day: 00:00', {
+ self.startTime = Date.now();
+ self.timeOfDayText = self.createTimeOfDayText();
+ LK.gui.topCenter.addChild(self.timeOfDayText);
+ LK.on('tick', self.updateCycle.bind(self));
+});
+DayNightCycleManager.prototype.createTimeOfDayText = function () {
+ var text = new Text2('Time of Day: 00:00', {
size: 50,
fill: "#ffffff"
});
- self.timeOfDayText.anchor.set(0.5, 0);
- self.timeOfDayText.x = 2048 / 2;
- self.timeOfDayText.y = 100;
- LK.gui.topCenter.addChild(self.timeOfDayText);
-});
+ text.anchor.set(0.5, 0);
+ text.x = 2048 / 2;
+ text.y = 100;
+ return text;
+};
+DayNightCycleManager.prototype.updateCycle = function () {
+ var time = (Date.now() - this.startTime) % this.cycleDuration;
+ var dayProgress = time / this.cycleDuration * 2 * Math.PI;
+ var alpha = 0.15 + 0.2 * Math.cos(dayProgress - Math.PI) * -0.5;
+ LK.stageContainer.alpha = alpha;
+ var hours = Math.floor(time / 3600000) % 24;
+ var minutes = Math.floor(time % 3600000 / 60000);
+ this.timeOfDayText.setText('Time of Day: ' + hours.toString().padStart(2, '0') + ':' + minutes.toString().padStart(2, '0'));
+};
Villager.prototype.isDoingSomething = function () {
return this.currentAction !== null;
};
Villager.prototype.initializePosition = function (x, y) {
@@ -347,18 +353,36 @@
}
Game.prototype.createVillager = function (x, y, isBaby) {
var villager = new Villager(this.resources);
villager.initializePosition(x, y);
+ villager.setAge(isBaby);
+ return villager;
+ };
+ Villager.prototype.setAge = function (isBaby) {
if (isBaby) {
- villager.scale.x = 0.5;
- villager.scale.y = 0.5;
+ this.scale.x = 0.5;
+ this.scale.y = 0.5;
+ } else {
+ this.scale.x = 1;
+ this.scale.y = 1;
}
- return villager;
};
Game.prototype.addVillager = function (villager) {
this.addChild(villager);
this.registerVillager(villager);
+ this.initializeVillager(villager);
};
+ Game.prototype.initializeVillager = function (villager) {
+ villager.speed = 2;
+ villager.energy = 100;
+ villager.tiredness = 0;
+ villager.state = 'idle';
+ villager.home = null;
+ villager.workplace = null;
+ villager.currentAction = null;
+ villager.targetX = null;
+ villager.targetY = null;
+ };
self.villagers = [];
self.houses = [];
self.cloudLayer = new Container();
self.clouds = [];
A background of a paysage with plain and without tree or montainbut no water see from the top in the air 100m by 100m Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
One human medieval villager in a warcraft 2 style Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a house in a warcraft 2 style Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A tree a rock and crambery in a RTS style Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A heart comic style Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A cloud in a comic style Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A market in a RTS fantasy style Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
An Inn in a RTS fantasy style Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
An school in a RTS fantasy style Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
An bakery in a RTS fantasy style Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A well in a RTS fantasy style Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A tree in a rts style Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
An apple in a rts style Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A rock in a rts style Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A home in a RTS and fantasy style. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A brewery in a fantasy rts style. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A lumberjack in a fantasy rts style. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a marketplace in a fantasy rts style. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a festival in a fantasy rts style. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.