User prompt
Fix Bug: 'Uncaught TypeError: self.createAndAddVillager is not a function' in this line: 'self.villagers.push(self.createAndAddVillager(1024, 1500));' Line Number: 426
User prompt
Fix Bug: 'Uncaught TypeError: self.createAndAddVillager is not a function' in this line: 'self.villagers.push(self.createAndAddVillager(1024, 1366));' Line Number: 424
User prompt
Improve
User prompt
Fix Bug: 'Uncaught ReferenceError: ResourceCollector is not defined' in this line: 'var resourceCollector = new ResourceCollector();' Line Number: 408
User prompt
Improve
User prompt
Improve
User prompt
Fix Bug: 'Uncaught ReferenceError: OccupiableHouse is not defined' in this line: 'var house = new OccupiableHouse();' Line Number: 476
User prompt
Fix Bug: 'Uncaught TypeError: Cannot set properties of undefined (setting 'isOccupiable')' in this line: 'self.isOccupiable = true;' Line Number: 366
User prompt
Fix Bug: 'Uncaught TypeError: Cannot set properties of undefined (setting 'isOccupiable')' in this line: 'self.isOccupiable = true;' Line Number: 365
User prompt
Fix Bug: 'Cannot set properties of undefined (setting 'isOccupiable')' in this line: 'self.isOccupiable = true;' Line Number: 365
User prompt
Fix Bug: 'Uncaught TypeError: Cannot set properties of undefined (setting 'isOccupiable')' in this line: 'self.isOccupiable = true;' Line Number: 365
User prompt
Fix
User prompt
Fix Bug: 'Uncaught TypeError: Cannot set properties of undefined (setting 'isOccupiable')' in this line: 'self.isOccupiable = true;' Line Number: 369
User prompt
Fix Bug: 'Uncaught TypeError: Cannot set properties of undefined (setting 'isOccupiable')' in this line: 'self.isOccupiable = true;' Line Number: 368
User prompt
Fix Bug: 'Uncaught TypeError: Cannot set properties of undefined (setting 'isOccupiable')' in this line: 'self.isOccupiable = true;' Line Number: 368
User prompt
Fix Bug: 'Uncaught TypeError: House.extend is not a function' in this line: 'var OccupiableHouse = House.extend(function () {' Line Number: 365
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'expand')' in this line: 'var OccupiableHouse = House.expand(function () {' Line Number: 269
User prompt
improve the game multiple time for 10 minute without me saying you what to do
User prompt
make villager 500 time more sùarter
User prompt
make villager 50 time smarter
User prompt
add new gameplay idea
User prompt
villager kis 100 time more
User prompt
baby spawn in a house and start working
User prompt
villager kiss 10 time more
User prompt
baby are villager with half size
===================================================================
--- original.js
+++ change.js
@@ -57,18 +57,19 @@
});
var Villager = Container.expand(function (resources) {
var self = Container.call(this);
Villager.prototype.kiss = function (partner) {
- for (var i = 0; i < 1000; i++) {
- if (this.canFallInLove(partner)) {
- var babyX = (this.x + partner.x) / 2;
- var babyY = (this.y + partner.y) / 2;
- var babyVillager = this.parent.createAndAddVillager(babyX, babyY, true);
- babyVillager.home = this.home;
- babyVillager.workplace = this.workplace;
- }
+ if (this.canFallInLove(partner)) {
+ this.createBabyWith(partner);
}
};
+ Villager.prototype.createBabyWith = function (partner) {
+ var babyX = (this.x + partner.x) / 2;
+ var babyY = (this.y + partner.y) / 2;
+ var babyVillager = this.parent.createAndAddVillager(babyX, babyY, true);
+ babyVillager.home = this.home || partner.home;
+ babyVillager.workplace = this.workplace || partner.workplace;
+ };
Villager.prototype.continuousMove = function () {
if (this.x < this.speed || this.x > 2048 - this.speed) this.directionX *= -1;
if (this.y < this.speed || this.y > 2732 - this.speed) this.directionY *= -1;
this.x = Math.max(this.speed, Math.min(2048 - this.speed, this.x + this.speed * this.directionX));
@@ -159,19 +160,17 @@
utility: self.calculatePlantUtility(self.gameResources)
}, {
action: 'buildHouse',
utility: self.calculateBuildUtility()
- }];
- utilities.sort(function (a, b) {
- return b.utility - a.utility;
- });
- utilities.push({
+ }, {
action: 'trade',
utility: self.calculateTradeUtility()
+ }];
+ var highestUtilityAction = utilities.reduce(function (highest, current) {
+ return highest.utility > current.utility ? highest : current;
});
- var chosenAction = utilities[0].action;
- self.state = chosenAction;
- if (chosenAction === 'work' && self.workplace && self.workplace.x !== null && self.workplace.y !== null) {
+ self.state = highestUtilityAction.action;
+ if (self.state === 'work') {
self.moveTo(self.workplace.x, self.workplace.y, 'goingToWork');
}
};
self.executeCurrentAction = function () {
@@ -241,9 +240,11 @@
var excessResources = (self.carriedWood > 10 ? 1 : 0) + (self.carriedRock > 10 ? 1 : 0) + (self.carriedFood > 10 ? 1 : 0);
return excessResources > 1 ? 25000 : 0;
};
self.moveTowards = function (x, y) {
- if (self.x !== x || self.y !== y) {
+ var dx = x - self.x;
+ var dy = y - self.y;
+ if (dx !== 0 || dy !== 0) {
self.moveTo(x, y);
self.moveTowardsTarget();
}
};
@@ -264,13 +265,18 @@
}
}
};
});
-var OccupiableHouse = Container.expand(function () {
+var OccupiableHouse = House.expand(function () {
var self = Container.call(this);
- var houseGraphics = self.createAsset('house', 'House Graphics', .5, .5);
+ var self = House.call(this);
self.isOccupiable = true;
- self.occupy = function (villager) {};
+ self.occupy = function (villager) {
+ if (!self.isOccupiable) return;
+ self.isOccupiable = false;
+ villager.home = this;
+ this.scheduleVillagerWork(villager);
+ };
});
var EmployingWorkPlace = Container.expand(function () {
var self = Container.call(this);
var workplaceGraphics = self.createAsset('workplace', 'Workplace Graphics', .5, .5);
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.