User prompt
Кнопка купить улучшение местности может заставить Пол подарок и ёлку
User prompt
Измени местность на Белый
User prompt
Стоимость пола 1кв² 1$
User prompt
Стоимость пола 1$
User prompt
Стоимость пола 1
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'forEach')' in this line: 'self.terrainUpgrades.forEach(function (upgrade) {' Line Number: 152
User prompt
Кнопка Пол сравнить объект floor
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'forEach')' in this line: 'self.terrainUpgrades.forEach(function (upgrade) {' Line Number: 153
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'forEach')' in this line: 'self.terrainUpgrades.forEach(function (upgrade) {' Line Number: 152
User prompt
Стоимость пола 0$
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'forEach')' in this line: 'self.terrainUpgrades.forEach(function (upgrade) {' Line Number: 153
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'forEach')' in this line: 'self.terrainUpgrades.forEach(function (upgrade) {' Line Number: 152
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'forEach')' in this line: 'self.terrainUpgrades.forEach(function (upgrade) {' Line Number: 151
User prompt
Сделай кнопку которая сравнить Пол под объектами а потом и про сто
User prompt
Сделай дефолтный Белый Пол
User prompt
Сделай чёрный белым
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'prototype')' in this line: 'FoxBehavior.prototype.onFoxClicked = function () {' Line Number: 2
var foxTimeout; var Guard = Container.expand(function () { var self = Container.call(this); self.setLocation('North Pole'); self.guardGraphics = self.createAsset('guard', 'Guard Graphics', .5, .5); self.foxesCaught = 0; self.catchLimit = 10; self.catchFox = function (fox) { fox.destroy(); self.foxesCaught++; if (self.foxesCaught >= self.catchLimit) { self.destroy(); } }; self.update = function () {}; }); var Fox = Container.expand(function (speedIncrement) { var self = Container.call(this); var foxGraphics = self.createAsset('fox', 'Fox Graphics', .5, .5); self.speed = 1; self.interactive = true; self.buttonMode = true; self.on('down', function () { var guards = LK.stage.children.filter(function (child) { return child instanceof Guard; }); if (guards.length > 0) { var closestGuard = guards.reduce(function (prev, curr) { var prevDistance = Math.sqrt(Math.pow(prev.x - self.x, 2) + Math.pow(prev.y - self.y, 2)); var currDistance = Math.sqrt(Math.pow(curr.x - self.x, 2) + Math.pow(curr.y - self.y, 2)); return prevDistance < currDistance ? prev : curr; }); closestGuard.catchFox(self); } else { LK.clearTimeout(foxTimeout); self.destroy(); } }); self.stealMoney = function () { if (LK.getScore() >= 100) { LK.setScore(LK.getScore() - 100); } self.destroy(); }; self.update = function () { self.y += self.speed; }; Fox.speedIncrement = speedIncrement || 0.5; }); var GiftDecoration = Container.expand(function () { var self = Container.call(this); var giftDecorationGraphics = self.createAsset('giftDecoration', 'Gift Decoration Graphics', .5, .5); self.update = function () {}; }); var ChristmasTree = Container.expand(function () { var self = Container.call(this); var treeGraphics = self.createAsset('christmasTree', 'Christmas Tree Graphics', .5, .5); self.update = function () {}; }); var Gift = Container.expand(function () { var self = Container.call(this); var giftGraphics = self.createAsset('engineGift', 'Engine Gift Graphics', .5, .5); self.move = function () {}; self.update = function () {}; }); var Santa = Container.expand(function () { var self = Container.call(this); var santaGraphics = self.createAsset('santa', 'Santa Graphics', .5, .5); self.move = function () {}; self.update = function () {}; }); var Factory = Container.expand(function () { var self = Container.call(this); self.factoryGraphics = self.createAsset('factory', 'Factory Graphics', .5, .5); self.productionValue = 5; self.terrainUpgradeCost = 1000; self.upgradeCost = 1000; self.produceGift = function () { LK.setInterval(function () { var earnedMoney = self.productionValue; LK.setScore(LK.getScore() + earnedMoney); var earnedMoneyTxt = new Text2('+' + earnedMoney, { size: 100, fill: "#ffffff" }); earnedMoneyTxt.x = self.x; earnedMoneyTxt.y = self.y - 100; earnedMoneyTxt.anchor.set(0.5, 0.5); LK.gui.addChild(earnedMoneyTxt); var moveUpwards = function () { earnedMoneyTxt.y -= 2; if (earnedMoneyTxt.y < self.y - 300) { earnedMoneyTxt.destroy(); } }; LK.on('tick', moveUpwards); LK.setTimeout(function () { LK.off('tick', moveUpwards); if (earnedMoneyTxt.parent) { earnedMoneyTxt.destroy(); } }, 3000); }, 5000); }; self.terrainUpgrades = []; self.upgradeTerrain = function () { self.terrainUpgradeCost = 1; if (LK.getScore() >= self.terrainUpgradeCost) { LK.setScore(LK.getScore() - self.terrainUpgradeCost); var newDecoration = new GiftDecoration(); newDecoration.x = Math.random() * 2048; newDecoration.y = Math.random() * 2732; self.terrainUpgrades.push(newDecoration); LK.stage.addChild(newDecoration); var newTree = new ChristmasTree(); newTree.x = Math.random() * 2048; newTree.y = Math.random() * 2732; self.terrainUpgrades.push(newTree); LK.stage.addChild(newTree); self.terrainUpgradeCost *= 2; } }; self.update = function () {}; }); var Game = Container.expand(function () { Game.prototype.upgradeFactory = function (factory) { if (LK.getScore() >= factory.upgradeCost) { LK.setScore(LK.getScore() - factory.upgradeCost); factory.productionValue *= 2; factory.upgradeCost *= 2; } }; var self = Container.call(this); var gifts = []; var factories = []; var santa = self.addChild(new Santa()); santa.x = 2048 / 2; santa.y = 2732 / 2; var factory = self.addChild(new Factory()); factory.x = 2048 / 4; factory.y = 2732 / 4; factories.push(factory); var scoreTxt = new Text2('0', { size: 150, fill: "#ffffff" }); var compareGroundButton = self.createAsset('compareFloorButton', 'Compare Floor Button', 0.5, 1); compareGroundButton.x = 2048 / 2; compareGroundButton.y = 2732 - compareGroundButton.height * 1.5; self.addChild(compareGroundButton); compareGroundButton.on('down', function () { if (self.terrainUpgrades) { self.terrainUpgrades.forEach(function (upgrade) { upgrade.alpha = upgrade.alpha === 1 ? 0.5 : 1; }); } }); var purchaseFactoryButton = self.createAsset('purchaseFactoryButton', 'Purchase Factory Button', 0.5, 1); var purchaseGuardButton = self.createAsset('purchaseGuardButton', 'Purchase Guard Button', 0.5, 1); purchaseGuardButton.x = 2048 / 2 + purchaseGuardButton.width; purchaseGuardButton.y = 2732 - purchaseGuardButton.height / 2; self.addChild(purchaseGuardButton); purchaseGuardButton.on('down', function () { var guardCost = 1000; if (LK.getScore() >= guardCost) { LK.setScore(LK.getScore() - guardCost); var newGuard = self.addChild(new Guard()); newGuard.x = Math.random() * 2048; newGuard.y = Math.random() * 2732; } }); var upgradeTerrainButton = self.createAsset('upgradeTerrainButton', 'Upgrade Terrain Button', 0.5, 1); purchaseFactoryButton.x = 2048 / 2 - purchaseFactoryButton.width; purchaseFactoryButton.y = 2732 - purchaseFactoryButton.height / 2; upgradeTerrainButton.x = 2048 / 2 + upgradeTerrainButton.width; upgradeTerrainButton.y = 2732 - upgradeTerrainButton.height / 2; self.addChild(purchaseFactoryButton); self.addChild(upgradeTerrainButton); purchaseFactoryButton.on('down', function () { var factoryCost = 100; if (LK.getScore() >= factoryCost) { LK.setScore(LK.getScore() - factoryCost); var newFactory = self.addChild(new Factory()); newFactory.x = 2048 / 4; newFactory.y = 2732 / 4 * factories.length; factories.push(newFactory); newFactory.produceGift(); scoreTxt.setText(LK.getScore()); } else { var noMoneyTxt = new Text2('No Money', { size: 100, fill: "#ffffff" }); noMoneyTxt.x = LK.stage.width / 2; noMoneyTxt.y = LK.stage.height / 2; noMoneyTxt.anchor.set(0.5, 0.5); LK.gui.addChild(noMoneyTxt); LK.setTimeout(function () { noMoneyTxt.destroy(); }, 5000); } }); upgradeTerrainButton.on('down', function () { factory.upgradeTerrain(); scoreTxt.setText(LK.getScore()); }); LK.setScore(5); scoreTxt.setText(0); var lastScore = 0; var foxTimeout; LK.on('tick', function () { var currentScore = LK.getScore(); if (currentScore >= lastScore + 100) { lastScore += 100; var fox = new Fox(Fox.speedIncrement); fox.speed += Fox.speedIncrement; fox.x = Math.random() * 2048; fox.y = Math.random() * 2732; self.addChild(fox); foxTimeout = LK.setTimeout(function () { fox.stealMoney(); scoreTxt.setText(LK.getScore()); }, 5000); } }); scoreTxt.anchor.set(.5, 0); LK.gui.topCenter.addChild(scoreTxt); santa.on('down', function (obj) { console.log('Santa was pressed'); }); factory.on('down', function (obj) { var upgradeButton = self.createAsset('upgradeButton', 'Upgrade Factory Button', 0.5, 1); upgradeButton.x = factory.x + factory.getChildAt(0).width / 2 + 20; upgradeButton.y = factory.y; self.addChild(upgradeButton); upgradeButton.on('down', function () { self.upgradeFactory(factory); scoreTxt.setText(LK.getScore()); upgradeButton.destroy(); }); factory.produceGift(); scoreTxt.setText(LK.getScore()); }); LK.on('tick', function () { santa.update(); for (var i = 0; i < factories.length; i++) { factories[i].update(); } for (var i = 0; i < gifts.length; i++) { gifts[i].move(); if (gifts[i].y < -50) { gifts[i].destroy(); gifts.splice(i, 1); } } }); });
===================================================================
--- original.js
+++ change.js
@@ -106,15 +106,18 @@
self.upgradeTerrain = function () {
self.terrainUpgradeCost = 1;
if (LK.getScore() >= self.terrainUpgradeCost) {
LK.setScore(LK.getScore() - self.terrainUpgradeCost);
- var newUpgrade;
- newUpgrade = new GiftDecoration();
- newUpgrade.tint = 0xFFFFFF;
- newUpgrade.x = Math.random() * 2048;
- newUpgrade.y = Math.random() * 2732;
- self.terrainUpgrades.push(newUpgrade);
- LK.stage.addChild(newUpgrade);
+ var newDecoration = new GiftDecoration();
+ newDecoration.x = Math.random() * 2048;
+ newDecoration.y = Math.random() * 2732;
+ self.terrainUpgrades.push(newDecoration);
+ LK.stage.addChild(newDecoration);
+ var newTree = new ChristmasTree();
+ newTree.x = Math.random() * 2048;
+ newTree.y = Math.random() * 2732;
+ self.terrainUpgrades.push(newTree);
+ LK.stage.addChild(newTree);
self.terrainUpgradeCost *= 2;
}
};
self.update = function () {};
Фабрика Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Лис в новогодний шапке Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Рождественская ёлка Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Стрелочка в верх Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Покупка Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Санта Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Разноцветный подарок Подарок Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.