User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'graphics')' in this line: 'self.graphics.isTeaching = false;' Line Number: 110
User prompt
Fix Bug: 'Uncaught TypeError: Cannot set properties of undefined (setting 'isTeaching')' in this line: 'self.isTeaching = false;' Line Number: 110
User prompt
Fix Bug: 'Uncaught TypeError: Cannot set properties of undefined (setting 'isTeaching')' in this line: 'self.isTeaching = false;' Line Number: 110
User prompt
Fix Bug: 'Uncaught TypeError: Cannot set properties of undefined (setting 'isTeaching')' in this line: 'self.isTeaching = true;' Line Number: 110
User prompt
add one type of each building at the begining
User prompt
Fix Bug: 'Uncaught TypeError: Cannot set properties of undefined (setting 'isTeaching')' in this line: 'self.isTeaching = false;' Line Number: 110
User prompt
Fix Bug: 'Uncaught TypeError: Cannot set properties of undefined (setting 'isTeaching')' in this line: 'self.isTeaching = false;' Line Number: 110
User prompt
add one type of each batiment at the begining
User prompt
add 5 nesw functionality
User prompt
improve villager behavior and movement base on their behavior
User prompt
add 4 new functionality
User prompt
add 3 new functionality
User prompt
add 2 new functionality
User prompt
Fix Bug: 'Uncaught TypeError: self.initializeRandomPosition is not a function' in this line: 'self.initializeRandomPosition();' Line Number: 124
User prompt
Fix Bug: 'Uncaught TypeError: self.initializeRandomPosition is not a function' in this line: 'self.initializeRandomPosition();' Line Number: 124
User prompt
Fix Bug: 'Uncaught TypeError: self.initializeRandomPosition is not a function' in this line: 'self.initializeRandomPosition();' Line Number: 124
User prompt
Fix Bug: 'Uncaught TypeError: self.initializeRandomPosition is not a function' in this line: 'self.initializeRandomPosition();' Line Number: 124
User prompt
Fix Bug: 'Uncaught TypeError: self.initializeRandomPosition is not a function' in this line: 'self.initializeRandomPosition();' Line Number: 122
User prompt
improve 2 time
User prompt
Add a day cycle in 24 hours where every hours take one second
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'expand')' in this line: 'var Farmer = Villager.expand(function (resources, iq) {' Line Number: 282
User prompt
Improve villager behavior
User prompt
Improve behavior
User prompt
Fix Bug: 'Uncaught ReferenceError: House is not defined' in this line: 'var house = new House();' Line Number: 788
User prompt
Fix Bug: 'Uncaught ReferenceError: House is not defined' in this line: 'var home = new House();' Line Number: 764
===================================================================
--- original.js
+++ change.js
@@ -1,11 +1,11 @@
-var RandomPositionInitializer = Container.expand(function () {
+var PositionInitializer = Container.expand(function () {
var self = Container.call(this);
- self.initializeRandomPosition = function (building, graphics) {
+ self.initializeRandomPosition = function (entity, width, height, overlapCheckCallback) {
do {
- building.x = Math.random() * (2048 - graphics.width) + graphics.width / 2;
- building.y = Math.random() * (2732 - graphics.height) + graphics.height / 2;
- } while (building.parent && building.checkOverlapWithOtherBuildings());
+ entity.x = Math.random() * (2048 - width) + width / 2;
+ entity.y = Math.random() * (2732 - height) + height / 2;
+ } while (entity.parent && overlapCheckCallback(entity));
};
});
var Building = Container.expand(function (assetName) {
var self = Container.call(this);
@@ -23,9 +23,8 @@
var positionInitializer = new RandomPositionInitializer();
positionInitializer.initializeRandomPosition(self, self.graphics);
});
var School = Building.expand(function () {
- var self = Container.call(this);
var self = Building.call(this, 'School');
self.isTeaching = false;
self.teach = function (villager) {
if (!self.isTeaching) return;
@@ -54,13 +53,11 @@
}
};
});
var Food = Resource.expand(function () {
- var self = Container.call(this);
var self = Resource.call(this, 'Food', 100);
});
var Rock = Resource.expand(function () {
- var self = Container.call(this);
var self = Resource.call(this, 'Rock', 100);
});
var ResourceDisplay = Container.expand(function (resources) {
var self = Container.call(this);
@@ -109,14 +106,10 @@
});
var Well = Container.expand(function () {
var self = Container.call(this);
self.wellGraphics = self.createAsset('well', 'Well Graphics', .5, .5);
- self.initializeRandomPosition = function () {
- do {
- self.x = Math.random() * (2048 - self.wellGraphics.width) + self.wellGraphics.width / 2;
- self.y = Math.random() * (2732 - self.wellGraphics.height) + self.wellGraphics.height / 2;
- } while (self.parent && self.checkOverlapWithOtherBuildings());
- };
+ var positionInitializer = new PositionInitializer();
+ positionInitializer.initializeRandomPosition(self, self.wellGraphics.width, self.wellGraphics.height, self.checkOverlapWithOtherBuildings);
self.checkOverlapWithOtherBuildings = function () {
var buildings = self.parent.children.filter(function (child) {
return child !== self && child instanceof Building;
});
@@ -251,17 +244,14 @@
};
self.initializePosition();
});
var Wood = Resource.expand(function () {
- var self = Container.call(this);
var self = Resource.call(this, 'Wood', 100);
});
var RockResource = Resource.expand(function () {
- var self = Container.call(this);
var self = Resource.call(this, 'Rock', 100);
});
var FoodResource = Resource.expand(function () {
- var self = Container.call(this);
var self = Resource.call(this, 'Food', 100);
});
var Tree = Container.expand(function () {
var self = Container.call(this);
@@ -648,9 +638,9 @@
var well = new Well();
self.addChild(well);
self.resources = createResources();
self.resourceDisplay = new ResourceDisplay(self.resources);
- LK.gui.addChild(self.resourceDisplay);
+ LK.gui.topLeft.addChild(self.resourceDisplay);
Game.prototype.handleVillagersFallingInLove = function () {
for (var i = 0; i < this.villagers.length; i++) {
for (var j = i + 1; j < this.villagers.length; j++) {
var villagerA = this.villagers[i];
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.