User prompt
Fix Bug: 'TypeError: villagerA.kiss is not a function' in this line: 'villagerA.kiss(villagerB);' Line Number: 331
User prompt
Fix
User prompt
Fix Bug: 'Uncaught ReferenceError: houses is not defined' in this line: 'houses.push(house);' Line Number: 407
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'houses')' in this line: 'self.self.houses.push(house);' Line Number: 386
User prompt
Fix Bug: 'Uncaught ReferenceError: houses is not defined' in this line: 'houses.push(house);' Line Number: 407
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'houses')' in this line: 'self.self.houses.push(house);' Line Number: 386
User prompt
Fix Bug: 'Uncaught ReferenceError: houses is not defined' in this line: 'houses.push(house);' Line Number: 407
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'houses')' in this line: 'self.self.houses.push(house);' Line Number: 386
User prompt
Fix Bug: 'Uncaught ReferenceError: houses is not defined' in this line: 'houses.push(house);' Line Number: 407
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'houses')' in this line: 'self.self.houses.push(house);' Line Number: 386
User prompt
Fix Bug: 'Uncaught ReferenceError: houses is not defined' in this line: 'houses.push(house);' Line Number: 407
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'houses')' in this line: 'this.self.houses.push(house);' Line Number: 386
User prompt
Fix Bug: 'Uncaught ReferenceError: houses is not defined' in this line: 'houses.push(house);' Line Number: 407
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'houses')' in this line: 'this.self.houses.push(house);' Line Number: 386
User prompt
Fix Bug: 'Uncaught ReferenceError: houses is not defined' in this line: 'houses.push(house);' Line Number: 407
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'push')' in this line: 'this.workplaces.push(workplace);' Line Number: 398
User prompt
Fix Bug: 'Uncaught ReferenceError: houses is not defined' in this line: 'houses.push(newHouse);' Line Number: 389
User prompt
fix
User prompt
fix villager dont moving
User prompt
Fix Bug: 'Uncaught ReferenceError: ResourceDisplay is not defined' in this line: 'self.resourceDisplay = new ResourceDisplay(self.resources);' Line Number: 312
User prompt
Fix Bug: 'Uncaught ReferenceError: FramerateDisplay is not defined' in this line: 'self.framerateDisplay = new FramerateDisplay();' Line Number: 311
User prompt
fix
User prompt
make the background visible
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'push')' in this line: 'this.workplaces.push(workplace);' Line Number: 442
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'houses')' in this line: 'this.self.houses.push(house);' Line Number: 429
===================================================================
--- original.js
+++ change.js
@@ -1,4 +1,8 @@
+var Romance = Container.expand(function () {
+ var self = Container.call(this);
+ self.kiss = function (villagerA, villagerB) {};
+});
var ResourceDisplay = Container.expand(function (resources) {
var self = Container.call(this);
self.resources = resources;
self.update = function () {};
@@ -179,9 +183,8 @@
};
});
var Villager = Container.expand(function (resources) {
var self = Container.call(this);
- Villager.prototype.kiss = function (otherVillager) {};
self.gameResources = resources;
var villagerGraphics = self.createAsset('villager', 'Villager Graphics', .5, .5);
self.initializeVillager();
});
@@ -238,24 +241,9 @@
Villager.prototype.initializePosition = function (x, y) {
this.x = x;
this.y = y;
};
-Villager.prototype.update = function () {
- if (this.targetX !== null && this.targetY !== null) {
- var dx = this.targetX - this.x;
- var dy = this.targetY - this.y;
- var distance = Math.sqrt(dx * dx + dy * dy);
- if (distance < this.speed) {
- this.x = this.targetX;
- this.y = this.targetY;
- this.targetX = null;
- this.targetY = null;
- } else {
- this.x += dx / distance * this.speed;
- this.y += dy / distance * this.speed;
- }
- }
-};
+Villager.prototype.update = function () {};
var Game = Container.expand(function () {
var self = Container.call(this);
Game.prototype.decideNextAction = function (villager) {};
Game.prototype.executeCurrentAction = function (villager) {};
@@ -316,8 +304,9 @@
self.timerText.x = 2048 - 500;
self.timerText.y = 2732;
LK.gui.topCenter.addChild(self.timerText);
self.startTime = Date.now();
+ self.villagers = [];
var market = new Market();
self.addChild(market);
var inn = new Inn();
self.addChild(inn);
@@ -365,30 +354,36 @@
this.registerVillager(villager);
};
self.villagers = [];
self.houses = [];
- self.workplaces = [];
self.cloudLayer = new Container();
LK.stageContainer.addChild(self.cloudLayer);
self.clouds = [];
for (var i = 0; i < 5; i++) {
var cloud = new Cloud();
self.clouds.push(cloud);
self.cloudLayer.addChild(cloud);
}
+ self.addVillager(self.createVillager(1024, 1366));
+ for (var i = 0; i < 10; i++) {
+ self.addVillager(self.createVillager(Math.random() * 2048, Math.random() * 2732));
+ }
+ self.market = new Market();
+ self.addChild(self.market);
Game.prototype.createHouse = function (x, y) {
var house = new House();
house.x = x;
house.y = y;
return house;
};
Game.prototype.addHouse = function (house) {
this.addChild(house);
- self.self.houses.push(house);
+ this.houses.push(house);
};
+ var houses = [];
var newHouse = self.createHouse(2048 / 2, 2732 / 2);
self.addHouse(newHouse);
- self.houses.push(newHouse);
+ houses.push(newHouse);
Game.prototype.createWorkplace = function () {
var workplace = new EmployingWorkPlace();
workplace.x = Math.random() * 2048;
workplace.y = Math.random() * 2732;
@@ -397,8 +392,9 @@
Game.prototype.addWorkplace = function (workplace) {
this.addChild(workplace);
this.workplaces.push(workplace);
};
+ self.workplaces = [];
var workplace = self.createWorkplace();
self.addWorkplace(workplace);
self.workplaces.push(workplace);
var house = new House();
@@ -413,8 +409,22 @@
self.addChild(workplace);
self.villagerCreationInterval = LK.setInterval(function () {
self.createAndAddVillagerIfPossible();
}, 10000);
+ LK.on('tick', function () {
+ var currentTime = Date.now();
+ var elapsedTime = Math.floor((currentTime - self.startTime) / 1000);
+ self.timerText.setText('Time: ' + elapsedTime);
+ self.updateResourceDisplay();
+ for (var i = 0; i < self.villagers.length; i++) {
+ self.villagers[i].update();
+ }
+ self.handleVillagersFallingInLove();
+ self.updateDayNightCycle();
+ for (var i = 0; i < self.clouds.length; i++) {
+ self.clouds[i].move();
+ }
+ });
self.updateDayNightCycle = function () {
var cycleDuration = 5000;
var time = (Date.now() - self.startTime) % cycleDuration;
var dayProgress = time / cycleDuration * 2 * Math.PI;
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.