Code edit (8 edits merged)
Please save this source code
User prompt
если blueCrystalIngot +1 то в growth rate +10
Code edit (1 edits merged)
Please save this source code
User prompt
скрывай текст после клика по newGameText
Code edit (2 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught ReferenceError: blueswordsclick is not defined' in or related to this line: 'var blueCrystalSwordClicks = new Text2('(current ' + blueswordsclick + ')', {' Line Number: 1348
User prompt
Please fix the bug: 'Uncaught ReferenceError: greenAxeClicks is not defined' in or related to this line: 'var greenAxeClicksText = new Text2('(current ' + greenAxeClicks + ')', {' Line Number: 1328
Code edit (2 edits merged)
Please save this source code
User prompt
смести текст в право
Code edit (2 edits merged)
Please save this source code
User prompt
Добавь текст под ассет continueText желтого цвета "This is your forge, hit the anvil and develop skills, mine crystals, melt them into ingots and craft weapons. Sell it in the city." при клике по continueText и newGameText скрывай его
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading 'y')' in or related to this line: 'gameDescriptionText.y = continueText.y + 100; // Position below the continue button' Line Number: 455
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading 'x')' in or related to this line: 'gameDescriptionText.x = continueText.x;' Line Number: 449
User prompt
добавь текст под кнопку continue "This is your forge, hit the anvil and develop skills, mine crystals, melt them into ingots and craft weapons. Sell it in the city." желтого цвета
Code edit (1 edits merged)
Please save this source code
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
/**** * 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 }); /**** * Classes ****/ var Anvil = Container.expand(function () { var self = Container.call(this); self.attachAsset('anvil', { anchorX: 0.5, anchorY: 0.5, alpha: 0.0 }); self.clickCounter = storage.forgingSkill; self.interactive = true; self.down = function () { self.clickCounter++; var chance = storage.multiclickupgrade ? 0.04 : 0.02; if (Math.random() < chance) { 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() { return newAsset.destroy(); } }); } counterText.setText("Forging skill: ".concat(self.clickCounter)); storage.forgingSkill = self.clickCounter; updateCounterColor(self.clickCounter); }; }); 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; updateScore('blueCrystallScore', blueCrystallScore, scoreTxt, 'Blue Crystall'); }; }); 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; 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)); } }; }); 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 }); 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 growthRate = game.magicNursery.addChild(LK.getAsset('growthRate', { anchorX: 0.5, anchorY: 0.5 })); growthRate.x = 700; growthRate.y = 1450; 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(); }; }); 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 = createHammer(); }; }); 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) { redCrystalIngotScore += 1; storage.growthRate += 1000; redCrystallScore -= 10; if (redCrystallScore < 0) { redCrystallScore = 0; } updateScore('redCrystallScore', redCrystallScore, redScoreTxt, 'Red Crystall'); updateScore('redCrystalIngotScore', redCrystalIngotScore, redCrystalIngotScoreTxt, 'RedCrystalIngot'); growthRateText.setText("Growth rate: ".concat(storage.growthRate)); } }; }); /**** * 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) {}); var blueCrystallScore = storage.blueCrystallScore || 0; var greenCrystallScore = storage.greenCrystallScore || 0; var redCrystallScore = storage.redCrystallScore || 0; var blueCrystalIngotScore = storage.blueCrystalIngotScore || 0; 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(); function startgame() { title.destroy(); hammer.destroy(); gameScreen = game.addChild(new Container()); gameScreen.x = 2048 / 2; gameScreen.y = 2732 / 2; var gameScreenBackground = gameScreen.attachAsset('gameScreenBackground', { anchorX: 0.5, anchorY: 0.5 }); var recipes = gameScreen.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(); }; 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.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', { 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; } } 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; } 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; } 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; } // Остальные функции (openRecipesScreen, openMapScreen, resetGameAndStart и т.д.) опущены для краткости, но оптимизированы аналогично game.move = function (x, y) { return hammer && (hammer.x = x, hammer.y = y); }; game.down = function () { return animateHammer(); }; function animateHammer() { // Placeholder for the animation logic of the hammer console.log("Animating hammer..."); }
===================================================================
--- original.js
+++ change.js
@@ -169,8 +169,29 @@
growthRateText.visible = true;
hammer = createHammer();
};
});
+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) {
+ redCrystalIngotScore += 1;
+ storage.growthRate += 1000;
+ redCrystallScore -= 10;
+ if (redCrystallScore < 0) {
+ redCrystallScore = 0;
+ }
+ updateScore('redCrystallScore', redCrystallScore, redScoreTxt, 'Red Crystall');
+ updateScore('redCrystalIngotScore', redCrystalIngotScore, redCrystalIngotScoreTxt, 'RedCrystalIngot');
+ growthRateText.setText("Growth rate: ".concat(storage.growthRate));
+ }
+ };
+});
/****
* Initialize Game
****/