User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'expand')' in this line: 'var Doctor = Villager.expand(function (resources) {' Line Number: 47
User prompt
Add 3 new functionality
User prompt
Add 5 New functionality
User prompt
Lumberjack move base on their iq
User prompt
Lumberjack move 3 time faster
User prompt
Make lumberjack move
User prompt
Show villager
User prompt
Show villager
User prompt
Make villager upfront the background
User prompt
Add 8 new functionality
User prompt
Add 6 New functionality
User prompt
Fix villager
User prompt
Fix villager not spawning
User prompt
Improve all fonctionality
User prompt
Improve
User prompt
Fix Bug: 'Cannot read properties of undefined (reading 'villagers')' in this line: 'self.gameInstance.villagers.forEach(function (villager) {' Line Number: 8
User prompt
Improve the entire code in two pass
User prompt
Fix Bug: 'Cannot read properties of undefined (reading 'villagers')' in this line: 'self.gameInstance.villagers.forEach(function (villager) {' Line Number: 8
User prompt
Improve the entire code
User prompt
Fix Bug: 'TypeError: this.performAction is not a function' in this line: 'this.performAction();' Line Number: 852
User prompt
Fix Bug: 'TypeError: this.performAction is not a function' in this line: 'this.performAction();' Line Number: 852
User prompt
Fix Bug: 'TypeError: villager.decideNextAction is not a function' in this line: 'villager.decideNextAction();' Line Number: 995
User prompt
Fix Bug: 'TypeError: villager.decideNextAction is not a function' in this line: 'villager.decideNextAction();' Line Number: 995
User prompt
Fix Bug: 'TypeError: villager.updateStateAndPosition is not a function' in this line: 'villager.updateStateAndPosition();' Line Number: 1005
User prompt
Fix Bug: 'TypeError: villager.updateStateAndPosition is not a function' in this line: 'villager.updateStateAndPosition();' Line Number: 1005
===================================================================
--- original.js
+++ change.js
@@ -1,4 +1,22 @@
+var TownCrier = Container.expand(function () {
+ var self = Container.call(this);
+ self.crierGraphics = self.createAsset('townCrier', 'Town Crier Graphics', 0.5, 0.5);
+ self.x = 2048 / 2;
+ self.y = 2732 / 2;
+ self.announce = function (message) {
+ var announcement = new Text2(message, {
+ size: 100,
+ fill: "#ffffff"
+ });
+ announcement.x = self.x;
+ announcement.y = self.y - 200;
+ self.addChild(announcement);
+ LK.setTimeout(function () {
+ announcement.destroy();
+ }, 5000);
+ };
+});
var VillagerBehavior = Container.expand(function (villager) {
var self = Container.call(this);
self.villager = villager;
self.decideNextAction = function () {
@@ -312,9 +330,12 @@
self.moveTo(patrolX, patrolY, self.speed);
}
};
self.sleep = function () {
- if (self.isDaytime) {}
+ if (self.isDaytime) {
+ self.x = self.home.x;
+ self.y = self.home.y;
+ }
};
LK.on('tick', function () {
if (self.isDaytime) {
self.sleep();
@@ -341,18 +362,14 @@
self.produceBeverage();
});
var Lumberjack = Container.expand(function (resources) {
var self = Container.call(this);
+ self.lumberjackGraphics = self.createAsset('lumberjack', 'Lumberjack Graphics', 0.5, 0.5);
self.gameResources = resources;
self.choppingPower = 5;
- self.x = Math.random() * 2048;
- self.y = Math.random() * 2732;
- var lumberjackGraphics = self.createAsset('lumberjack', 'Lumberjack Graphics', 0.5, 0.5);
- self.addChild(lumberjackGraphics);
- self.chop = function (tree) {
+ self.chopTree = function (tree) {
if (tree instanceof Tree) {
self.gameResources.wood.amount += self.choppingPower;
- if (self.gameResources.wood.amount > 100) self.gameResources.wood.amount = 100;
tree.amount -= self.choppingPower;
if (tree.amount <= 0) {
tree.destroy();
}
@@ -360,35 +377,24 @@
};
});
var Miner = Container.expand(function (resources) {
var self = Container.call(this);
+ self.minerGraphics = self.createAsset('miner', 'Miner Graphics', 0.5, 0.5);
self.gameResources = resources;
self.miningPower = 5;
- 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) {
+ self.mineRock = function (rock) {
if (rock instanceof Rock) {
self.gameResources.rock.amount += self.miningPower;
if (self.gameResources.rock.amount > 100) self.gameResources.rock.amount = 100;
}
};
});
var Fisherman = Container.expand(function (resources) {
var self = Container.call(this);
+ self.fishermanGraphics = self.createAsset('fisherman', 'Fisherman Graphics', 0.5, 0.5);
self.gameResources = resources;
self.fishingPower = 5;
- 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.gameResources.food.amount += self.fishingPower;
- if (self.gameResources.food.amount > 100) self.gameResources.food.amount = 100;
- }
- };
+ self.catchFish = function () {};
});
var PositionInitializer = Container.expand(function () {
var self = Container.call(this);
self.initializeRandomPosition = function (entity, width, height, overlapCheckCallback) {
@@ -675,44 +681,30 @@
};
});
var Farmer = Container.expand(function (resources) {
var self = Container.call(this);
+ self.farmerGraphics = self.createAsset('farmer', 'Farmer Graphics', 0.5, 0.5);
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.plantCrops = function () {};
+ self.harvestCrops = function () {};
});
var Blacksmith = Container.expand(function (resources) {
var self = Container.call(this);
+ self.blacksmithGraphics = self.createAsset('blacksmith', 'Blacksmith Graphics', 0.5, 0.5);
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.forgeTool = function () {};
+ self.forgeWeapon = function () {};
});
var Merchant = Container.expand(function (resources) {
var self = Container.call(this);
+ self.merchantGraphics = self.createAsset('merchant', 'Merchant Graphics', 0.5, 0.5);
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.trade = function (villager, resourceType, amount) {
+ if (self.gameResources[resourceType].amount >= amount) {
+ self.gameResources[resourceType].amount -= amount;
+ villager.gameResources[resourceType].amount += amount;
+ }
+ };
});
var DayNightCycleManager = Container.expand(function () {
var self = Container.call(this);
self.cycleDuration = 24000;
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.