User prompt
Delete night
User prompt
Improve night
User prompt
Improve
User prompt
Fix Bug: 'TypeError: self.decideNextAction is not a function' in this line: 'self.decideNextAction(self.villagers[i]);' Line Number: 313
User prompt
Fix Bug: 'TypeError: self.decideNextAction is not a function' in this line: 'self.decideNextAction(self.villagers[i]);' Line Number: 312
User prompt
Fix Bug: 'TypeError: villager.decideNextAction is not a function' in this line: 'villager.decideNextAction();' Line Number: 303
User prompt
Fix Bug: 'TypeError: villager.decideNextAction is not a function' in this line: 'villager.decideNextAction();' Line Number: 303
User prompt
Improve
User prompt
Delete background
User prompt
Create background
User prompt
Fix Bug: 'Uncaught TypeError: self.initializeVillager is not a function' in this line: 'self.initializeVillager();' Line Number: 187
User prompt
Fix
User prompt
Fix Bug: 'TypeError: self.updateResourceDisplay is not a function' in this line: 'self.updateResourceDisplay();' Line Number: 327
User prompt
Fix
User prompt
Fix
User prompt
Fix
User prompt
Fix background
User prompt
Fix villager dont moving
User prompt
Fix villager dont moving
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'updateCycle')' in this line: 'self.dayNightCycle.updateCycle();' Line Number: 437
User prompt
Fix Bug: 'TypeError: self.updateDayNightCycle is not a function' in this line: 'self.updateDayNightCycle();' Line Number: 437
User prompt
Improve
User prompt
Remove kiss and all kiss référence
User prompt
Delete kiss
User prompt
Fix Bug: 'TypeError: villagerA.kiss is not a function' in this line: 'villagerA.kiss(villagerB);' Line Number: 331
var Romance = Container.expand(function () {
var self = Container.call(this);
});
var ResourceDisplay = Container.expand(function (resources) {
var self = Container.call(this);
self.resources = resources;
self.update = function () {};
});
var Well = Container.expand(function () {
var self = Container.call(this);
var wellGraphics = self.createAsset('well', 'Well Graphics', .5, .5);
self.x = 2048 / 2 - 800;
self.y = 2732 / 2 - 600;
self.drinkWater = function (villager) {
villager.tiredness -= 5;
if (villager.tiredness < 0) villager.tiredness = 0;
};
});
var Bakery = Container.expand(function () {
var self = Container.call(this);
var bakeryGraphics = self.createAsset('bakery', 'Bakery Graphics', .5, .5);
self.x = 2048 / 2 + 800;
self.y = 2732 / 2 - 300;
self.sellBread = function (villager) {
if (villager.gameResources.food.amount >= 5) {
villager.gameResources.food.amount -= 5;
villager.energy += 10;
if (villager.energy > 100) villager.energy = 100;
}
};
});
var Cloud = Container.expand(function () {
var self = Container.call(this);
var cloudGraphics = self.createAsset('cloud', 'Cloud Graphics', .5, .5);
cloudGraphics.alpha = 0.5;
self.x = Math.random() * 2048;
self.y = Math.random() * 2732;
self.speed = Math.random() * 2 + 1;
self.move = function () {
self.x += self.speed;
if (self.x > 2048) {
self.x = -cloudGraphics.width;
}
};
});
var School = Container.expand(function () {
var self = Container.call(this);
var schoolGraphics = self.createAsset('school', 'School Graphics', .5, .5);
self.x = 2048 / 2 - 1000;
self.y = 2732 / 2 + 500;
self.teach = function (villager) {};
});
var Inn = Container.expand(function () {
var self = Container.call(this);
var innGraphics = self.createAsset('inn', 'Inn Graphics', .5, .5);
self.x = 2048 / 2;
self.y = 2732 / 2 + 800;
self.isOccupiable = true;
self.occupy = function (villager) {
if (!self.isOccupiable) return;
self.isOccupiable = false;
villager.state = 'restingAtInn';
LK.setTimeout(function () {
self.isOccupiable = true;
}, 10000);
};
});
var Gardener = Container.expand(function () {
var self = Container.call(this);
var gardenerGraphics = self.createAsset('gardener', 'Gardener Graphics', .5, .5);
self.x = Math.random() * 2048;
self.y = Math.random() * 2732;
self.tendPlants = function () {};
self.plantNewTree = function () {
var newTree = new Tree();
newTree.x = Math.random() * 2048;
newTree.y = Math.random() * 2732;
self.parent.addChild(newTree);
};
});
var Festival = Container.expand(function () {
var self = Container.call(this);
var festivalGraphics = self.createAsset('festival', 'Festival Graphics', .5, .5);
self.x = 2048 / 2;
self.y = 2732 / 2 - 800;
self.isActive = false;
self.activateFestival = function () {
self.isActive = true;
LK.setTimeout(function () {
self.isActive = false;
}, 10000);
};
self.isVillagerParticipating = function (villager) {
return self.isActive && villager.intersects(self);
};
});
var Heart = Container.expand(function () {
var self = Container.call(this);
var heartGraphics = self.createAsset('heartImage', 'Heart Image', .5, .5);
self.showAbove = function (villager) {
self.x = villager.x;
self.y = villager.y - villager.height;
self.alpha = 1;
self.follow = function () {
if (villager) {
self.x = villager.x;
self.y = villager.y - villager.height;
}
};
LK.on('tick', self.follow);
LK.setTimeout(function () {
LK.off('tick', self.follow);
self.alpha = 1;
self.destroy();
}, 1000);
};
});
var Market = Container.expand(function () {
var self = Container.call(this);
var marketGraphics = self.createAsset('market', 'Market Graphics', .5, .5);
self.x = 2048 / 2;
self.y = 2732 / 2 + 1200;
self.availableResources = {
wood: 0,
rock: 0,
food: 0
};
self.trade = function (villager, resourceType, amount) {
if (self.availableResources[resourceType] >= amount) {
self.availableResources[resourceType] -= amount;
villager.gameResources[resourceType].amount += amount;
}
};
self.addResource = function (resourceType, amount) {
self.availableResources[resourceType] += amount;
};
});
var HouseBuilder = Container.expand(function () {
var self = Container.call(this);
self.build = function (villager) {
var newHouse = new House();
newHouse.initializeRandomPosition();
villager.parent.addChild(newHouse);
villager.state = 'atHome';
villager.home = newHouse;
newHouse.scheduleVillagerWork(villager);
};
});
var WoodResource = Container.expand(function (amount) {
var self = Container.call(this);
self.type = 'Wood';
self.amount = amount;
var resourceGraphics = self.createAsset('woodImage', 'Wood Image', .5, .5);
});
var RockResource = Container.expand(function (amount) {
var self = Container.call(this);
self.type = 'Rock';
self.amount = amount;
var resourceGraphics = self.createAsset('rockImage', 'Rock Image', .5, .5);
});
var FoodResource = Container.expand(function (amount) {
var self = Container.call(this);
self.type = 'Food';
self.amount = amount;
var resourceGraphics = self.createAsset('foodImage', 'Food Image', .5, .5);
});
var Tree = Container.expand(function () {
var self = Container.call(this);
var treeGraphics = self.createAsset('treeImage', 'Tree Image', .5, .5);
self.resourceType = 'food';
self.amount = 100;
self.collectResource = function (villager) {
if (self.amount > 0) {
var collectedAmount = Math.min(5, self.amount);
villager.gameResources.food.amount += collectedAmount;
villager.carriedFood += collectedAmount;
self.amount -= collectedAmount;
if (self.amount <= 0) {
self.destroy();
}
}
};
});
var Villager = Container.expand(function (resources) {
var self = Container.call(this);
self.gameResources = resources;
var villagerGraphics = self.createAsset('villager', 'Villager Graphics', .5, .5);
self.initializeVillager();
});
var EmployingWorkPlace = Container.expand(function () {
var self = Container.call(this);
var workplaceGraphics = self.createAsset('workplace', 'Workplace Graphics', .5, .5);
self.isEmploying = true;
self.employ = function (villager) {};
});
var House = Container.expand(function () {
var self = Container.call(this);
House.prototype.scheduleVillagerWork = function (villager) {
LK.setTimeout(function () {
villager.state = 'goingToWork';
villager.moveTo(villager.workplace.x, villager.workplace.y);
}, 5000);
};
House.prototype.initializeRandomPosition = function () {
this.x = Math.random() * 2048;
this.y = Math.random() * 2732;
};
var houseGraphics = self.createAsset('house', 'House Graphics', .5, .5);
self.isOccupiable = true;
House.prototype.occupy = function (villager) {
if (!this.isOccupiable) return;
this.isOccupiable = false;
villager.home = this;
this.scheduleVillagerWork(villager);
};
});
Villager.prototype.initializeVillager = function () {
this.targetX = null;
this.targetY = null;
this.home = null;
this.workplace = null;
this.resourceType = null;
this.speed = 12;
this.directionX = 1;
this.directionY = 1;
this.carriedWood = 0;
this.carriedRock = 0;
this.carriedFood = 0;
this.tiredness = 0;
this.iq = 100;
this.currentAction = null;
this.decideNextAction = function () {};
this.canFallInLove = function (otherVillager) {
return true;
};
Villager.prototype.kiss = function (otherVillager) {
var heart = new Heart();
heart.showAbove(this);
this.parent.addChild(heart);
};
};
Villager.prototype.isDoingSomething = function () {
return this.currentAction !== null;
};
Villager.prototype.initializePosition = function (x, y) {
this.x = x;
this.y = y;
};
Villager.prototype.update = function () {};
var Game = Container.expand(function () {
var self = Container.call(this);
Game.prototype.decideNextAction = function (villager) {};
Game.prototype.executeCurrentAction = function (villager) {};
Game.prototype.registerVillager = function (villager) {
this.villagers.push(villager);
};
Game.prototype.createAndAddVillagerIfPossible = function () {
if (this.resources && this.resources.food.amount >= 10) {
var x = Math.random() * 2048;
var y = Math.random() * 2732;
this.addVillager(this.createVillager(x, y));
this.resources.food.amount -= 10;
}
};
Game.prototype.zoomOnVillagers = function (villagerA, villagerB) {
var zoomLevel = 2;
var centerX = (villagerA.x + villagerB.x) / 2;
var centerY = (villagerA.y + villagerB.y) / 2;
LK.stageContainer.scale.x = zoomLevel;
LK.stageContainer.scale.y = zoomLevel;
LK.stageContainer.pivot.x = centerX;
LK.stageContainer.pivot.y = centerY;
LK.stageContainer.x = LK.stageContainer.width / 2;
LK.stageContainer.y = LK.stageContainer.height / 2;
LK.setTimeout(function () {
LK.stageContainer.scale.x = 1;
LK.stageContainer.scale.y = 1;
LK.stageContainer.pivot.x = 0;
LK.stageContainer.pivot.y = 0;
LK.stageContainer.x = 0;
LK.stageContainer.y = 0;
}, 3000);
};
self.makeVillagerDecisions = function (villager) {
if (!villager.isDoingSomething()) {
villager.decideNextAction();
}
};
LK.on('tick', function () {
if (self.villagerAndFramerateDisplay) if (self.villagerAndFramerateDisplay) if (self.villagerAndFramerateDisplay) if (self.villagerAndFramerateDisplay) if (self.villagerAndFramerateDisplay) if (self.villagerAndFramerateDisplay) if (self.villagerAndFramerateDisplay) if (self.villagerAndFramerateDisplay) if (self.villagerAndFramerateDisplay) if (self.villagerAndFramerateDisplay) if (self.villagerAndFramerateDisplay) self.framerateDisplay.update();
self.resourceDisplay.update();
var currentTime = Date.now();
var elapsedTime = Math.floor((currentTime - self.startTime) / 1000);
self.timerText.setText('Time: ' + elapsedTime);
self.updateResourceDisplay();
for (var i = 0; i < self.villagers.length; i++) {
self.decideNextAction(self.villagers[i]);
self.executeCurrentAction(self.villagers[i]);
self.makeVillagerDecisions(self.villagers[i]);
}
self.handleVillagersFallingInLove();
});
self.timerText = new Text2('Time: 0', {
size: 100,
fill: "#ffffff"
});
self.timerText.anchor.set(1, 1);
self.timerText.x = 2048 - 500;
self.timerText.y = 2732;
LK.gui.topCenter.addChild(self.timerText);
self.startTime = Date.now();
self.villagers = [];
var market = new Market();
self.addChild(market);
var inn = new Inn();
self.addChild(inn);
var school = new School();
self.addChild(school);
var bakery = new Bakery();
self.addChild(bakery);
var well = new Well();
self.addChild(well);
self.resources = createResources();
self.resourceDisplay = new ResourceDisplay(self.resources);
self.resourceDisplay.update = function () {};
self.updateResourceDisplay = function () {
self.resourceDisplay.update();
};
self.handleVillagersFallingInLove = function () {
for (var i = 0; i < self.villagers.length; i++) {
for (var j = i + 1; j < self.villagers.length; j++) {
var villagerA = self.villagers[i];
var villagerB = self.villagers[j];
if (villagerA.canFallInLove(villagerB)) {
villagerA.kiss(villagerB);
}
}
}
};
function createResources() {
return {
wood: new WoodResource(100),
rock: new RockResource(100),
food: new FoodResource(100)
};
}
Game.prototype.createVillager = function (x, y, isBaby) {
var villager = new Villager(this.resources);
villager.initializePosition(x, y);
if (isBaby) {
villager.scale.x = 0.5;
villager.scale.y = 0.5;
}
return villager;
};
Game.prototype.addVillager = function (villager) {
this.addChild(villager);
this.registerVillager(villager);
};
self.villagers = [];
self.houses = [];
self.cloudLayer = new Container();
LK.stageContainer.addChild(self.cloudLayer);
self.clouds = [];
for (var i = 0; i < 5; i++) {
var cloud = new Cloud();
self.clouds.push(cloud);
self.cloudLayer.addChild(cloud);
}
self.addVillager(self.createVillager(1024, 1366));
for (var i = 0; i < 10; i++) {
self.addVillager(self.createVillager(Math.random() * 2048, Math.random() * 2732));
}
self.market = new Market();
self.addChild(self.market);
Game.prototype.createHouse = function (x, y) {
var house = new House();
house.x = x;
house.y = y;
return house;
};
Game.prototype.addHouse = function (house) {
this.addChild(house);
this.houses.push(house);
};
var houses = [];
var newHouse = self.createHouse(2048 / 2, 2732 / 2);
self.addHouse(newHouse);
houses.push(newHouse);
Game.prototype.createWorkplace = function () {
var workplace = new EmployingWorkPlace();
workplace.x = Math.random() * 2048;
workplace.y = Math.random() * 2732;
return workplace;
};
Game.prototype.addWorkplace = function (workplace) {
this.addChild(workplace);
this.workplaces.push(workplace);
};
self.workplaces = [];
var workplace = self.createWorkplace();
self.addWorkplace(workplace);
self.workplaces.push(workplace);
var house = new House();
house.x = 2048 / 2;
house.y = 2732 / 2;
houses.push(house);
self.addChild(house);
var workplace = new EmployingWorkPlace();
workplace.x = Math.random() * 2048;
workplace.y = Math.random() * 2732;
self.workplaces.push(workplace);
self.addChild(workplace);
self.villagerCreationInterval = LK.setInterval(function () {
self.createAndAddVillagerIfPossible();
}, 10000);
LK.on('tick', function () {
var currentTime = Date.now();
var elapsedTime = Math.floor((currentTime - self.startTime) / 1000);
self.timerText.setText('Time: ' + elapsedTime);
self.updateResourceDisplay();
for (var i = 0; i < self.villagers.length; i++) {
self.villagers[i].update();
}
self.handleVillagersFallingInLove();
self.updateDayNightCycle();
for (var i = 0; i < self.clouds.length; i++) {
self.clouds[i].move();
}
});
self.updateDayNightCycle = function () {
var cycleDuration = 5000;
var time = (Date.now() - self.startTime) % cycleDuration;
var dayProgress = time / cycleDuration * 2 * Math.PI;
var alpha = 0.15 + 0.2 * Math.cos(dayProgress - Math.PI) * -0.5;
LK.stageContainer.alpha = 1;
var hours = Math.floor(time / 3600000) % 24;
var minutes = Math.floor(time % 3600000 / 60000);
self.timeOfDayText.setText('Time of Day: ' + hours.toString().padStart(2, '0') + ':' + minutes.toString().padStart(2, '0'));
};
self.timeOfDayText = new Text2('Time of Day: 00:00', {
size: 50,
fill: "#ffffff"
});
self.timeOfDayText.anchor.set(0.5, 0);
self.timeOfDayText.x = 2048 / 2;
self.timeOfDayText.y = 100;
LK.gui.topCenter.addChild(self.timeOfDayText);
});
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.