Code edit (3 edits merged)
Please save this source code
User prompt
при добавлении two-hand swords in stock +1, из redrystalingot не вычитается 75, исправь ошибку
Code edit (6 edits merged)
Please save this source code
User prompt
если в two-hand swords in stock +1 то в redcrystalIngot -75
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught ReferenceError: mineInsideBackground is not defined' in or related to this line: 'if (mineInsideBackground) {' Line Number: 483
Code edit (3 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught ReferenceError: RedCrystalIngot is not defined' in or related to this line: 'var redCrystalIngot = game.magicNursery.addChild(new RedCrystalIngot());' Line Number: 200
User prompt
Please fix the bug: 'Uncaught ReferenceError: background is not defined' in or related to this line: 'background.visible = false;' Line Number: 620
User prompt
Please fix the bug: 'Uncaught ReferenceError: animateHammer is not defined' in or related to this line: 'return animateHammer();' Line Number: 720
Code edit (1 edits merged)
Please save this source code
Code edit (2 edits merged)
Please save this source code
User prompt
если в two-hand sword in stock +1 то в redcrystalIngot -75
Code edit (1 edits merged)
Please save this source code
User prompt
не отнимает или не прописывает в счетчике корректно исправь ошибку
Code edit (9 edits merged)
Please save this source code
User prompt
когда axe in stock прибавляет 1 в creen crystalIngot должно отняться 15
Code edit (6 edits merged)
Please save this source code
User prompt
сделай так что когда у нас добавляется 1 в swords in stock, то в forfing skill добавляется 100
Code edit (1 edits merged)
Please save this source code
Code edit (3 edits merged)
Please save this source code
User prompt
по аналогии переименуй Green Cristall
User prompt
переименуй название отображающегося счетчика Green Cristall в Green Crystall
Code edit (11 edits merged)
Please save this source code
User prompt
переименуй название счетчика Green Cristall в Green Crystall
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1", { forgingSkill: 0, growthRate: 0, blueCrystallScore: 0, greenCrystalIngotScore: 0, blueSwords: 0, greenAxes: 0, redCrystalTwoHandedSwords: 0, blueswordsclick: 0, greenAxeClicks: 0, redCrystalTwoHandedSwordClicks: 0, automineblueCrystallClicked: false, autominegreenCrystallClicked: false, autogrowthRateClicked: false, multiclickupgrade: false, theBlacksmithsApprentice: false, automineredCrystallClicked: false, lastgametime: 0, goldScore: 0, greenCrystallScore: 0, redCrystallScore: 0, redCrystalIngotScore: 0, blueCrystalIngotScore: 0 }); /**** * Classes ****/ var Anvil = Container.expand(function () { var self = Container.call(this); var anvilGraphics = self.attachAsset('anvil', { anchorX: 0.5, anchorY: 0.5, alpha: 0.0 }); self.clickCounter = storage.forgingSkill; self.interactive = true; self.down = function (x, y, obj) { self.clickCounter++; var shans = storage.multiclickupgrade ? 0.04 : 0.02; // Упрощено условие if (Math.random() < shans) { self.clickCounter += 500; var newAsset = game.addChild(LK.getAsset('multyclick', { anchorX: 0.5, anchorY: 0.5 })); newAsset.x = 2048 / 2; newAsset.y = 2732 / 2; tween(newAsset, { scaleX: 2, scaleY: 2 }, { duration: 500, easing: tween.easeInOut, onFinish: function onFinish() { newAsset.destroy(); } }); } counterText.setText('Forging skill: ' + self.clickCounter); storage.forgingSkill = self.clickCounter; // Упрощена логика изменения цвета текста counterText.tint = self.clickCounter >= 30000 ? 0xcc7c04 : self.clickCounter >= 15000 ? 0x800080 : self.clickCounter >= 2000 ? 0x0000FF : self.clickCounter >= 1000 ? 0x00FF00 : 0xFFFFFF; }; }); var BlueCristal = Container.expand(function () { var self = Container.call(this); self.attachAsset('blueCristal', { anchorX: 0.5, anchorY: 0.5, interactive: true }); self.down = function () { blueCrystallScore += 1100; LK.setScore(blueCrystallScore); storage.blueCrystallScore = blueCrystallScore; scoreTxt.setText('Blue Crystall: ' + LK.getScore()); scoreTxt.visible = true; }; }); var BlueCrystalIngot = Container.expand(function () { var self = Container.call(this); self.attachAsset('blueCrystalIngot', { anchorX: 0.5, anchorY: 0.5, interactive: true }); self.down = function () { if (blueCrystallScore >= 100) { blueCrystalIngotScore += 1; storage.growthRate += 1000; growthRateText.setText('Growth rate: ' + storage.growthRate); blueCrystalIngotScoreTxt.setText('BlueCrystalIngot: ' + blueCrystalIngotScore); storage.blueCrystalIngotScore = blueCrystalIngotScore; blueCrystallScore -= 10; if (blueCrystallScore < 0) { blueCrystallScore = 0; } storage.blueCrystallScore = blueCrystallScore; LK.setScore(blueCrystallScore); scoreTxt.setText('Blue Crystall: ' + LK.getScore()); } }; }); var Door = Container.expand(function () { var self = Container.call(this); self.attachAsset('Door', { anchorX: 0.5, anchorY: 0.5 }); self.interactive = true; self.down = function () { LK.getSound('doors').play(); hammer.destroy(); game.magicNursery = game.addChild(new Container()); var magicNurseryBackground = game.magicNursery.attachAsset('magicNurseryBackground', { anchorX: 0.5, anchorY: 0.5, interactive: false, scaleX: 2, scaleY: 2 }); magicNurseryBackground.x = 2048 / 2; magicNurseryBackground.y = 2732 / 2; var forgeOfMatter = game.magicNursery.attachAsset('ForgeOfMatter', { anchorX: 0.5, anchorY: 0.5, interactive: true, scaleX: 3, scaleY: 3, alpha: 0.0 }); var blueCrystalIngot = game.magicNursery.addChild(new BlueCrystalIngot()); blueCrystalIngot.x = 200 + blueCrystalIngot.width / 2; blueCrystalIngot.y = 2500 - blueCrystalIngot.height / 2; var redCrystalIngot = game.magicNursery.addChild(new RedCrystalIngot()); redCrystalIngot.x = 1300 / 2 + 350; redCrystalIngot.y = 4820 / 2; var greenCrystalIngotInstance = game.magicNursery.addChild(new GreenCrystalIngot()); greenCrystalIngotInstance.x = blueCrystalIngot.x + blueCrystalIngot.width + greenCrystalIngotInstance.width / 2 + 40; greenCrystalIngotInstance.y = blueCrystalIngot.y; var growthRate = game.magicNursery.addChild(LK.getAsset('growthRate', { anchorX: 0.5, anchorY: 0.5 })); growthRate.x = 700; growthRate.y = 1450; forgeOfMatter.down = function () { storage.growthRate++; growthRateText.setText('Growth rate: ' + storage.growthRate); }; forgeOfMatter.x = 1100 / 1.5; forgeOfMatter.y = 2000 / 1.5; gameScreen.visible = false; counterText.visible = true; map.visible = false; var door2 = game.magicNursery.addChild(new Door2()); door2.x = 2048 * 0.75; door2.y = 2732 * 0.9; hammer = game.addChild(LK.getAsset('hammer', { anchorX: 0.5, anchorY: 0.5, scaleX: -1 })); }; }); var Door2 = Container.expand(function () { var self = Container.call(this); self.attachAsset('Door', { anchorX: 0.5, anchorY: 0.5 }); self.interactive = true; self.down = function () { LK.getSound('doors').play(); hammer.destroy(); gameScreen.visible = true; map.visible = true; counterText.visible = true; game.magicNursery.visible = false; growthRateText.visible = true; hammer = game.addChild(LK.getAsset('hammer', { anchorX: 0.5, anchorY: 0.5, scaleX: -1 })); }; }); var GreenAxe = Container.expand(function () { var self = Container.call(this); self.attachAsset('axeOfGreenCrystalsRecipe', { anchorX: 0.5, anchorY: 0.5, interactive: true }); self.down = function () { if (storage.forgingSkill >= 8000 && storage.greenCrystalIngotScore >= 25) { greenAxeClicks += 1; if (greenAxeClicks >= 150) { greenAxeClicks = 0; storage.greenAxes += 1; greenAxesText.setText(storage.greenAxes.toString()); storage.forgingSkill += 150; counterText.setText('Forging skill: ' + storage.forgingSkill); if (greenCrystalIngotScore >= 150) { greenCrystalIngotScore -= 15; storage.greenCrystalIngotScore = greenCrystalIngotScore; greenCrystalIngotScoreTxt.setText('GreenCrystalIngot: ' + storage.greenCrystalIngotScore); } } greenAxeClicksText.setText('(current ' + greenAxeClicks + ')'); storage.greenAxeClicks = greenAxeClicks; } }; }); var GreenCristal = Container.expand(function () { var self = Container.call(this); self.attachAsset('greenCristal', { anchorX: 0.5, anchorY: 0.5, interactive: true }); self.down = function () { greenCrystallScore += 1000; storage.greenCrystallScore = greenCrystallScore; greenScoreTxt.setText('Green Crystall: ' + greenCrystallScore); greenScoreTxt.visible = true; }; }); var GreenCrystalIngot = Container.expand(function () { var self = Container.call(this); self.attachAsset('greenCrystalIngot', { anchorX: 0.5, anchorY: 0.5, interactive: true }); self.down = function () { if (storage.growthRate >= 3000 && greenCrystallScore >= 100) { storage.growthRate += 10; growthRateText.setText('Growth rate: ' + storage.growthRate); greenCrystalIngotScore += 1; greenCrystalIngotScoreTxt.setText('GreenCrystalIngot: ' + greenCrystalIngotScore); storage.greenCrystalIngotScore = greenCrystalIngotScore; greenCrystallScore -= 10; if (greenCrystallScore < 0) { greenCrystallScore = 0; } storage.greenCrystallScore = greenCrystallScore; greenScoreTxt.setText('Green Crystall: ' + greenCrystallScore); } }; }); var RecipesScreen = Container.expand(function () { var self = Container.call(this); }); var RedCristal = Container.expand(function () { var self = Container.call(this); self.attachAsset('redCristal', { anchorX: 0.5, anchorY: 0.5, interactive: true }); self.down = function () { redCrystallScore += 1000; storage.redCrystallScore = redCrystallScore; redScoreTxt.setText('Red Crystall: ' + redCrystallScore); redScoreTxt.visible = true; }; }); var RedCrystalIngot = Container.expand(function () { var self = Container.call(this); self.attachAsset('redCristalIngot', { anchorX: 0.5, anchorY: 0.5, interactive: true }); self.down = function () { if (storage.growthRate >= 9000 && redCrystallScore >= 100) { redCrystalIngotScore += 1; storage.growthRate += 20; growthRateText.setText('Growth rate: ' + storage.growthRate); redCrystalIngotScoreTxt.setText('RedCrystalIngot: ' + redCrystalIngotScore); storage.redCrystalIngotScore = redCrystalIngotScore; redCrystallScore -= 10; storage.redCrystallScore = redCrystallScore; redScoreTxt.setText('Red Crystall: ' + redCrystallScore); } }; }); var RedCrystalTwoHandedSword = Container.expand(function () { var self = Container.call(this); self.attachAsset('redcrystaltwo-handedswordrecipe', { anchorX: 0.5, anchorY: 0.5, interactive: true }); self.down = function () { if (storage.forgingSkill >= 15000 && storage.redCrystalIngotScore >= 75) { redCrystalTwoHandedSwordClicks += 1; redCrystalTwoHandedSwordClicksText.setText('(current ' + redCrystalTwoHandedSwordClicks + ')'); if (redCrystalTwoHandedSwordClicks >= 200) { redCrystalTwoHandedSwordClicks = 0; storage.redCrystalTwoHandedSwords += 1; redCrystalTwoHandedSwordsText.setText(storage.redCrystalTwoHandedSwords.toString()); storage.redCrystalIngotScore -= 75; redCrystalIngotScore = storage.redCrystalIngotScore; redCrystalIngotScoreTxt.setText('RedCrystalIngot: ' + redCrystalIngotScore); } else if (redCrystalTwoHandedSwordClicks >= 250) { // Исправлено условие redCrystalTwoHandedSwordClicks = 0; storage.redCrystalTwoHandedSwords += 250; redCrystalTwoHandedSwordsText.setText(storage.redCrystalTwoHandedSwords.toString()); } storage.redCrystalTwoHandedSwordClicks = redCrystalTwoHandedSwordClicks; } }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ // Не используется, можно удалить // Исправлен повтор ID var goldScore = storage.goldScore || 0; var goldScoreTxt = new Text2('Gold: ' + goldScore, { size: 50, fill: 0xFFFFFF }); goldScoreTxt.anchor.set(0, 0); goldScoreTxt.y = 0; goldScoreTxt.x = counterText ? counterText.width + 10 : 550; // Упрощено условие LK.gui.topLeft.addChild(goldScoreTxt); var redCrystalIngotScore = storage.redCrystalIngotScore || 0; var redCrystalIngotScoreTxt = new Text2('RedCrystalIngot: ' + redCrystalIngotScore, { size: 50, fill: 0xFFFFFF }); redCrystalIngotScoreTxt.anchor.set(1, 0); redCrystalIngotScoreTxt.y = 100; LK.gui.topRight.addChild(redCrystalIngotScoreTxt); var blueCrystallScore = storage.blueCrystallScore || 0; var automineblueCrystallClicked = storage.automineblueCrystallClicked; var autominegreenCrystallClicked = storage.autominegreenCrystallClicked; // Удален дубликат var automineredCrystallClicked = storage.automineredCrystallClicked; var autogrowthRateClicked = storage.autogrowthRateClicked; var scoreTxt = new Text2('Blue Crystall: ' + blueCrystallScore, { size: 50, fill: 0xFFFFFF }); scoreTxt.anchor.set(0, 0); scoreTxt.y = 100; LK.gui.topLeft.addChild(scoreTxt); var greenCrystallScore = storage.greenCrystallScore || 0; var greenScoreTxt = new Text2('Green Crystall: ' + greenCrystallScore, { size: 50, fill: 0xFFFFFF }); greenScoreTxt.anchor.set(0, 0); greenScoreTxt.y = 150; LK.gui.topLeft.addChild(greenScoreTxt); var greenCrystalIngotScore = storage.greenCrystalIngotScore || 0; var greenCrystalIngotScoreTxt = new Text2('GreenCrystalIngot: ' + greenCrystalIngotScore, { size: 50, fill: 0xFFFFFF }); greenCrystalIngotScoreTxt.anchor.set(1, 0); greenCrystalIngotScoreTxt.y = 50; LK.gui.topRight.addChild(greenCrystalIngotScoreTxt); var blueCristal, greenCristal, redCristal; // Объявлены глобально var blueCrystalIngotScore = storage.blueCrystalIngotScore || 0; var blueSwordsText = new Text2(storage.blueSwords.toString(), { size: 50, fill: 0x000000 }); blueSwordsText.anchor.set(0.5, 0.5); blueSwordsText.x = 1248 / 2; blueSwordsText.y = 2732 / 2 + 450; LK.gui.topLeft.addChild(blueSwordsText); var redCrystallScore = storage.redCrystallScore || 0; var blueCrystalIngotScoreTxt = new Text2('BlueCrystalIngot: ' + blueCrystalIngotScore, { size: 50, fill: 0xFFFFFF }); blueCrystalIngotScoreTxt.anchor.set(1, 0); blueCrystalIngotScoreTxt.y = 0; LK.gui.topRight.addChild(blueCrystalIngotScoreTxt); var redScoreTxt = new Text2('Red Crystall: ' + redCrystallScore, { size: 50, fill: 0xFFFFFF }); redScoreTxt.anchor.set(0, 0); redScoreTxt.y = 200; LK.gui.topLeft.addChild(redScoreTxt); var map = game.addChild(LK.getAsset('Map', { anchorX: 0.5, anchorY: 0.5 })); map.x = 400; map.y = 2450; map.visible = false; map.interactive = true; map.down = function () { hammer.destroy(); LK.getSound('mapaudio').play(); map.visible = false; if (mineInsideBackground) { mineInsideBackground.destroy(); } if (redCristal) { redCristal.destroy(); } if (blueCristal) { blueCristal.destroy(); } if (greenCristal) { greenCristal.destroy(); } var mapScreen = game.addChild(new Container()); var mapBackground = mapScreen.attachAsset('mapbackground', { anchorX: 0.5, anchorY: 0.5, interactive: false }); var cityMap = mapScreen.attachAsset('citymap', { anchorX: 0.5, anchorY: 0.5, interactive: true }); cityMap.x = -250; cityMap.y = 160; cityMap.down = function () { hammer.destroy(); var isolatedScreen = game.addChild(new Container()); mapScreen.visible = false; var cityBackground = isolatedScreen.attachAsset('citybackground', { anchorX: 0.5, anchorY: 0.5 }); cityBackground.x = 0; cityBackground.y = 0; var mapAsset = isolatedScreen.attachAsset('Map', { anchorX: 0.5, anchorY: 0.5, interactive: true }); mapAsset.x = -650; mapAsset.y = 1100; mapAsset.down = function () { isolatedScreen.visible = false; mapScreen.visible = true; cityBackground.visible = false; mapBackground.visible = true; }; var shop = isolatedScreen.attachAsset('shop', { anchorX: 0.5, anchorY: 0.5, interactive: true }); shop.x = 490; shop.y = -20; shop.down = function () { hammer.destroy(); LK.getSound('shopin').play(); var shopScreen = game.addChild(new Container()); isolatedScreen.visible = false; shopScreen.x = 2048 / 2; shopScreen.y = 2732 / 2; var newTools = shopScreen.attachAsset('newTools', { anchorX: 0.5, anchorY: 0.5, interactive: true }); newTools.x = -650; newTools.y = 1100; newTools.down = function () { hammer.destroy(); var isolatedScreen = game.addChild(new Container()); var newToolsBackground = isolatedScreen.attachAsset('newToolsBackground', { anchorX: 0.5, anchorY: 0.5 }); newToolsBackground.x = 0; newToolsBackground.y = 0; if (!storage.theBlacksmithsApprentice) { var theBlacksmithsApprentice = isolatedScreen.attachAsset('Theblacksmithsapprentice', { anchorX: 0.5, anchorY: 0.5, interactive: true }); theBlacksmithsApprentice.x = 400; theBlacksmithsApprentice.y = 200; theBlacksmithsApprentice.clicked = storage.theBlacksmithsApprentice; theBlacksmithsApprentice.down = function () { if (goldScore >= 1500 && !theBlacksmithsApprentice.clicked) { goldScore -= 1500; goldScoreTxt.setText('Gold: ' + goldScore); storage.goldScore = goldScore; theBlacksmithsApprentice.clicked = true; var intervalId = LK.setInterval(function () { storage.forgingSkill += 1; counterText.setText('Forging skill: ' + storage.forgingSkill); }, 1000); theBlacksmithsApprentice.intervalId = intervalId; storage.theBlacksmithsApprentice = true; theBlacksmithsApprentice.visible = false; apprenticeText.visible = false; apprenticeCostText.visible = false; } }; var apprenticeText = new Text2("The blacksmith's \napprentice +1", { size: 50, fill: 0x030303 }); apprenticeText.anchor.set(0.5, 0.5); apprenticeText.x = theBlacksmithsApprentice.x; apprenticeText.y = theBlacksmithsApprentice.y + 170; isolatedScreen.addChild(apprenticeText); var apprenticeCostText = new Text2('1500G', { size: 50, fill: 0x030303 }); apprenticeCostText.anchor.set(0.5, 0.5); apprenticeCostText.x = apprenticeText.x; apprenticeCostText.y = apprenticeText.y + 70; isolatedScreen.addChild(apprenticeCostText); } var newToolsOut = isolatedScreen.attachAsset('newToolsout', { anchorX: 0.5, anchorY: 0.5, interactive: true }); newToolsOut.x = 0; newToolsOut.y = 1100; if (!storage.automineblueCrystallClicked) { var automineblueCrystall = isolatedScreen.attachAsset('automineblueCrystall', { anchorX: 0.5, anchorY: 0.5, interactive: true }); automineblueCrystall.x = -400; automineblueCrystall.y = -600; automineblueCrystall.clicked = storage.automineblueCrystallClicked; automineblueCrystall.down = function () { if (goldScore >= 500 && !automineblueCrystall.clicked) { automineblueCrystall.clicked = true; goldScore -= 500; goldScoreTxt.setText('Gold: ' + goldScore); storage.goldScore = goldScore; var intervalId = LK.setInterval(function () { blueCrystallScore += 1; LK.setScore(blueCrystallScore); storage.blueCrystallScore = blueCrystallScore; scoreTxt.setText('Blue Crystall: ' + LK.getScore()); }, 1000); automineblueCrystall.intervalId = intervalId; storage.automineblueCrystallClicked = true; automineblueCrystall.visible = false; mineBlueCrystallText.visible = false; mineBlueCrystallCostText.visible = false; } }; var mineBlueCrystallText = new Text2('Mine Blue Crystall +1', { size: 50, fill: 0x030303 }); mineBlueCrystallText.anchor.set(0.5, 0.5); mineBlueCrystallText.x = automineblueCrystall.x; mineBlueCrystallText.y = automineblueCrystall.y + 150; isolatedScreen.addChild(mineBlueCrystallText); var mineBlueCrystallCostText = new Text2('500G', { size: 50, fill: 0x030303 }); mineBlueCrystallCostText.anchor.set(0.5, 0.5); mineBlueCrystallCostText.x = mineBlueCrystallText.x; mineBlueCrystallCostText.y = mineBlueCrystallText.y + 50; isolatedScreen.addChild(mineBlueCrystallCostText); } // Аналогично для других покупок в магазине (autominegreenCrystall, automineredCrystall, multiclickupgrade, autogrowthRate) newToolsOut.down = function () { LK.getSound('booksaudio').play(); isolatedScreen.visible = false; shopScreen.visible = true; }; shopScreen.visible = false; isolatedScreen.x = 2048 / 2; isolatedScreen.y = 2732 / 2; hammer = game.addChild(LK.getAsset('hammer', { anchorX: 0.5, anchorY: 0.5, scaleX: -1 })); }; var shopBackground = shopScreen.attachAsset('shopbackground', { anchorX: 0.5, anchorY: 0.5 }); shopBackground.x = 0; shopBackground.y = 0; var newBuildings = shopScreen.attachAsset('sellweapons', { anchorX: 0.5, anchorY: 0.5, interactive: true }); newBuildings.down = function () { goldScore += storage.blueSwords * 100 + storage.greenAxes * 300 + storage.redCrystalTwoHandedSwords * 100; storage.blueSwords = 0; storage.greenAxes = 0; storage.redCrystalTwoHandedSwords = 0; blueSwordsText.setText('0'); goldScoreTxt.setText('Gold: ' + goldScore); storage.goldScore = goldScore; }; newBuildings.x = 0; newBuildings.y = 1100; var shopOut = shopScreen.attachAsset('shopout', { anchorX: 0.5, anchorY: 0.5, interactive: true }); shopOut.x = 650; shopOut.y = 1100; shopOut.down = function () { LK.getSound('doors').play(); shopScreen.visible = false; mapScreen.visible = true; isolatedScreen.visible = true; }; hammer = game.addChild(LK.getAsset('hammer', { anchorX: 0.5, anchorY: 0.5, scaleX: -1 })); }; isolatedScreen.x = 2048 / 2; isolatedScreen.y = 2732 / 2; hammer = game.addChild(LK.getAsset('hammer', { anchorX: 0.5, anchorY: 0.5, scaleX: -1 })); }; var anvilMap = mapScreen.attachAsset('anvilmap', { anchorX: 0.5, anchorY: 0.5, interactive: true }); var mine = mapScreen.attachAsset('mine', { anchorX: 0.5, anchorY: 0.5, interactive: true }); mine.x -= 150; mine.y -= 150; mine.down = function () { hammer.destroy(); var mineScreen = game.addChild(new Container()); map.visible = true; mapScreen.visible = false; background.visible = false; mineInsideBackground = mineScreen.attachAsset('mineinsidebackground', { anchorX: 0.5, anchorY: 0.5, interactive: false, zIndex: -1 }); redCristal = mineScreen.addChild(new RedCristal()); redCristal.x -= 510; redCristal.y += 490; greenCristal = mineScreen.addChild(new GreenCristal()); greenCristal.x += 510; greenCristal.y += 10; blueCristal = mineScreen.addChild(new BlueCristal()); blueCristal.x += 80; blueCristal.y -= 370; mineScreen.x = 2048 / 2; mineScreen.y = 2732 / 2; hammer = game.addChild(LK.getAsset('hammer', { anchorX: 0.5, anchorY: 0.5, scaleX: -1 })); }; anvilMap.down = function () { gameScreen.visible = true; map.visible = true; gameScreenBackground = gameScreen.attachAsset('gameScreenBackground', { anchorX: 0.5, anchorY: 0.5 }); var recipes = gameScreenBackground.attachAsset('recipes', { anchorX: 0.5, anchorY: 0.5 }); recipes.x = gameScreenBackground.width / 2 - 1050; recipes.y = gameScreenBackground.height / 2 + 150; if (mineInsideBackground) { mineInsideBackground.destroy(); } if (blueCristal) { blueCristal.destroy(); } if (greenCristal) { greenCristal.destroy(); } if (redCristal) { redCristal.destroy(); } mapScreen.visible = false; counterText.visible = true; growthRateText.visible = true; }; gameScreen.visible = false; background.visible = false; mapScreen.x = 2048 / 2; mapScreen.y = 2732 / 2; hammer = game.addChild(LK.getAsset('hammer', { anchorX: 0.5, anchorY: 0.5, scaleX: -1 })); }; var growthRateCounter = storage.growthRate; var background = game.addChild(new Container()); background.width = 2048; background.height = 2732; background.x = 2048 / 2; background.y = 2732 / 2; var backgroundGraphics = background.attachAsset('background', { anchorX: 0.5, anchorY: 0.5 }); var gameScreen = game.addChild(new Container()); var newGame = game.addChild(new Container()); newGame.x = 2650 / 2 + 100; newGame.y = 2680 * 4.2 / 5; var title = game.addChild(LK.getAsset('title', { anchorX: 0.5, anchorY: 0.5 })); title.x = 2048 / 2; title.y = 3200 / 5; var newGameText = newGame.attachAsset('newGameText', { anchorX: 0.5, anchorY: 0.5, stroke: 0xFFFFFF, strokeThickness: 5 }); var continueText = game.addChild(LK.getAsset('continueText', { anchorX: 0.5, anchorY: 0.5, interactive: true })); continueText.x = newGame.x - newGame.width - 500; continueText.y = newGame.y; continueText.down = startgame; var blueswordsclick = storage.blueswordsclick; var greenAxeClicks = storage.greenAxeClicks; var redCrystalTwoHandedSwordClicks = storage.redCrystalTwoHandedSwordClicks; function startgame() { title.destroy(); hammer.destroy(); gameScreen = game.addChild(new Container()); gameScreen.x = 2048 / 2; gameScreen.y = 2732 / 2; gameScreenBackground = gameScreen.attachAsset('gameScreenBackground', { anchorX: 0.5, anchorY: 0.5 }); var recipes = gameScreenBackground.attachAsset('recipes', { anchorX: 0.5, anchorY: 0.5, interactive: true }); recipes.down = function () { hammer.destroy(); LK.getSound('booksaudio').play(); var recipesScreen = game.addChild(new RecipesScreen()); map.visible = false; var recipesBackground = recipesScreen.attachAsset('recipesbackground', { anchorX: 0.5, anchorY: 0.5 }); recipesBackground.x = 2048 / 2; recipesBackground.y = 2932 / 2; var bluecrystalswordrecipe = recipesScreen.attachAsset('bluecrystalswordrecipe', { anchorX: 0.5, anchorY: 0.5 }); bluecrystalswordrecipe.x = 1248 / 2; bluecrystalswordrecipe.y = 2132 / 2; bluecrystalswordrecipe.down = function () { if (storage.forgingSkill >= 2000 && storage.blueCrystalIngotScore >= 10) { blueswordsclick += 1; if (blueswordsclick >= 100) { blueswordsclick = 0; storage.blueSwords += 1; blueSwordsText.setText(storage.blueSwords.toString()); storage.forgingSkill += 100; counterText.setText('Forging skill: ' + storage.forgingSkill); if (storage.blueCrystalIngotScore >= 10) { storage.blueCrystalIngotScore -= 10; blueCrystalIngotScore = storage.blueCrystalIngotScore; blueCrystalIngotScoreTxt.setText('BlueCrystalIngot: ' + blueCrystalIngotScore); } } blueCrystalSwordClicks.setText('(current ' + blueswordsclick + ')'); storage.blueswordsclick = blueswordsclick; } }; // Добавление остальных элементов экрана рецептов аналогично var recipesOutGraphics = recipesScreen.attachAsset('recipesout', { anchorX: 0.5, anchorY: 0.5, interactive: true }); recipesOutGraphics.x = 2048 / 2; recipesOutGraphics.y = 2732 / 2 + 1100; recipesOutGraphics.down = function () { LK.getSound('paper').play(); gameScreen.visible = true; map.visible = true; recipesScreen.visible = false; }; gameScreen.visible = false; }; recipes.x = gameScreenBackground.width / 2 - 1050; recipes.y = gameScreenBackground.height / 2 + 150; map.visible = true; newGame.visible = false; continueText.visible = false; background.visible = false; var anvil = gameScreen.addChild(new Anvil()); anvil.clickCounter = storage.forgingSkill; counterText.setText('Forging skill: ' + anvil.clickCounter); anvil.x = gameScreenBackground.x - -20; anvil.y = gameScreenBackground.y + 500; var magicNursery = gameScreen.addChild(new Door()); magicNursery.x = 2048 / 4; magicNursery.y = 2732 / 2.5; hammer = game.addChild(LK.getAsset('hammer', { anchorX: 0.5, anchorY: 0.5, scaleX: -1 })); } newGame.interactive = true; newGame.down = function () { newgameclearInterval.forEach(function (id) { return LK.clearInterval(id); }); storage.automineblueCrystallClicked = false; storage.autominegreenCrystallClicked = false; storage.automineredCrystallClicked = false; storage.autogrowthRateClicked = false; storage.theBlacksmithsApprentice = false; storage.multiclickupgrade = false; storage.forgingSkill = 0; storage.growthRate = 0; storage.blueCrystalIngotScore = 0; storage.blueCrystallScore = 0; storage.greenCrystalIngotScore = 0; storage.redCrystallScore = 0; storage.redCrystalIngotScore = 0; storage.greenCrystallScore = 0; storage.blueSwords = 0; storage.goldScore = 0; redCrystalIngotScore = 0; blueCrystallScore = 0; greenCrystallScore = 0; greenCrystalIngotScore = 0; blueCrystalIngotScore = 0; redCrystallScore = 0; growthRateCounter = 0; goldScore = 0; growthRateText.setText('Growth rate: ' + storage.growthRate); counterText.setText('Forging skill: ' + storage.forgingSkill); scoreTxt.setText('Blue Crystall: ' + blueCrystallScore); greenScoreTxt.setText('Green Crystall: ' + greenCrystallScore); redScoreTxt.setText('Red Crystall: ' + redCrystallScore); blueCrystalIngotScoreTxt.setText('BlueCrystalIngot: ' + storage.blueCrystalIngotScore); greenCrystalIngotScoreTxt.setText('GreenCrystalIngot: ' + storage.greenCrystalIngotScore); redCrystalIngotScoreTxt.setText('RedCrystalIngot: ' + storage.redCrystalIngotScore); goldScoreTxt.setText('Gold: ' + goldScore); startgame(); }; var counterText = new Text2('Forging skill: ' + storage.forgingSkill, { size: 50, fill: 0xFFFFFF }); counterText.anchor.set(0, 0); LK.gui.topLeft.addChild(counterText); counterText.y = 0; counterText.x = 0; var growthRateText = new Text2('Growth rate: ' + growthRateCounter, { size: 50, fill: 0xFFFFFF }); growthRateText.anchor.set(0, 0); LK.gui.topLeft.addChild(growthRateText); growthRateText.y = counterText.height - 6; growthRateText.x = 0; var hammer = game.addChild(LK.getAsset('hammer', { anchorX: 0.5, anchorY: 0.5, scaleX: -1 })); function updateHammerPosition(x, y) { if (hammer) { hammer.x = x; hammer.y = y; } } var newgameclearInterval = []; if (automineblueCrystallClicked) { var intervalId = LK.setInterval(function () { blueCrystallScore += 1; LK.setScore(blueCrystallScore); storage.blueCrystallScore = blueCrystallScore; scoreTxt.setText('Blue Crystall: ' + LK.getScore()); }, 1000); newgameclearInterval.push(intervalId); } // Аналогично для других интервалов var seconds = Math.floor(Date.now() / 1000) - storage.lastgametime; if (seconds * 60 * 5 > Math.floor(Date.now() / 1000)) { seconds = 5 * 60 * 60; } if (seconds > 0) { if (storage.automineblueCrystallClicked) { blueCrystallScore = storage.blueCrystallScore += seconds; } if (storage.autominegreenCrystallClicked) { greenCrystallScore = storage.greenCrystallScore += seconds; } if (storage.automineredCrystallClicked) { redCrystallScore = storage.redCrystallScore += seconds; } if (storage.autogrowthRateClicked) { growthRateCounter = storage.growthRate += seconds; } if (storage.theBlacksmithsApprentice) { storage.forgingSkill += seconds; } } LK.setInterval(function () { storage.lastgametime = Math.floor(Date.now() / 1000); }, 1000); game.move = function (x, y) { updateHammerPosition(x, y); }; game.down = function (x, y) { LK.getSound('hammer').play(); tween(hammer, { rotation: -Math.PI / 2 }, { duration: 125, easing: tween.easeInOut, onFinish: function onFinish() { for (var i = 0; i < 5; i++) { var star = game.addChild(LK.getAsset('star', { anchorX: 0.5, anchorY: 0.5 })); star.x = hammer.x - hammer.width / 2 + Math.random() * 100 - 25; star.y = hammer.y + hammer.height / 2 + Math.random() * 100 - 25; star.update = function () { star.y -= 5; star.x += star.x < hammer.x ? 2 : -2; }; LK.setTimeout(function () { star.destroy(); }, 250); } tween(hammer, { rotation: 0 }, { duration: 125, easing: tween.easeInOut }); } }); };
===================================================================
--- original.js
+++ change.js
@@ -18,27 +18,32 @@
autogrowthRateClicked: false,
multiclickupgrade: false,
theBlacksmithsApprentice: false,
automineredCrystallClicked: false,
- lastgametime: 0
+ lastgametime: 0,
+ goldScore: 0,
+ greenCrystallScore: 0,
+ redCrystallScore: 0,
+ redCrystalIngotScore: 0,
+ blueCrystalIngotScore: 0
});
/****
* Classes
****/
var Anvil = Container.expand(function () {
var self = Container.call(this);
- self.attachAsset('anvil', {
+ var anvilGraphics = self.attachAsset('anvil', {
anchorX: 0.5,
anchorY: 0.5,
alpha: 0.0
});
self.clickCounter = storage.forgingSkill;
self.interactive = true;
- self.down = function () {
+ self.down = function (x, y, obj) {
self.clickCounter++;
- var chance = storage.multiclickupgrade ? 0.04 : 0.02;
- if (Math.random() < chance) {
+ var shans = storage.multiclickupgrade ? 0.04 : 0.02; // Упрощено условие
+ if (Math.random() < shans) {
self.clickCounter += 500;
var newAsset = game.addChild(LK.getAsset('multyclick', {
anchorX: 0.5,
anchorY: 0.5
@@ -51,15 +56,16 @@
}, {
duration: 500,
easing: tween.easeInOut,
onFinish: function onFinish() {
- return newAsset.destroy();
+ newAsset.destroy();
}
});
}
- counterText.setText("Forging skill: ".concat(self.clickCounter));
+ counterText.setText('Forging skill: ' + self.clickCounter);
storage.forgingSkill = self.clickCounter;
- updateCounterColor(self.clickCounter);
+ // Упрощена логика изменения цвета текста
+ counterText.tint = self.clickCounter >= 30000 ? 0xcc7c04 : self.clickCounter >= 15000 ? 0x800080 : self.clickCounter >= 2000 ? 0x0000FF : self.clickCounter >= 1000 ? 0x00FF00 : 0xFFFFFF;
};
});
var BlueCristal = Container.expand(function () {
var self = Container.call(this);
@@ -69,9 +75,12 @@
interactive: true
});
self.down = function () {
blueCrystallScore += 1100;
- updateScore('blueCrystallScore', blueCrystallScore, scoreTxt, 'Blue Crystall');
+ LK.setScore(blueCrystallScore);
+ storage.blueCrystallScore = blueCrystallScore;
+ scoreTxt.setText('Blue Crystall: ' + LK.getScore());
+ scoreTxt.visible = true;
};
});
var BlueCrystalIngot = Container.expand(function () {
var self = Container.call(this);
@@ -83,15 +92,18 @@
self.down = function () {
if (blueCrystallScore >= 100) {
blueCrystalIngotScore += 1;
storage.growthRate += 1000;
+ growthRateText.setText('Growth rate: ' + storage.growthRate);
+ blueCrystalIngotScoreTxt.setText('BlueCrystalIngot: ' + blueCrystalIngotScore);
+ storage.blueCrystalIngotScore = blueCrystalIngotScore;
blueCrystallScore -= 10;
if (blueCrystallScore < 0) {
blueCrystallScore = 0;
}
- updateScore('blueCrystallScore', blueCrystallScore, scoreTxt, 'Blue Crystall');
- updateScore('blueCrystalIngotScore', blueCrystalIngotScore, blueCrystalIngotScoreTxt, 'BlueCrystalIngot');
- growthRateText.setText("Growth rate: ".concat(storage.growthRate));
+ storage.blueCrystallScore = blueCrystallScore;
+ LK.setScore(blueCrystallScore);
+ scoreTxt.setText('Blue Crystall: ' + LK.getScore());
}
};
});
var Door = Container.expand(function () {
@@ -121,36 +133,40 @@
scaleX: 3,
scaleY: 3,
alpha: 0.0
});
- forgeOfMatter.x = 1100 / 1.5;
- forgeOfMatter.y = 2000 / 1.5;
- forgeOfMatter.down = function () {
- storage.growthRate++;
- growthRateText.setText("Growth rate: ".concat(storage.growthRate));
- };
var blueCrystalIngot = game.magicNursery.addChild(new BlueCrystalIngot());
blueCrystalIngot.x = 200 + blueCrystalIngot.width / 2;
blueCrystalIngot.y = 2500 - blueCrystalIngot.height / 2;
var redCrystalIngot = game.magicNursery.addChild(new RedCrystalIngot());
redCrystalIngot.x = 1300 / 2 + 350;
redCrystalIngot.y = 4820 / 2;
- var greenCrystalIngot = game.magicNursery.addChild(new GreenCrystalIngot());
- greenCrystalIngot.x = blueCrystalIngot.x + blueCrystalIngot.width + greenCrystalIngot.width / 2 + 40;
- greenCrystalIngot.y = blueCrystalIngot.y;
+ var greenCrystalIngotInstance = game.magicNursery.addChild(new GreenCrystalIngot());
+ greenCrystalIngotInstance.x = blueCrystalIngot.x + blueCrystalIngot.width + greenCrystalIngotInstance.width / 2 + 40;
+ greenCrystalIngotInstance.y = blueCrystalIngot.y;
var growthRate = game.magicNursery.addChild(LK.getAsset('growthRate', {
anchorX: 0.5,
anchorY: 0.5
}));
growthRate.x = 700;
growthRate.y = 1450;
+ forgeOfMatter.down = function () {
+ storage.growthRate++;
+ growthRateText.setText('Growth rate: ' + storage.growthRate);
+ };
+ forgeOfMatter.x = 1100 / 1.5;
+ forgeOfMatter.y = 2000 / 1.5;
gameScreen.visible = false;
counterText.visible = true;
map.visible = false;
var door2 = game.magicNursery.addChild(new Door2());
door2.x = 2048 * 0.75;
door2.y = 2732 * 0.9;
- hammer = createHammer();
+ hammer = game.addChild(LK.getAsset('hammer', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ scaleX: -1
+ }));
};
});
var Door2 = Container.expand(function () {
var self = Container.call(this);
@@ -166,519 +182,813 @@
map.visible = true;
counterText.visible = true;
game.magicNursery.visible = false;
growthRateText.visible = true;
- hammer = createHammer();
+ hammer = game.addChild(LK.getAsset('hammer', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ scaleX: -1
+ }));
};
});
+var GreenAxe = Container.expand(function () {
+ var self = Container.call(this);
+ self.attachAsset('axeOfGreenCrystalsRecipe', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ interactive: true
+ });
+ self.down = function () {
+ if (storage.forgingSkill >= 8000 && storage.greenCrystalIngotScore >= 25) {
+ greenAxeClicks += 1;
+ if (greenAxeClicks >= 150) {
+ greenAxeClicks = 0;
+ storage.greenAxes += 1;
+ greenAxesText.setText(storage.greenAxes.toString());
+ storage.forgingSkill += 150;
+ counterText.setText('Forging skill: ' + storage.forgingSkill);
+ if (greenCrystalIngotScore >= 150) {
+ greenCrystalIngotScore -= 15;
+ storage.greenCrystalIngotScore = greenCrystalIngotScore;
+ greenCrystalIngotScoreTxt.setText('GreenCrystalIngot: ' + storage.greenCrystalIngotScore);
+ }
+ }
+ greenAxeClicksText.setText('(current ' + greenAxeClicks + ')');
+ storage.greenAxeClicks = greenAxeClicks;
+ }
+ };
+});
+var GreenCristal = Container.expand(function () {
+ var self = Container.call(this);
+ self.attachAsset('greenCristal', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ interactive: true
+ });
+ self.down = function () {
+ greenCrystallScore += 1000;
+ storage.greenCrystallScore = greenCrystallScore;
+ greenScoreTxt.setText('Green Crystall: ' + greenCrystallScore);
+ greenScoreTxt.visible = true;
+ };
+});
+var GreenCrystalIngot = Container.expand(function () {
+ var self = Container.call(this);
+ self.attachAsset('greenCrystalIngot', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ interactive: true
+ });
+ self.down = function () {
+ if (storage.growthRate >= 3000 && greenCrystallScore >= 100) {
+ storage.growthRate += 10;
+ growthRateText.setText('Growth rate: ' + storage.growthRate);
+ greenCrystalIngotScore += 1;
+ greenCrystalIngotScoreTxt.setText('GreenCrystalIngot: ' + greenCrystalIngotScore);
+ storage.greenCrystalIngotScore = greenCrystalIngotScore;
+ greenCrystallScore -= 10;
+ if (greenCrystallScore < 0) {
+ greenCrystallScore = 0;
+ }
+ storage.greenCrystallScore = greenCrystallScore;
+ greenScoreTxt.setText('Green Crystall: ' + greenCrystallScore);
+ }
+ };
+});
+var RecipesScreen = Container.expand(function () {
+ var self = Container.call(this);
+});
+var RedCristal = Container.expand(function () {
+ var self = Container.call(this);
+ self.attachAsset('redCristal', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ interactive: true
+ });
+ self.down = function () {
+ redCrystallScore += 1000;
+ storage.redCrystallScore = redCrystallScore;
+ redScoreTxt.setText('Red Crystall: ' + redCrystallScore);
+ redScoreTxt.visible = true;
+ };
+});
var RedCrystalIngot = Container.expand(function () {
var self = Container.call(this);
self.attachAsset('redCristalIngot', {
anchorX: 0.5,
anchorY: 0.5,
interactive: true
});
self.down = function () {
- if (redCrystallScore >= 100) {
+ if (storage.growthRate >= 9000 && redCrystallScore >= 100) {
redCrystalIngotScore += 1;
- storage.growthRate += 1000;
+ storage.growthRate += 20;
+ growthRateText.setText('Growth rate: ' + storage.growthRate);
+ redCrystalIngotScoreTxt.setText('RedCrystalIngot: ' + redCrystalIngotScore);
+ storage.redCrystalIngotScore = redCrystalIngotScore;
redCrystallScore -= 10;
- if (redCrystallScore < 0) {
- redCrystallScore = 0;
+ storage.redCrystallScore = redCrystallScore;
+ redScoreTxt.setText('Red Crystall: ' + redCrystallScore);
+ }
+ };
+});
+var RedCrystalTwoHandedSword = Container.expand(function () {
+ var self = Container.call(this);
+ self.attachAsset('redcrystaltwo-handedswordrecipe', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ interactive: true
+ });
+ self.down = function () {
+ if (storage.forgingSkill >= 15000 && storage.redCrystalIngotScore >= 75) {
+ redCrystalTwoHandedSwordClicks += 1;
+ redCrystalTwoHandedSwordClicksText.setText('(current ' + redCrystalTwoHandedSwordClicks + ')');
+ if (redCrystalTwoHandedSwordClicks >= 200) {
+ redCrystalTwoHandedSwordClicks = 0;
+ storage.redCrystalTwoHandedSwords += 1;
+ redCrystalTwoHandedSwordsText.setText(storage.redCrystalTwoHandedSwords.toString());
+ storage.redCrystalIngotScore -= 75;
+ redCrystalIngotScore = storage.redCrystalIngotScore;
+ redCrystalIngotScoreTxt.setText('RedCrystalIngot: ' + redCrystalIngotScore);
+ } else if (redCrystalTwoHandedSwordClicks >= 250) {
+ // Исправлено условие
+ redCrystalTwoHandedSwordClicks = 0;
+ storage.redCrystalTwoHandedSwords += 250;
+ redCrystalTwoHandedSwordsText.setText(storage.redCrystalTwoHandedSwords.toString());
}
- updateScore('redCrystallScore', redCrystallScore, redScoreTxt, 'Red Crystall');
- updateScore('redCrystalIngotScore', redCrystalIngotScore, redCrystalIngotScoreTxt, 'RedCrystalIngot');
- growthRateText.setText("Growth rate: ".concat(storage.growthRate));
+ storage.redCrystalTwoHandedSwordClicks = redCrystalTwoHandedSwordClicks;
}
};
});
/****
* Initialize Game
****/
-// Другие классы (GreenAxe, GreenCristal, etc.) оптимизированы аналогично, но опущены для краткости
var game = new LK.Game({
backgroundColor: 0x000000
});
/****
* Game Code
****/
-var SHAPES = [{
- name: 'Gold',
- width: 100,
- height: 100,
- color: 0xba3e24,
- shape: 'box'
-}, {
- name: 'anvil',
- width: 480,
- height: 300,
- color: 0x90b8f4,
- shape: 'box'
-}, {
- name: 'hint',
- width: 100,
- height: 100,
- color: 0x9eec73,
- shape: 'box'
-}, {
- name: 'hintbook',
- width: 150,
- height: 200,
- color: 0xf4a5c5,
- shape: 'box'
-}].forEach(function (s) {});
-var IMAGES = [{
- name: 'Door',
- width: 300,
- height: 300,
- id: '6794cd7686e5290db4ef0f61'
-}, {
- name: 'Map',
- width: 300,
- height: 300,
- id: '67960d5478a5ca831e38e79f'
-}, {
- name: 'Theblacksmithsapprentice',
- width: 250,
- height: 250,
- id: '67b872b7f35062e15c95627b'
-}, {
- name: 'additionalAssetId',
- width: 100,
- height: 100,
- id: '67b35cb8a9534c1274453a27'
-}, {
- name: 'anvilmap',
- width: 100,
- height: 100,
- id: '6796204778a5ca831e38e7db'
-}, {
- name: 'autogrowthRate',
- width: 360,
- height: 300,
- id: '67b4c3c752a1da49713d524a'
-}, {
- name: 'automineblueCrystall',
- width: 250,
- height: 250,
- id: '67b4bd8952a1da49713d51e5'
-}, {
- name: 'autominegreenCrystall',
- width: 250,
- height: 250,
- id: '67b4be1152a1da49713d51fa'
-}, {
- name: 'automineredCrystall',
- width: 250,
- height: 250,
- id: '67b4ba73345af481077a5a3a'
-}, {
- name: 'axeOfGreenCrystalsRecipe',
- width: 300,
- height: 500,
- id: '67991a67090093ccb7744bb4'
-}, {
- name: 'background',
- width: 2000,
- height: 2000,
- id: '67b07ea12e29576e5caf3b79'
-}, {
- name: 'blueCristal',
- width: 300,
- height: 300,
- id: '67b89f3ddacac0208c8f6e0e'
-}, {
- name: 'blueCrystalIngot',
- width: 200,
- height: 180,
- id: '67966dd1690fa8a090669322'
-}, {
- name: 'bluecrystalswordrecipe',
- width: 400,
- height: 400,
- id: '67991043090093ccb7744b1a',
- flipX: 1,
- flipY: 1,
- orientation: 3
-}, {
- name: 'blueingotrecipe',
- width: 200,
- height: 150,
- id: '67bf46c527fc48d849e4e932'
-}, {
- name: 'citybackground',
- width: 2000,
- height: 2000,
- id: '67a0d50d52a2e35ca0eb5c70'
-}, {
- name: 'citymap',
- width: 150,
- height: 150,
- id: '679f607e55b87b3a41d5d55a'
-}, {
- name: 'continueText',
- width: 300,
- height: 370,
- id: '67b060fe2e29576e5caf3af2'
-}, {
- name: 'gameScreenBackground',
- width: 2000,
- height: 1900,
- id: '67b8ba062d0daaf579fc58d0'
-}, {
- name: 'greenCristal',
- width: 300,
- height: 300,
- id: '67b8a0c4dacac0208c8f6e47'
-}, {
- name: 'greenCrystalIngot',
- width: 210,
- height: 190,
- id: '67967631690fa8a090669346'
-}, {
- name: 'greeningotrecipe',
- width: 200,
- height: 190.48,
- id: '67967631690fa8a090669346'
-}, {
- name: 'growthRate',
- width: 300,
- height: 300,
- id: '67b8aa3cdacac0208c8f6ea0'
-}, {
- name: 'hammer',
- width: 150,
- height: 150,
- id: '6794cebe86e5290db4ef0f74'
-}, {
- name: 'inventory',
- width: 100,
- height: 100,
- id: '6796366278a5ca831e38e8f9'
-}, {
- name: 'magicNurseryBackground',
- width: 1000,
- height: 1000,
- id: '67965c40690fa8a090669227'
-}, {
- name: 'mapbackground',
- width: 1900,
- height: 1900,
- id: '67960c7078a5ca831e38e78c'
-}, {
- name: 'mine',
- width: 80,
- height: 100,
- id: '6796224378a5ca831e38e807'
-}, {
- name: 'mineinsidebackground',
- width: 1850,
- height: 1850,
- id: '679625c578a5ca831e38e821'
-}, {
- name: 'multiclickupgrade',
- width: 280,
- height: 280,
- id: '67b4d29752a1da49713d526e'
-}, {
- name: 'multyclick',
- width: 200,
- height: 200,
- id: '67a38faeec1e8c186c4e68aa'
-}, {
- name: 'newGameText',
- width: 300,
- height: 400,
- id: '67b0610c2e29576e5caf3af6'
-}, {
- name: 'newTools',
- width: 200,
- height: 200,
- id: '67a4ed1a15483cfd543c1702'
-}, {
- name: 'newToolsBackground',
- width: 2000,
- height: 2000,
- id: '679905e1090093ccb7744b04'
-}, {
- name: 'newToolsout',
- width: 300,
- height: 300,
- id: '6797a530690fa8a090669c76'
-}, {
- name: 'recipes',
- width: 350,
- height: 350,
- id: '6797a530690fa8a090669c76'
-}, {
- name: 'recipesbackground',
- width: 2000,
- height: 2000,
- id: '679905e1090093ccb7744b04'
-}, {
- name: 'recipesnext',
- width: 350,
- height: 350,
- id: '679b9f5d0f1a2ec74003f873'
-}, {
- name: 'recipesnext2',
- width: 350,
- height: 350,
- id: '679b9f5d0f1a2ec74003f873'
-}, {
- name: 'recipesnextbackgr1',
- width: 2000,
- height: 2000,
- id: '679905e1090093ccb7744b04'
-}, {
- name: 'recipesout',
- width: 350,
- height: 350,
- id: '6797a530690fa8a090669c76'
-}, {
- name: 'recipesprev',
- width: 350,
- height: 350,
- id: '679b9f5d0f1a2ec74003f873',
- flipX: 1
-}, {
- name: 'redCristal',
- width: 500,
- height: 600,
- id: '67b8a15bdacac0208c8f6e55'
-}, {
- name: 'redCristalIngot',
- width: 210,
- height: 190,
- id: '67967c31690fa8a0906693e7'
-}, {
- name: 'redcrystaltwo-handedswordrecipe',
- width: 400,
- height: 400,
- id: '67adcc78e366fb4797fc38c0'
-}, {
- name: 'redingotrecipe',
- width: 250,
- height: 180,
- id: '67bf4c3827fc48d849e4e955'
-}, {
- name: 'sellweapons',
- width: 300,
- height: 300,
- id: '67b35cb8a9534c1274453a27'
-}, {
- name: 'shop',
- width: 400,
- height: 400,
- id: '67be174fc61ffecc5503a69d'
-}, {
- name: 'shopbackground',
- width: 2000,
- height: 2000,
- id: '67a0f8b752a2e35ca0eb5fdf'
-}, {
- name: 'shopout',
- width: 300,
- height: 300,
- id: '6794cd7686e5290db4ef0f61'
-}, {
- name: 'star',
- width: 50,
- height: 50,
- id: '6794fd2986e5290db4ef104a'
-}, {
- name: 'title',
- width: 900,
- height: 400,
- id: '67b8af589837459f356f3e4b'
-}].forEach(function (i) {});
-var SOUNDS = [{
- name: 'booksaudio',
- volume: 1,
- start: 0,
- end: 1,
- id: '67b8a6c6dacac0208c8f6e80'
-}, {
- name: 'doors',
- volume: 1,
- start: 0,
- end: 1,
- id: '67b8a3d2dacac0208c8f6e73'
-}, {
- name: 'hammer',
- volume: 1,
- start: 0,
- end: 0.862,
- id: '6794fd6d86e5290db4ef1050'
-}, {
- name: 'mapaudio',
- volume: 1,
- start: 0,
- end: 1,
- id: '67b8a489dacac0208c8f6e79'
-}, {
- name: 'paper',
- volume: 1,
- start: 0,
- end: 1,
- id: '67b8a489dacac0208c8f6e79'
-}, {
- name: 'shopin',
- volume: 1,
- start: 0,
- end: 0.776,
- id: '67b8a891dacac0208c8f6e8a'
-}].forEach(function (s) {});
+// Не используется, можно удалить
+// Исправлен повтор ID
+var goldScore = storage.goldScore || 0;
+var goldScoreTxt = new Text2('Gold: ' + goldScore, {
+ size: 50,
+ fill: 0xFFFFFF
+});
+goldScoreTxt.anchor.set(0, 0);
+goldScoreTxt.y = 0;
+goldScoreTxt.x = counterText ? counterText.width + 10 : 550; // Упрощено условие
+LK.gui.topLeft.addChild(goldScoreTxt);
+var redCrystalIngotScore = storage.redCrystalIngotScore || 0;
+var redCrystalIngotScoreTxt = new Text2('RedCrystalIngot: ' + redCrystalIngotScore, {
+ size: 50,
+ fill: 0xFFFFFF
+});
+redCrystalIngotScoreTxt.anchor.set(1, 0);
+redCrystalIngotScoreTxt.y = 100;
+LK.gui.topRight.addChild(redCrystalIngotScoreTxt);
var blueCrystallScore = storage.blueCrystallScore || 0;
+var automineblueCrystallClicked = storage.automineblueCrystallClicked;
+var autominegreenCrystallClicked = storage.autominegreenCrystallClicked; // Удален дубликат
+var automineredCrystallClicked = storage.automineredCrystallClicked;
+var autogrowthRateClicked = storage.autogrowthRateClicked;
+var scoreTxt = new Text2('Blue Crystall: ' + blueCrystallScore, {
+ size: 50,
+ fill: 0xFFFFFF
+});
+scoreTxt.anchor.set(0, 0);
+scoreTxt.y = 100;
+LK.gui.topLeft.addChild(scoreTxt);
var greenCrystallScore = storage.greenCrystallScore || 0;
-var redCrystallScore = storage.redCrystallScore || 0;
-var blueCrystalIngotScore = storage.blueCrystalIngotScore || 0;
+var greenScoreTxt = new Text2('Green Crystall: ' + greenCrystallScore, {
+ size: 50,
+ fill: 0xFFFFFF
+});
+greenScoreTxt.anchor.set(0, 0);
+greenScoreTxt.y = 150;
+LK.gui.topLeft.addChild(greenScoreTxt);
var greenCrystalIngotScore = storage.greenCrystalIngotScore || 0;
-var redCrystalIngotScore = storage.redCrystalIngotScore || 0;
-var goldScore = storage.goldScore || 0;
-var growthRateCounter = storage.growthRate || 0;
-var counterText = createText("Forging skill: ".concat(storage.forgingSkill), LK.gui.topLeft, 0, 0);
-var growthRateText = createText("Growth rate: ".concat(growthRateCounter), LK.gui.topLeft, 0, counterText.height - 6);
-var scoreTxt = createText("Blue Crystall: ".concat(blueCrystallScore), LK.gui.topLeft, 0, 100);
-var greenScoreTxt = createText("Green Crystall: ".concat(greenCrystallScore), LK.gui.topLeft, 0, 150);
-var redScoreTxt = createText("Red Crystall: ".concat(redCrystallScore), LK.gui.topLeft, 0, 200);
-var blueCrystalIngotScoreTxt = createText("BlueCrystalIngot: ".concat(blueCrystalIngotScore), LK.gui.topRight, 1, 0);
-var greenCrystalIngotScoreTxt = createText("GreenCrystalIngot: ".concat(greenCrystalIngotScore), LK.gui.topRight, 1, 50);
-var redCrystalIngotScoreTxt = createText("RedCrystalIngot: ".concat(redCrystalIngotScore), LK.gui.topRight, 1, 100);
-var goldScoreTxt = createText("Gold: ".concat(goldScore), LK.gui.topLeft, 0, counterText.width + 10);
-var hammer = createHammer();
-var map = createMap();
+var greenCrystalIngotScoreTxt = new Text2('GreenCrystalIngot: ' + greenCrystalIngotScore, {
+ size: 50,
+ fill: 0xFFFFFF
+});
+greenCrystalIngotScoreTxt.anchor.set(1, 0);
+greenCrystalIngotScoreTxt.y = 50;
+LK.gui.topRight.addChild(greenCrystalIngotScoreTxt);
+var blueCristal, greenCristal, redCristal; // Объявлены глобально
+var blueCrystalIngotScore = storage.blueCrystalIngotScore || 0;
+var blueSwordsText = new Text2(storage.blueSwords.toString(), {
+ size: 50,
+ fill: 0x000000
+});
+blueSwordsText.anchor.set(0.5, 0.5);
+blueSwordsText.x = 1248 / 2;
+blueSwordsText.y = 2732 / 2 + 450;
+LK.gui.topLeft.addChild(blueSwordsText);
+var redCrystallScore = storage.redCrystallScore || 0;
+var blueCrystalIngotScoreTxt = new Text2('BlueCrystalIngot: ' + blueCrystalIngotScore, {
+ size: 50,
+ fill: 0xFFFFFF
+});
+blueCrystalIngotScoreTxt.anchor.set(1, 0);
+blueCrystalIngotScoreTxt.y = 0;
+LK.gui.topRight.addChild(blueCrystalIngotScoreTxt);
+var redScoreTxt = new Text2('Red Crystall: ' + redCrystallScore, {
+ size: 50,
+ fill: 0xFFFFFF
+});
+redScoreTxt.anchor.set(0, 0);
+redScoreTxt.y = 200;
+LK.gui.topLeft.addChild(redScoreTxt);
+var map = game.addChild(LK.getAsset('Map', {
+ anchorX: 0.5,
+ anchorY: 0.5
+}));
+map.x = 400;
+map.y = 2450;
+map.visible = false;
+map.interactive = true;
+map.down = function () {
+ hammer.destroy();
+ LK.getSound('mapaudio').play();
+ map.visible = false;
+ if (mineInsideBackground) {
+ mineInsideBackground.destroy();
+ }
+ if (redCristal) {
+ redCristal.destroy();
+ }
+ if (blueCristal) {
+ blueCristal.destroy();
+ }
+ if (greenCristal) {
+ greenCristal.destroy();
+ }
+ var mapScreen = game.addChild(new Container());
+ var mapBackground = mapScreen.attachAsset('mapbackground', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ interactive: false
+ });
+ var cityMap = mapScreen.attachAsset('citymap', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ interactive: true
+ });
+ cityMap.x = -250;
+ cityMap.y = 160;
+ cityMap.down = function () {
+ hammer.destroy();
+ var isolatedScreen = game.addChild(new Container());
+ mapScreen.visible = false;
+ var cityBackground = isolatedScreen.attachAsset('citybackground', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ cityBackground.x = 0;
+ cityBackground.y = 0;
+ var mapAsset = isolatedScreen.attachAsset('Map', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ interactive: true
+ });
+ mapAsset.x = -650;
+ mapAsset.y = 1100;
+ mapAsset.down = function () {
+ isolatedScreen.visible = false;
+ mapScreen.visible = true;
+ cityBackground.visible = false;
+ mapBackground.visible = true;
+ };
+ var shop = isolatedScreen.attachAsset('shop', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ interactive: true
+ });
+ shop.x = 490;
+ shop.y = -20;
+ shop.down = function () {
+ hammer.destroy();
+ LK.getSound('shopin').play();
+ var shopScreen = game.addChild(new Container());
+ isolatedScreen.visible = false;
+ shopScreen.x = 2048 / 2;
+ shopScreen.y = 2732 / 2;
+ var newTools = shopScreen.attachAsset('newTools', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ interactive: true
+ });
+ newTools.x = -650;
+ newTools.y = 1100;
+ newTools.down = function () {
+ hammer.destroy();
+ var isolatedScreen = game.addChild(new Container());
+ var newToolsBackground = isolatedScreen.attachAsset('newToolsBackground', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ newToolsBackground.x = 0;
+ newToolsBackground.y = 0;
+ if (!storage.theBlacksmithsApprentice) {
+ var theBlacksmithsApprentice = isolatedScreen.attachAsset('Theblacksmithsapprentice', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ interactive: true
+ });
+ theBlacksmithsApprentice.x = 400;
+ theBlacksmithsApprentice.y = 200;
+ theBlacksmithsApprentice.clicked = storage.theBlacksmithsApprentice;
+ theBlacksmithsApprentice.down = function () {
+ if (goldScore >= 1500 && !theBlacksmithsApprentice.clicked) {
+ goldScore -= 1500;
+ goldScoreTxt.setText('Gold: ' + goldScore);
+ storage.goldScore = goldScore;
+ theBlacksmithsApprentice.clicked = true;
+ var intervalId = LK.setInterval(function () {
+ storage.forgingSkill += 1;
+ counterText.setText('Forging skill: ' + storage.forgingSkill);
+ }, 1000);
+ theBlacksmithsApprentice.intervalId = intervalId;
+ storage.theBlacksmithsApprentice = true;
+ theBlacksmithsApprentice.visible = false;
+ apprenticeText.visible = false;
+ apprenticeCostText.visible = false;
+ }
+ };
+ var apprenticeText = new Text2("The blacksmith's \napprentice +1", {
+ size: 50,
+ fill: 0x030303
+ });
+ apprenticeText.anchor.set(0.5, 0.5);
+ apprenticeText.x = theBlacksmithsApprentice.x;
+ apprenticeText.y = theBlacksmithsApprentice.y + 170;
+ isolatedScreen.addChild(apprenticeText);
+ var apprenticeCostText = new Text2('1500G', {
+ size: 50,
+ fill: 0x030303
+ });
+ apprenticeCostText.anchor.set(0.5, 0.5);
+ apprenticeCostText.x = apprenticeText.x;
+ apprenticeCostText.y = apprenticeText.y + 70;
+ isolatedScreen.addChild(apprenticeCostText);
+ }
+ var newToolsOut = isolatedScreen.attachAsset('newToolsout', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ interactive: true
+ });
+ newToolsOut.x = 0;
+ newToolsOut.y = 1100;
+ if (!storage.automineblueCrystallClicked) {
+ var automineblueCrystall = isolatedScreen.attachAsset('automineblueCrystall', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ interactive: true
+ });
+ automineblueCrystall.x = -400;
+ automineblueCrystall.y = -600;
+ automineblueCrystall.clicked = storage.automineblueCrystallClicked;
+ automineblueCrystall.down = function () {
+ if (goldScore >= 500 && !automineblueCrystall.clicked) {
+ automineblueCrystall.clicked = true;
+ goldScore -= 500;
+ goldScoreTxt.setText('Gold: ' + goldScore);
+ storage.goldScore = goldScore;
+ var intervalId = LK.setInterval(function () {
+ blueCrystallScore += 1;
+ LK.setScore(blueCrystallScore);
+ storage.blueCrystallScore = blueCrystallScore;
+ scoreTxt.setText('Blue Crystall: ' + LK.getScore());
+ }, 1000);
+ automineblueCrystall.intervalId = intervalId;
+ storage.automineblueCrystallClicked = true;
+ automineblueCrystall.visible = false;
+ mineBlueCrystallText.visible = false;
+ mineBlueCrystallCostText.visible = false;
+ }
+ };
+ var mineBlueCrystallText = new Text2('Mine Blue Crystall +1', {
+ size: 50,
+ fill: 0x030303
+ });
+ mineBlueCrystallText.anchor.set(0.5, 0.5);
+ mineBlueCrystallText.x = automineblueCrystall.x;
+ mineBlueCrystallText.y = automineblueCrystall.y + 150;
+ isolatedScreen.addChild(mineBlueCrystallText);
+ var mineBlueCrystallCostText = new Text2('500G', {
+ size: 50,
+ fill: 0x030303
+ });
+ mineBlueCrystallCostText.anchor.set(0.5, 0.5);
+ mineBlueCrystallCostText.x = mineBlueCrystallText.x;
+ mineBlueCrystallCostText.y = mineBlueCrystallText.y + 50;
+ isolatedScreen.addChild(mineBlueCrystallCostText);
+ }
+ // Аналогично для других покупок в магазине (autominegreenCrystall, automineredCrystall, multiclickupgrade, autogrowthRate)
+ newToolsOut.down = function () {
+ LK.getSound('booksaudio').play();
+ isolatedScreen.visible = false;
+ shopScreen.visible = true;
+ };
+ shopScreen.visible = false;
+ isolatedScreen.x = 2048 / 2;
+ isolatedScreen.y = 2732 / 2;
+ hammer = game.addChild(LK.getAsset('hammer', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ scaleX: -1
+ }));
+ };
+ var shopBackground = shopScreen.attachAsset('shopbackground', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ shopBackground.x = 0;
+ shopBackground.y = 0;
+ var newBuildings = shopScreen.attachAsset('sellweapons', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ interactive: true
+ });
+ newBuildings.down = function () {
+ goldScore += storage.blueSwords * 100 + storage.greenAxes * 300 + storage.redCrystalTwoHandedSwords * 100;
+ storage.blueSwords = 0;
+ storage.greenAxes = 0;
+ storage.redCrystalTwoHandedSwords = 0;
+ blueSwordsText.setText('0');
+ goldScoreTxt.setText('Gold: ' + goldScore);
+ storage.goldScore = goldScore;
+ };
+ newBuildings.x = 0;
+ newBuildings.y = 1100;
+ var shopOut = shopScreen.attachAsset('shopout', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ interactive: true
+ });
+ shopOut.x = 650;
+ shopOut.y = 1100;
+ shopOut.down = function () {
+ LK.getSound('doors').play();
+ shopScreen.visible = false;
+ mapScreen.visible = true;
+ isolatedScreen.visible = true;
+ };
+ hammer = game.addChild(LK.getAsset('hammer', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ scaleX: -1
+ }));
+ };
+ isolatedScreen.x = 2048 / 2;
+ isolatedScreen.y = 2732 / 2;
+ hammer = game.addChild(LK.getAsset('hammer', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ scaleX: -1
+ }));
+ };
+ var anvilMap = mapScreen.attachAsset('anvilmap', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ interactive: true
+ });
+ var mine = mapScreen.attachAsset('mine', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ interactive: true
+ });
+ mine.x -= 150;
+ mine.y -= 150;
+ mine.down = function () {
+ hammer.destroy();
+ var mineScreen = game.addChild(new Container());
+ map.visible = true;
+ mapScreen.visible = false;
+ background.visible = false;
+ mineInsideBackground = mineScreen.attachAsset('mineinsidebackground', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ interactive: false,
+ zIndex: -1
+ });
+ redCristal = mineScreen.addChild(new RedCristal());
+ redCristal.x -= 510;
+ redCristal.y += 490;
+ greenCristal = mineScreen.addChild(new GreenCristal());
+ greenCristal.x += 510;
+ greenCristal.y += 10;
+ blueCristal = mineScreen.addChild(new BlueCristal());
+ blueCristal.x += 80;
+ blueCristal.y -= 370;
+ mineScreen.x = 2048 / 2;
+ mineScreen.y = 2732 / 2;
+ hammer = game.addChild(LK.getAsset('hammer', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ scaleX: -1
+ }));
+ };
+ anvilMap.down = function () {
+ gameScreen.visible = true;
+ map.visible = true;
+ gameScreenBackground = gameScreen.attachAsset('gameScreenBackground', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ var recipes = gameScreenBackground.attachAsset('recipes', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ recipes.x = gameScreenBackground.width / 2 - 1050;
+ recipes.y = gameScreenBackground.height / 2 + 150;
+ if (mineInsideBackground) {
+ mineInsideBackground.destroy();
+ }
+ if (blueCristal) {
+ blueCristal.destroy();
+ }
+ if (greenCristal) {
+ greenCristal.destroy();
+ }
+ if (redCristal) {
+ redCristal.destroy();
+ }
+ mapScreen.visible = false;
+ counterText.visible = true;
+ growthRateText.visible = true;
+ };
+ gameScreen.visible = false;
+ background.visible = false;
+ mapScreen.x = 2048 / 2;
+ mapScreen.y = 2732 / 2;
+ hammer = game.addChild(LK.getAsset('hammer', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ scaleX: -1
+ }));
+};
+var growthRateCounter = storage.growthRate;
+var background = game.addChild(new Container());
+background.width = 2048;
+background.height = 2732;
+background.x = 2048 / 2;
+background.y = 2732 / 2;
+var backgroundGraphics = background.attachAsset('background', {
+ anchorX: 0.5,
+ anchorY: 0.5
+});
+var gameScreen = game.addChild(new Container());
+var newGame = game.addChild(new Container());
+newGame.x = 2650 / 2 + 100;
+newGame.y = 2680 * 4.2 / 5;
+var title = game.addChild(LK.getAsset('title', {
+ anchorX: 0.5,
+ anchorY: 0.5
+}));
+title.x = 2048 / 2;
+title.y = 3200 / 5;
+var newGameText = newGame.attachAsset('newGameText', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ stroke: 0xFFFFFF,
+ strokeThickness: 5
+});
+var continueText = game.addChild(LK.getAsset('continueText', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ interactive: true
+}));
+continueText.x = newGame.x - newGame.width - 500;
+continueText.y = newGame.y;
+continueText.down = startgame;
+var blueswordsclick = storage.blueswordsclick;
+var greenAxeClicks = storage.greenAxeClicks;
+var redCrystalTwoHandedSwordClicks = storage.redCrystalTwoHandedSwordClicks;
function startgame() {
title.destroy();
hammer.destroy();
gameScreen = game.addChild(new Container());
gameScreen.x = 2048 / 2;
gameScreen.y = 2732 / 2;
- var gameScreenBackground = gameScreen.attachAsset('gameScreenBackground', {
+ gameScreenBackground = gameScreen.attachAsset('gameScreenBackground', {
anchorX: 0.5,
anchorY: 0.5
});
- var recipes = gameScreen.attachAsset('recipes', {
+ var recipes = gameScreenBackground.attachAsset('recipes', {
anchorX: 0.5,
anchorY: 0.5,
interactive: true
});
- recipes.x = gameScreenBackground.width / 2 - 1050;
- recipes.y = gameScreenBackground.height / 2 + 150;
recipes.down = function () {
- return openRecipesScreen();
+ hammer.destroy();
+ LK.getSound('booksaudio').play();
+ var recipesScreen = game.addChild(new RecipesScreen());
+ map.visible = false;
+ var recipesBackground = recipesScreen.attachAsset('recipesbackground', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ recipesBackground.x = 2048 / 2;
+ recipesBackground.y = 2932 / 2;
+ var bluecrystalswordrecipe = recipesScreen.attachAsset('bluecrystalswordrecipe', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ bluecrystalswordrecipe.x = 1248 / 2;
+ bluecrystalswordrecipe.y = 2132 / 2;
+ bluecrystalswordrecipe.down = function () {
+ if (storage.forgingSkill >= 2000 && storage.blueCrystalIngotScore >= 10) {
+ blueswordsclick += 1;
+ if (blueswordsclick >= 100) {
+ blueswordsclick = 0;
+ storage.blueSwords += 1;
+ blueSwordsText.setText(storage.blueSwords.toString());
+ storage.forgingSkill += 100;
+ counterText.setText('Forging skill: ' + storage.forgingSkill);
+ if (storage.blueCrystalIngotScore >= 10) {
+ storage.blueCrystalIngotScore -= 10;
+ blueCrystalIngotScore = storage.blueCrystalIngotScore;
+ blueCrystalIngotScoreTxt.setText('BlueCrystalIngot: ' + blueCrystalIngotScore);
+ }
+ }
+ blueCrystalSwordClicks.setText('(current ' + blueswordsclick + ')');
+ storage.blueswordsclick = blueswordsclick;
+ }
+ };
+ // Добавление остальных элементов экрана рецептов аналогично
+ var recipesOutGraphics = recipesScreen.attachAsset('recipesout', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ interactive: true
+ });
+ recipesOutGraphics.x = 2048 / 2;
+ recipesOutGraphics.y = 2732 / 2 + 1100;
+ recipesOutGraphics.down = function () {
+ LK.getSound('paper').play();
+ gameScreen.visible = true;
+ map.visible = true;
+ recipesScreen.visible = false;
+ };
+ gameScreen.visible = false;
};
+ recipes.x = gameScreenBackground.width / 2 - 1050;
+ recipes.y = gameScreenBackground.height / 2 + 150;
map.visible = true;
newGame.visible = false;
continueText.visible = false;
- var background = game.addChild(LK.getAsset('background', {
- anchorX: 0.5,
- anchorY: 0.5
- }));
background.visible = false;
var anvil = gameScreen.addChild(new Anvil());
+ anvil.clickCounter = storage.forgingSkill;
+ counterText.setText('Forging skill: ' + anvil.clickCounter);
anvil.x = gameScreenBackground.x - -20;
anvil.y = gameScreenBackground.y + 500;
var magicNursery = gameScreen.addChild(new Door());
magicNursery.x = 2048 / 4;
magicNursery.y = 2732 / 2.5;
- hammer = createHammer();
-}
-var newGame = setupNewGame();
-var continueText = setupContinueText();
-var title = game.addChild(LK.getAsset('title', {
- anchorX: 0.5,
- anchorY: 0.5,
- x: 2048 / 2,
- y: 3200 / 5
-}));
-/****
-* Helper Functions
-****/
-function createText(text, parent, anchorX, y) {
- var txt = new Text2(text, {
- size: 50,
- fill: 0xFFFFFF
- });
- txt.anchor.set(anchorX, 0);
- txt.y = y;
- parent.addChild(txt);
- return txt;
-}
-function createHammer() {
- return game.addChild(LK.getAsset('hammer', {
+ hammer = game.addChild(LK.getAsset('hammer', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: -1
}));
}
-function updateScore(key, value, textObj, label) {
- storage[key] = value;
- LK.setScore(value);
- textObj.setText("".concat(label, ": ").concat(value));
- textObj.visible = true;
-}
-function updateCounterColor(clicks) {
- if (clicks >= 30000) {
- counterText.tint = 0xcc7c04;
- } else if (clicks >= 15000) {
- counterText.tint = 0x800080;
- } else if (clicks >= 2000) {
- counterText.tint = 0x0000FF;
- } else if (clicks >= 1000) {
- counterText.tint = 0x00FF00;
+newGame.interactive = true;
+newGame.down = function () {
+ newgameclearInterval.forEach(function (id) {
+ return LK.clearInterval(id);
+ });
+ storage.automineblueCrystallClicked = false;
+ storage.autominegreenCrystallClicked = false;
+ storage.automineredCrystallClicked = false;
+ storage.autogrowthRateClicked = false;
+ storage.theBlacksmithsApprentice = false;
+ storage.multiclickupgrade = false;
+ storage.forgingSkill = 0;
+ storage.growthRate = 0;
+ storage.blueCrystalIngotScore = 0;
+ storage.blueCrystallScore = 0;
+ storage.greenCrystalIngotScore = 0;
+ storage.redCrystallScore = 0;
+ storage.redCrystalIngotScore = 0;
+ storage.greenCrystallScore = 0;
+ storage.blueSwords = 0;
+ storage.goldScore = 0;
+ redCrystalIngotScore = 0;
+ blueCrystallScore = 0;
+ greenCrystallScore = 0;
+ greenCrystalIngotScore = 0;
+ blueCrystalIngotScore = 0;
+ redCrystallScore = 0;
+ growthRateCounter = 0;
+ goldScore = 0;
+ growthRateText.setText('Growth rate: ' + storage.growthRate);
+ counterText.setText('Forging skill: ' + storage.forgingSkill);
+ scoreTxt.setText('Blue Crystall: ' + blueCrystallScore);
+ greenScoreTxt.setText('Green Crystall: ' + greenCrystallScore);
+ redScoreTxt.setText('Red Crystall: ' + redCrystallScore);
+ blueCrystalIngotScoreTxt.setText('BlueCrystalIngot: ' + storage.blueCrystalIngotScore);
+ greenCrystalIngotScoreTxt.setText('GreenCrystalIngot: ' + storage.greenCrystalIngotScore);
+ redCrystalIngotScoreTxt.setText('RedCrystalIngot: ' + storage.redCrystalIngotScore);
+ goldScoreTxt.setText('Gold: ' + goldScore);
+ startgame();
+};
+var counterText = new Text2('Forging skill: ' + storage.forgingSkill, {
+ size: 50,
+ fill: 0xFFFFFF
+});
+counterText.anchor.set(0, 0);
+LK.gui.topLeft.addChild(counterText);
+counterText.y = 0;
+counterText.x = 0;
+var growthRateText = new Text2('Growth rate: ' + growthRateCounter, {
+ size: 50,
+ fill: 0xFFFFFF
+});
+growthRateText.anchor.set(0, 0);
+LK.gui.topLeft.addChild(growthRateText);
+growthRateText.y = counterText.height - 6;
+growthRateText.x = 0;
+var hammer = game.addChild(LK.getAsset('hammer', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ scaleX: -1
+}));
+function updateHammerPosition(x, y) {
+ if (hammer) {
+ hammer.x = x;
+ hammer.y = y;
}
}
-function createMap() {
- var map = game.addChild(LK.getAsset('Map', {
- anchorX: 0.5,
- anchorY: 0.5,
- x: 400,
- y: 2450
- }));
- map.visible = false;
- map.interactive = true;
- map.down = function () {
- return openMapScreen();
- };
- return map;
+var newgameclearInterval = [];
+if (automineblueCrystallClicked) {
+ var intervalId = LK.setInterval(function () {
+ blueCrystallScore += 1;
+ LK.setScore(blueCrystallScore);
+ storage.blueCrystallScore = blueCrystallScore;
+ scoreTxt.setText('Blue Crystall: ' + LK.getScore());
+ }, 1000);
+ newgameclearInterval.push(intervalId);
}
-function setupNewGame() {
- var ng = game.addChild(new Container());
- ng.x = 2650 / 2 + 100;
- ng.y = 2680 * 4.2 / 5;
- ng.attachAsset('newGameText', {
- anchorX: 0.5,
- anchorY: 0.5,
- stroke: 0xFFFFFF,
- strokeThickness: 5
- });
- ng.interactive = true;
- ng.down = function () {
- return resetGameAndStart();
- };
- return ng;
+// Аналогично для других интервалов
+var seconds = Math.floor(Date.now() / 1000) - storage.lastgametime;
+if (seconds * 60 * 5 > Math.floor(Date.now() / 1000)) {
+ seconds = 5 * 60 * 60;
}
-function setupContinueText() {
- var ct = game.addChild(LK.getAsset('continueText', {
- anchorX: 0.5,
- anchorY: 0.5
- }));
- ct.x = newGame.x - newGame.width - 500;
- ct.y = newGame.y;
- ct.interactive = true;
- ct.down = startgame;
- return ct;
+if (seconds > 0) {
+ if (storage.automineblueCrystallClicked) {
+ blueCrystallScore = storage.blueCrystallScore += seconds;
+ }
+ if (storage.autominegreenCrystallClicked) {
+ greenCrystallScore = storage.greenCrystallScore += seconds;
+ }
+ if (storage.automineredCrystallClicked) {
+ redCrystallScore = storage.redCrystallScore += seconds;
+ }
+ if (storage.autogrowthRateClicked) {
+ growthRateCounter = storage.growthRate += seconds;
+ }
+ if (storage.theBlacksmithsApprentice) {
+ storage.forgingSkill += seconds;
+ }
}
-// Остальные функции (openRecipesScreen, openMapScreen, resetGameAndStart и т.д.) опущены для краткости, но оптимизированы аналогично
+LK.setInterval(function () {
+ storage.lastgametime = Math.floor(Date.now() / 1000);
+}, 1000);
game.move = function (x, y) {
- return hammer && (hammer.x = x, hammer.y = y);
+ updateHammerPosition(x, y);
};
-game.down = function () {
- return animateHammer();
-};
-function animateHammer() {
- // Placeholder for the animation logic of the hammer
- console.log("Animating hammer...");
-}
\ No newline at end of file
+game.down = function (x, y) {
+ LK.getSound('hammer').play();
+ tween(hammer, {
+ rotation: -Math.PI / 2
+ }, {
+ duration: 125,
+ easing: tween.easeInOut,
+ onFinish: function onFinish() {
+ for (var i = 0; i < 5; i++) {
+ var star = game.addChild(LK.getAsset('star', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ }));
+ star.x = hammer.x - hammer.width / 2 + Math.random() * 100 - 25;
+ star.y = hammer.y + hammer.height / 2 + Math.random() * 100 - 25;
+ star.update = function () {
+ star.y -= 5;
+ star.x += star.x < hammer.x ? 2 : -2;
+ };
+ LK.setTimeout(function () {
+ star.destroy();
+ }, 250);
+ }
+ tween(hammer, {
+ rotation: 0
+ }, {
+ duration: 125,
+ easing: tween.easeInOut
+ });
+ }
+ });
+};
\ No newline at end of file