User prompt
Fix Bug: 'Uncaught TypeError: this.well.createAsset is not a function' in this line: 'this.wellGraphics = this.well.createAsset('well', 'Well Graphics', .5, .5);' Line Number: 299
User prompt
Improve
User prompt
Fix Bug: 'Uncaught ReferenceError: House is not defined' in this line: 'var house = new House();' Line Number: 489
User prompt
Improve
User prompt
Improve
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of null (reading 'addChild')' in this line: 'self.parent.addChild(villager);' Line Number: 273
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of null (reading 'addChild')' in this line: 'self.parent.addChild(villager);' Line Number: 273
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of null (reading 'addChild')' in this line: 'self.parent.addChild(villager);' Line Number: 271
User prompt
Improve
User prompt
Improve
User prompt
Improve the code
User prompt
Fix Bug: 'Uncaught ReferenceError: houses is not defined' in this line: 'houses.push(house);' Line Number: 475
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'houses')' in this line: 'this.self.houses.push(house);' Line Number: 445
User prompt
Fix Bug: 'Uncaught ReferenceError: houses is not defined' in this line: 'houses.push(house);' Line Number: 475
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'houses')' in this line: 'this.self.houses.push(house);' Line Number: 445
User prompt
Fix Bug: 'Uncaught ReferenceError: houses is not defined' in this line: 'houses.push(house);' Line Number: 475
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'houses')' in this line: 'this.self.houses.push(house);' Line Number: 445
User prompt
Fix Bug: 'Uncaught ReferenceError: houses is not defined' in this line: 'houses.push(house);' Line Number: 475
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'houses')' in this line: 'this.self.houses.push(house);' Line Number: 445
User prompt
Fix Bug: 'Uncaught ReferenceError: houses is not defined' in this line: 'houses.push(house);' Line Number: 475
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'houses')' in this line: 'this.self.houses.push(house);' Line Number: 445
User prompt
Fix Bug: 'Uncaught ReferenceError: houses is not defined' in this line: 'houses.push(house);' Line Number: 475
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'houses')' in this line: 'this.self.houses.push(house);' Line Number: 445
User prompt
Fix Bug: 'Uncaught ReferenceError: houses is not defined' in this line: 'houses.push(house);' Line Number: 475
User prompt
Fix Bug: 'Uncaught TypeError: self.initializeHouses is not a function' in this line: 'self.initializeHouses();' Line Number: 447
===================================================================
--- original.js
+++ change.js
@@ -260,12 +260,16 @@
});
var VillagerFactory = Container.expand(function (resources) {
var self = Container.call(this);
self.resources = resources;
- self.createVillager = function (isBaby, iq) {
- var villager = new Villager(self.resources, iq);
+ self.createVillager = function (iq) {
+ return new Villager(self.resources, iq);
+ };
+ self.initializeVillager = function (villager, isBaby, x, y) {
villager.setAge(isBaby);
- return villager;
+ villager.x = x;
+ villager.y = y;
+ self.parent.addChild(villager);
};
self.initializeVillagerPosition = function (villager, x, y) {
villager.x = x;
villager.y = y;
@@ -423,11 +427,11 @@
this.scale.x = 1;
this.scale.y = 1;
}
};
- Game.prototype.addVillager = function (villager, x, y) {
- this.villagerFactory.initializeVillagerPosition(villager, x, y);
- this.addChild(villager);
+ Game.prototype.addVillager = function (isBaby, iq, x, y) {
+ var villager = this.villagerFactory.createVillager(iq);
+ this.villagerFactory.initializeVillager(villager, isBaby, x, y);
this.registerVillager(villager);
this.initializeVillager(villager);
};
Game.prototype.initializeVillager = function (villager) {
@@ -450,11 +454,11 @@
self.clouds.push(cloud);
self.cloudLayer.addChild(cloud);
}
self.villagerFactory = new VillagerFactory(self.resources);
- self.addVillager(self.villagerFactory.createVillager(1024, 1366, false, Math.random() * 50 + 50));
+ self.addVillager(false, Math.random() * 50 + 50, 1024, 1366);
for (var i = 0; i < 10; i++) {
- self.addVillager(self.villagerFactory.createVillager(Math.random() * 2048, Math.random() * 2732, false, Math.random() * 50 + 50));
+ self.addVillager(false, Math.random() * 50 + 50, Math.random() * 2048, Math.random() * 2732);
}
self.market = new Market();
self.addChild(self.market);
Game.prototype.createHouse = function (x, y) {
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.