User prompt
Create différents asset for each villager type
User prompt
Fix Bug: 'TypeError: this.seekResource is not a function' in this line: 'this.seekResource(this.state.substring(7).toLowerCase());' Line Number: 796
User prompt
Fix Bug: 'TypeError: this.seekResource is not a function' in this line: 'this.seekResource('food');' Line Number: 796
User prompt
Spawn a New villager every 0.1 second
User prompt
Fix villager not apairing
User prompt
Add 4 of each villager type at launch
User prompt
Fix Bug: 'Uncaught ReferenceError: Villager is not defined' in this line: 'Villager.prototype.isDoingSomething = function () {' Line Number: 771
User prompt
Fix Bug: 'Cannot read properties of undefined (reading 'villagers')' in this line: 'self.gameInstance.villagers.forEach(function (villager) {' Line Number: 7
User prompt
Villager need to have différents asset base on their job
User prompt
Add 4 of each type of villager at launch
User prompt
Fix Bug: 'Cannot read properties of undefined (reading 'villagers')' in this line: 'self.gameInstance.villagers.forEach(function (villager) {' Line Number: 7
User prompt
Add 8 new functionality
User prompt
Fix Bug: 'Cannot read properties of null (reading 'villagers')' in this line: 'self.parent.villagers.forEach(function (villager) {' Line Number: 7
User prompt
Fix Bug: 'Uncaught ReferenceError: Market is not defined' in this line: 'self.market = new Market();' Line Number: 1119
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'addChild')' in this line: 'self.addChild(self.weatherSystem);' Line Number: 807
User prompt
Fix Bug: 'Uncaught TypeError: this.addChild is not a function' in this line: 'this.addChild(this.weatherSystem);' Line Number: 807
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'addChild')' in this line: 'self.addChild(self.weatherSystem);' Line Number: 807
User prompt
Fix Bug: 'Uncaught TypeError: this.addChild is not a function' in this line: 'this.addChild(this.weatherSystem);' Line Number: 807
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'addChild')' in this line: 'self.addChild(weatherSystem);' Line Number: 807
User prompt
Add 5 New functionality
User prompt
Add 16 new functionality
User prompt
Add a building of each type
User prompt
Add a building of one type at launch
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
===================================================================
--- original.js
+++ change.js
@@ -207,20 +207,20 @@
if (villager.happiness > 100) villager.happiness = 100;
});
};
});
-var Apothecary = Container.expand(function () {
+var Healer = Container.expand(function (resources) {
var self = Container.call(this);
- self.apothecaryGraphics = self.createAsset('apothecary', 'Apothecary Graphics', 0.5, 0.5);
- var positionInitializer = new PositionInitializer();
- positionInitializer.initializeRandomPosition(self, self.apothecaryGraphics.width, self.apothecaryGraphics.height, function () {
- return self.checkOverlapWithOtherBuildings();
- });
- self.provideMedicine = function (villager) {
- if (villager.gameResources.food.amount >= 2) {
- villager.gameResources.food.amount -= 2;
- villager.health += 10;
- if (villager.health > 100) villager.health = 100;
+ self.gameResources = resources;
+ self.healingPower = 10;
+ self.x = Math.random() * 2048;
+ self.y = Math.random() * 2732;
+ var healerGraphics = self.createAsset('healer', 'Healer Graphics', 0.5, 0.5);
+ self.addChild(healerGraphics);
+ self.heal = function (apothecary) {
+ if (apothecary instanceof Apothecary) {
+ self.gameResources.health.amount += self.healingPower;
+ if (self.gameResources.health.amount > 100) self.gameResources.health.amount = 100;
}
};
});
var BlacksmithShop = Container.expand(function () {
@@ -244,26 +244,15 @@
self.addChild(self.guardGraphics);
self.x = Math.random() * 2048;
self.y = Math.random() * 2732;
self.speed = 2;
- self.isDaytime = true;
- self.patrolArea = function () {
- if (!self.isDaytime) {
+ self.patrolArea = function (guardTower) {
+ if (guardTower instanceof GuardTower) {
var patrolX = Math.random() * 2048;
var patrolY = Math.random() * 2732;
self.moveTo(patrolX, patrolY, self.speed);
}
};
- self.sleep = function () {
- if (self.isDaytime) {}
- };
- LK.on('tick', function () {
- if (self.isDaytime) {
- self.sleep();
- } else {
- self.patrolArea();
- }
- });
});
var Brewery = Container.expand(function () {
var self = Container.call(this);
self.breweryGraphics = self.createAsset('brewery', 'Brewery Graphics', 0.5, 0.5);
@@ -280,16 +269,17 @@
}, 30000);
};
self.produceBeverage();
});
-var Lumberjack = Container.expand(function (resources) {
+var Forester = Container.expand(function (resources) {
var self = Container.call(this);
self.gameResources = resources;
self.choppingPower = 5;
+ self.plantingPower = 1;
self.x = Math.random() * 2048;
self.y = Math.random() * 2732;
- var lumberjackGraphics = self.createAsset('lumberjack', 'Lumberjack Graphics', 0.5, 0.5);
- self.addChild(lumberjackGraphics);
+ var foresterGraphics = self.createAsset('forester', 'Forester Graphics', 0.5, 0.5);
+ self.addChild(foresterGraphics);
self.chop = function (tree) {
if (tree instanceof Tree) {
self.gameResources.wood.amount += self.choppingPower;
if (self.gameResources.wood.amount > 100) self.gameResources.wood.amount = 100;
@@ -298,8 +288,16 @@
tree.destroy();
}
}
};
+ self.plantTree = function () {
+ var newTree = new Tree();
+ newTree.x = Math.random() * 2048;
+ newTree.y = Math.random() * 2732;
+ if (self.parent) {
+ self.parent.addChild(newTree);
+ }
+ };
});
var Miner = Container.expand(function (resources) {
var self = Container.call(this);
self.gameResources = resources;
@@ -307,10 +305,10 @@
self.x = Math.random() * 2048;
self.y = Math.random() * 2732;
var minerGraphics = self.createAsset('miner', 'Miner Graphics', 0.5, 0.5);
self.addChild(minerGraphics);
- self.mine = function (rock) {
- if (rock instanceof Rock) {
+ self.mine = function (quarry) {
+ if (quarry instanceof Quarry) {
self.gameResources.rock.amount += self.miningPower;
if (self.gameResources.rock.amount > 100) self.gameResources.rock.amount = 100;
}
};
@@ -322,10 +320,10 @@
self.x = Math.random() * 2048;
self.y = Math.random() * 2732;
var fishermanGraphics = self.createAsset('fisherman', 'Fisherman Graphics', 0.5, 0.5);
self.addChild(fishermanGraphics);
- self.fish = function (well) {
- if (well instanceof Well) {
+ self.fish = function (fishingHut) {
+ if (fishingHut instanceof FishingHut) {
self.gameResources.food.amount += self.fishingPower;
if (self.gameResources.food.amount > 100) self.gameResources.food.amount = 100;
}
};
@@ -354,21 +352,22 @@
};
var positionInitializer = new PositionInitializer();
positionInitializer.initializeRandomPosition(self, self.graphics.width, self.graphics.height, self.checkOverlapWithOtherBuildings);
});
-var School = Building.expand(function () {
- var self = Building.call(this, 'School');
- self.isTeaching = false;
- self.teach = function (villager) {
- if (!self.isTeaching) return;
- villager.iq += 10;
+var Teacher = Container.expand(function (resources) {
+ var self = Container.call(this);
+ self.gameResources = resources;
+ self.teachingPower = 10;
+ self.x = Math.random() * 2048;
+ self.y = Math.random() * 2732;
+ var teacherGraphics = self.createAsset('teacher', 'Teacher Graphics', 0.5, 0.5);
+ self.addChild(teacherGraphics);
+ self.teach = function (school) {
+ if (school instanceof School) {
+ self.gameResources.iq.amount += self.teachingPower;
+ if (self.gameResources.iq.amount > 200) self.gameResources.iq.amount = 200;
+ }
};
- self.startTeaching = function () {
- self.isTeaching = true;
- LK.setTimeout(function () {
- self.isTeaching = false;
- }, 20000);
- };
});
var Resource = Container.expand(function (type, amount) {
var self = Container.call(this);
self.type = type;
@@ -643,17 +642,19 @@
});
var Merchant = Container.expand(function (resources) {
var self = Container.call(this);
self.gameResources = resources;
- self.currentAction = null;
- self.targetX = null;
- self.targetY = null;
- self.speed = 1;
- self.energy = 100;
- self.tiredness = 0;
- self.state = 'idle';
- self.home = null;
- self.workplace = null;
+ self.tradingPower = 5;
+ self.x = Math.random() * 2048;
+ self.y = Math.random() * 2732;
+ var merchantGraphics = self.createAsset('merchant', 'Merchant Graphics', 0.5, 0.5);
+ self.addChild(merchantGraphics);
+ self.trade = function (marketplace, resourceType, amount) {
+ if (marketplace instanceof Marketplace && self.gameResources[resourceType].amount >= amount) {
+ self.gameResources[resourceType].amount -= amount;
+ marketplace.addResource(resourceType, amount);
+ }
+ };
});
var DayNightCycleManager = Container.expand(function () {
var self = Container.call(this);
self.cycleDuration = 24000;
@@ -689,33 +690,20 @@
}
return villager;
};
});
-var Bakery = Container.expand(function () {
+var Baker = Container.expand(function (resources) {
var self = Container.call(this);
- self.bakeryGraphics = self.createAsset('bakery', 'Bakery Graphics', 0.5, 0.5);
- self.initializeRandomPosition = function () {
- do {
- self.x = Math.random() * (2048 - self.bakeryGraphics.width) + self.bakeryGraphics.width / 2;
- self.y = Math.random() * (2732 - self.bakeryGraphics.height) + self.bakeryGraphics.height / 2;
- } while (self.parent && self.checkOverlapWithOtherBuildings());
- };
- self.checkOverlapWithOtherBuildings = function () {
- var buildings = self.parent.children.filter(function (child) {
- return child !== self && child instanceof Building;
- });
- return buildings.some(function (building) {
- var dx = self.x - building.x;
- var dy = self.y - building.y;
- return Math.sqrt(dx * dx + dy * dy) < 300 + Math.max(self.bakeryGraphics.width, self.bakeryGraphics.height) / 2 + Math.max(building.width, building.height) / 2;
- });
- };
- self.bakeBread = function (villager) {
- if (villager.gameResources.wood.amount >= 5 && villager.gameResources.food.amount >= 2) {
- villager.gameResources.wood.amount -= 5;
- villager.gameResources.food.amount -= 2;
- villager.gameResources.food.amount += 10;
- if (villager.gameResources.food.amount > 100) villager.gameResources.food.amount = 100;
+ self.gameResources = resources;
+ self.bakingPower = 10;
+ self.x = Math.random() * 2048;
+ self.y = Math.random() * 2732;
+ var bakerGraphics = self.createAsset('baker', 'Baker Graphics', 0.5, 0.5);
+ self.addChild(bakerGraphics);
+ self.bakeBread = function (bakery) {
+ if (bakery instanceof Bakery) {
+ self.gameResources.food.amount += self.bakingPower;
+ if (self.gameResources.food.amount > 100) self.gameResources.food.amount = 100;
}
};
});
var Cloud = Container.expand(function () {
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.