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
@@ -1,4 +1,29 @@
+var WeatherSystem = Container.expand(function () {
+ var self = Container.call(this);
+ self.currentWeather = 'sunny';
+ self.changeWeather = function () {
+ var weathers = ['sunny', 'rainy', 'windy', 'snowy'];
+ self.currentWeather = weathers[Math.floor(Math.random() * weathers.length)];
+ self.parent.villagers.forEach(function (villager) {
+ switch (self.currentWeather) {
+ case 'rainy':
+ villager.speed *= 0.9;
+ break;
+ case 'windy':
+ villager.speed *= 1.1;
+ break;
+ case 'snowy':
+ villager.speed *= 0.8;
+ break;
+ default:
+ villager.speed = villager.baseSpeed;
+ break;
+ }
+ });
+ };
+ LK.setInterval(self.changeWeather, 60000);
+});
var Quarry = Container.expand(function () {
var self = Container.call(this);
self.quarryGraphics = self.createAsset('quarry', 'Quarry Graphics', 0.5, 0.5);
var positionInitializer = new PositionInitializer();
@@ -218,16 +243,26 @@
self.guardGraphics = self.createAsset('guard', 'Guard Graphics', 0.5, 0.5);
self.addChild(self.guardGraphics);
self.x = Math.random() * 2048;
self.y = Math.random() * 2732;
+ self.speed = 2;
+ self.isDaytime = true;
self.patrolArea = function () {
- var patrolX = Math.random() * 2048;
- var patrolY = Math.random() * 2732;
- self.moveTo(patrolX, patrolY, self.speed);
+ if (!self.isDaytime) {
+ var patrolX = Math.random() * 2048;
+ var patrolY = Math.random() * 2732;
+ self.moveTo(patrolX, patrolY, self.speed);
+ }
};
- self.speed = 2;
+ self.sleep = function () {
+ if (self.isDaytime) {}
+ };
LK.on('tick', function () {
- self.patrolArea();
+ if (self.isDaytime) {
+ self.sleep();
+ } else {
+ self.patrolArea();
+ }
});
});
var Brewery = Container.expand(function () {
var self = Container.call(this);
@@ -483,8 +518,9 @@
};
});
var Festival = Container.expand(function () {
var self = Container.call(this);
+ self.festivalGraphics = self.createAsset('festival', 'Festival Graphics', 0.5, 0.5);
self.x = 2048 / 2;
self.y = 2732 / 2 - 800;
self.isActive = false;
self.activateFestival = function () {
@@ -495,8 +531,19 @@
};
self.isVillagerParticipating = function (villager) {
return self.isActive && villager.intersects(self);
};
+ self.boostHappiness = function () {
+ if (self.isActive) {
+ self.parent.villagers.forEach(function (villager) {
+ if (self.isVillagerParticipating(villager)) {
+ villager.happiness += 10;
+ if (villager.happiness > 100) villager.happiness = 100;
+ }
+ });
+ }
+ };
+ LK.on('tick', self.boostHappiness);
});
var Heart = Container.expand(function () {
var self = Container.call(this);
self.showAbove = function (villager) {
@@ -516,11 +563,11 @@
self.destroy();
}, 1000);
};
});
-var Market = Container.expand(function () {
+var Marketplace = Container.expand(function () {
var self = Container.call(this);
- self.marketGraphics = self.createAsset('market', 'Market Graphics', 0.5, 0.5);
+ self.marketplaceGraphics = self.createAsset('marketplace', 'Marketplace Graphics', 0.5, 0.5);
self.availableResources = {
wood: 0,
rock: 0,
food: 0
@@ -618,9 +665,16 @@
var elapsedTime = (currentTime - self.startTime) / 1000;
var hours = Math.floor(elapsedTime % 24);
var minutes = Math.floor(elapsedTime % 1 * 60);
self.timeOfDayText.setText(hours + ':' + (minutes < 10 ? '0' : '') + minutes);
+ self.updateVillagerBehaviorBasedOnTime(hours);
});
+ self.updateVillagerBehaviorBasedOnTime = function (hours) {
+ var isDaytime = hours >= 6 && hours < 18;
+ self.parent.villagers.forEach(function (villager) {
+ villager.isDaytime = isDaytime;
+ });
+ };
});
var VillagerFactory = Container.expand(function (resources) {
var self = Container.call(this);
self.resources = resources;
@@ -748,8 +802,10 @@
positionInitializer.initializeRandomPosition(self, self.width, self.height, function () {
return self.checkOverlapWithOtherBuildings();
});
});
+var weatherSystem = new WeatherSystem();
+self.addChild(weatherSystem);
Villager.prototype.isDoingSomething = function () {
return this.currentAction !== null;
};
Villager.prototype.moveTo = function (targetX, targetY, speed) {
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.