User prompt
Make the protect asset bigger
User prompt
Make the protect asset transparent
User prompt
Make the forcefield transeparent
User prompt
Make it so when you click the forcefield asset, the protect asset appears on the button asset
User prompt
Add a text to the forcefield asset and make it say field 100$
User prompt
Put the forcefield asset under the clover upgrade
User prompt
Add the forcefield asset to the game screen and make it the same size as the worker upgrade asset
User prompt
It did not work
User prompt
Make it so all the button skins are like the circleglow asset so they dont stop working after you equip something else
User prompt
Make it so every 10 seconds the frenzy asset appears under the button asset.
User prompt
Now make the bullet asset appear once every 40 seconds
User prompt
It did not sork
User prompt
Make the frenzy appear once every 10 seconds
User prompt
Now make the frenzy asset appear twice every 5 minutes, but it is random. And make it appear under the button asset
User prompt
Now make the bullets appear once every 1 minute
User prompt
Make it so you can click the bullet assets, and when you click them they dissapear.
User prompt
Make it so when the bullet touches the button asset, the bullet asset dissapears and your points are minused by their quarter
User prompt
Make it so when the bullet touches the button asset, the bullet asset dissapears and your points are quartered
User prompt
Make the top of the bullet asset point towars the button asset when it shows yp
User prompt
Make the bullet face the butten when it shows up
User prompt
Make the bullet show up once every ten seconds
User prompt
Make it so when the bullet asset shoes up, it moves to the button asset
User prompt
Please save this source code
User prompt
And in a random place too
User prompt
Make it so the appears appears randomly in the screen every time
/**** * Plugins ****/ var storage = LK.import("@upit/storage.v1", { points: 0, clovers: 0, upgrades: { workerValue: 0 }, unlockedSkins: [] }); var tween = LK.import("@upit/tween.v1"); /**** * Initialize Game ****/ //<Write entity 'classes' with empty functions for important behavior here> var game = new LK.Game({ backgroundColor: 0xFFFFFF //Init game with white background }); /**** * Game Code ****/ // Add the forcefield asset to the game screen //<Write entity 'classes' with empty functions for important behavior here> var forcefield = LK.getAsset('Forcefield', { width: 600, // Same width as worker upgrade asset height: 300, // Same height as worker upgrade asset x: 1448, // Align with the clover upgrade button horizontally y: 620 + 310 // Position under the clover upgrade button }); forcefield.alpha = 0.5; game.addChild(forcefield); // Add click event to forcefield to display protect asset on button forcefield.down = function (x, y, obj) { var protectAsset = LK.getAsset('Protect', { width: newButton.width * 1.5, height: newButton.height * 1.5, x: newButton.x, y: newButton.y }); protectAsset.alpha = 0.5; game.addChild(protectAsset); }; // Add text to the forcefield asset var forcefieldText = new Text2('field 100$', { size: 100, fill: 0x000000 }); forcefieldText.x = forcefield.x + forcefield.width / 2 - forcefieldText.width / 2; forcefieldText.y = forcefield.y + forcefield.height / 2 - forcefieldText.height / 2; game.addChild(forcefieldText); // Add a new upgrade button using the patrick asset for +1 clover at the cost of 25 clovers function spawnBullet() { var bullet = LK.getAsset('Bullet', { width: 100, height: 100, x: Math.random() * (2048 - 100), // Random x position within game width y: Math.random() * (2732 - 100) // Random y position within game height }); game.addChild(bullet); // Calculate the direction vector from the bullet to the button var directionX = newButton.x - bullet.x; var directionY = newButton.y - bullet.y; var magnitude = Math.sqrt(directionX * directionX + directionY * directionY); // Normalize the direction vector directionX /= magnitude; directionY /= magnitude; // Calculate the angle in radians and set the bullet's rotation bullet.rotation = Math.atan2(directionY, directionX); // Set the speed of the bullet var speed = 2; // Update function to move the bullet towards the button bullet.down = function (x, y, obj) { bullet.destroy(); }; bullet.update = function () { bullet.x += directionX * speed; bullet.y += directionY * speed; // Check for intersection with the button if (!bullet.lastIntersecting && bullet.intersects(newButton)) { // Deduct a quarter of the points points -= Math.floor(points / 4); pointsText.setText('Points: ' + points); storage.points = points; // Destroy the bullet bullet.destroy(); } // Update last known intersection state bullet.lastIntersecting = bullet.intersects(newButton); }; } // Set an interval to call spawnBullet every 40000 milliseconds (40 seconds) LK.setInterval(spawnBullet, 40000); var patrickUpgradeButton = LK.getAsset('patrickshop', { width: 600, height: 300, x: 1448, y: 620 // Position below the clicker upgrade button }); game.addChild(patrickUpgradeButton); var patrickUpgradeText = new Text2('+1 clover 25 ', { size: 100, fill: 0x000000 }); patrickUpgradeText.x = patrickUpgradeButton.x + patrickUpgradeButton.width / 2 - patrickUpgradeText.width / 2; patrickUpgradeText.y = patrickUpgradeButton.y + patrickUpgradeButton.height / 2 - patrickUpgradeText.height / 2; game.addChild(patrickUpgradeText); // Add clover asset next to the '25' in the patrick upgrade text var patrickCloverAsset = LK.getAsset('Clovers', { width: 50, height: 50, x: patrickUpgradeText.x + patrickUpgradeText.width, y: patrickUpgradeText.y }); game.addChild(patrickCloverAsset); patrickUpgradeButton.down = function (x, y, obj) { // Logic for patrick upgrade if (clovers >= 25) { clovers -= 25; cloversText.setText('Clovers: ' + clovers); storage.clovers = clovers; console.log("+1 clover upgrade purchased. Double clover gain every 3 clicks activated."); // Set a flag to indicate the clover upgrade is active cloverUpgradeActive = true; // Remove the clover upgrade button and its associated text and asset game.removeChild(patrickUpgradeButton); game.removeChild(patrickUpgradeText); game.removeChild(patrickCloverAsset); } else { console.log("Not enough clovers for +1 clover upgrade."); } }; var retroglowvalue = 0; // Initialize retroglowvalue globally to track Retroglow status var cauldronValue = 0; // Initialize cauldronValue globally to track Cauldron status //<Write imports for supported plugins here> //<Assets used in the game will automatically appear here> function openShopMenu() { // Logic to display the shop menu console.log("Shop menu is now open."); // Create a large shop menu var shopMenu = LK.getAsset('Shop', { width: 1600, // Increase width height: 1600, // Increase height to make it taller x: 2048 / 2 - 800, // Center horizontally y: 2732 / 2 - 800 // Center vertically }); game.addChild(shopMenu); // Add greenglow asset purchase option var greenglowButton = LK.getAsset('Greenglowy', { width: 400, height: 400, x: shopMenu.x + 100, y: shopMenu.y + 100 }); game.addChild(greenglowButton); var greenglowButtonText = new Text2(greenglowyvalue === 2 ? 'Equipped' : greenglowyvalue === 1 ? 'Owned' : '20$ Greenglow', { size: 70, fill: 0x000000 }); greenglowButtonText.x = greenglowButton.x + greenglowButton.width / 2 - greenglowButtonText.width / 2; greenglowButtonText.y = greenglowButton.y + greenglowButton.height / 2 - greenglowButtonText.height / 2 + 250; game.addChild(greenglowButtonText); // Add retroglow asset purchase option var retroglowButton = LK.getAsset('Retroglow', { width: 400, height: 400, x: shopMenu.x + 100, y: shopMenu.y + 600 // Position under greenglowButton }); game.addChild(retroglowButton); var retroglowButtonText = new Text2(retroglowvalue === 2 ? 'Equipped' : retroglowvalue === 1 ? 'Owned' : '150$ Retroglow', { size: 70, fill: 0x000000 }); retroglowButtonText.x = retroglowButton.x + retroglowButton.width / 2 - retroglowButtonText.width / 2; retroglowButtonText.y = retroglowButton.y + retroglowButton.height / 2 - retroglowButtonText.height / 2 + 250; game.addChild(retroglowButtonText); retroglowButton.down = function (x, y, obj) { if (retroglowvalue === 1) { console.log("Retroglow already owned."); retroglowvalue = 2; // Set value to 2 if clicked again after purchase retroglowButtonText.setText('Equipped'); // Update text to 'Equipped' if (typeof retroglowOverlay !== 'undefined') { game.removeChild(retroglowOverlay); retroglowOverlay = undefined; } } else if (retroglowvalue === 2) { retroglowvalue = 1; // Toggle value back to 1 retroglowButtonText.setText('Owned'); // Update text to 'Owned' if (typeof retroglowOverlay !== 'undefined') { game.removeChild(retroglowOverlay); retroglowOverlay = undefined; } } else if (points >= 150 && retroglowvalue === 0) { points -= 150; pointsText.setText('Points: ' + points); storage.points = points; storage.unlockedSkins.push('Retroglow'); retroglowvalue = 1; retroglowButtonText.setText('Owned'); currentButtonSkin = 'Retroglow'; if (whoequipped === 'Circleglow' && typeof circleglowOverlay !== 'undefined') { game.removeChild(circleglowOverlay); } if (typeof retroglowOverlay !== 'undefined') { game.removeChild(retroglowOverlay); } whoequipped = 'Retroglow'; } if (whoequipped === 'Retroglow' && retroglowvalue === 2) { if (typeof circleglowOverlay !== 'undefined') { game.removeChild(circleglowOverlay); } if (typeof retroglowOverlay !== 'undefined') { game.removeChild(retroglowOverlay); } retroglowOverlay = LK.getAsset('Retroglow', { width: newButton.width, height: newButton.height, x: newButton.x, y: newButton.y }); game.addChild(retroglowOverlay); whoequipped = 'Retroglow'; } else { console.log("Not enough points to purchase Retroglow."); } }; // Add circle asset purchase option var circleButton = LK.getAsset('Circleglow', { width: 400, height: 400, x: shopMenu.x + 600, // Position next to greenglowButton y: shopMenu.y + 100 }); game.addChild(circleButton); var circleButtonText = new Text2(circlevalue === 2 ? 'Equipped' : circlevalue === 1 ? 'Owned' : '40$ Circle', { size: 70, fill: 0x000000 }); circleButtonText.x = circleButton.x + circleButton.width / 2 - circleButtonText.width / 2; circleButtonText.y = circleButton.y + circleButton.height / 2 - circleButtonText.height / 2 + 250; game.addChild(circleButtonText); // Add shadowglow asset purchase option var shadowButton = LK.getAsset('Shadow', { width: 400, height: 400, x: shopMenu.x + 1100, // Position next to circleButton y: shopMenu.y + 100 }); game.addChild(shadowButton); var shadowButtonText = new Text2(shadowglowvalue === 2 ? 'Equipped' : shadowglowvalue === 1 ? 'Owned' : '100$ Shadow', { size: 70, fill: 0x000000 }); shadowButtonText.x = shadowButton.x + shadowButton.width / 2 - shadowButtonText.width / 2; shadowButtonText.y = shadowButton.y + shadowButton.height / 2 - shadowButtonText.height / 2 + 250; game.addChild(shadowButtonText); greenglowButton.down = function (x, y, obj) { if (greenglowyvalue === 1) { console.log("Greenglowy already owned."); greenglowyvalue = 2; // Set value to 2 if clicked again after purchase greenglowButtonText.setText('Equipped'); // Update text to 'Equipped' if (typeof greenglowOverlay !== 'undefined') { game.removeChild(greenglowOverlay); greenglowOverlay = undefined; } } else if (greenglowyvalue === 2) { greenglowyvalue = 1; // Toggle value back to 1 greenglowButtonText.setText('Owned'); // Update text to 'Owned' if (typeof greenglowOverlay !== 'undefined') { game.removeChild(greenglowOverlay); greenglowOverlay = undefined; } } else if (points >= 20 && greenglowyvalue === 0) { points -= 20; pointsText.setText('Points: ' + points); storage.points = points; storage.unlockedSkins.push('Greenglowy'); greenglowyvalue = 1; greenglowButtonText.setText('Owned'); currentButtonSkin = 'Greenglowy'; if (whoequipped === 'Circleglow' && typeof circleglowOverlay !== 'undefined') { game.removeChild(circleglowOverlay); } if (typeof greenglowOverlay !== 'undefined') { game.removeChild(greenglowOverlay); } whoequipped = 'Greenglowy'; } if (whoequipped === 'Greenglowy' && greenglowyvalue === 2) { if (typeof circleglowOverlay !== 'undefined') { game.removeChild(circleglowOverlay); } if (typeof greenglowOverlay !== 'undefined') { game.removeChild(greenglowOverlay); } greenglowOverlay = LK.getAsset('Greenglowy', { width: newButton.width, height: newButton.height, x: newButton.x, y: newButton.y }); game.addChild(greenglowOverlay); whoequipped = 'Greenglowy'; } else { console.log("Not enough points to purchase Greenglow."); } }; shadowButton.down = function (x, y, obj) { if (shadowglowvalue === 1) { console.log("Shadow already owned."); shadowglowvalue = 2; // Set value to 2 if clicked again after purchase shadowButtonText.setText('Equipped'); // Update text to 'Equipped' if (typeof shadowglowOverlay !== 'undefined') { game.removeChild(shadowglowOverlay); shadowglowOverlay = undefined; } } else if (shadowglowvalue === 2) { shadowglowvalue = 1; // Toggle value back to 1 shadowButtonText.setText('Owned'); // Update text to 'Owned' if (typeof shadowglowOverlay !== 'undefined') { game.removeChild(shadowglowOverlay); shadowglowOverlay = undefined; } } else if (points >= 100 && shadowglowvalue === 0) { points -= 100; pointsText.setText('Points: ' + points); storage.points = points; storage.unlockedSkins.push('Shadow'); shadowglowvalue = 1; shadowButtonText.setText('Owned'); currentButtonSkin = 'Shadow'; if (whoequipped === 'Circleglow' && typeof circleglowOverlay !== 'undefined') { game.removeChild(circleglowOverlay); } if (typeof shadowglowOverlay !== 'undefined') { game.removeChild(shadowglowOverlay); } whoequipped = 'Shadow'; } if (whoequipped === 'Shadow' && shadowglowvalue === 2) { if (typeof circleglowOverlay !== 'undefined') { game.removeChild(circleglowOverlay); } if (typeof shadowglowOverlay !== 'undefined') { game.removeChild(shadowglowOverlay); } shadowglowOverlay = LK.getAsset('Shadow', { width: newButton.width, height: newButton.height, x: newButton.x, y: newButton.y }); game.addChild(shadowglowOverlay); whoequipped = 'Shadow'; } else { console.log("Not enough points to purchase Shadow."); } }; circleButton.down = function (x, y, obj) { if (circlevalue === 1) { console.log("Circleglow already owned."); circlevalue = 2; // Set value to 2 if clicked again after purchase circleButtonText.setText('Equipped'); // Update text to 'Equipped' if (typeof circleglowOverlay !== 'undefined') { game.removeChild(circleglowOverlay); circleglowOverlay = undefined; } if (typeof greenglowOverlay !== 'undefined') { game.removeChild(greenglowOverlay); // Ensure Greenglowy is removed when Circleglow is equipped greenglowOverlay = undefined; // Reset greenglowOverlay to ensure it can be re-added } circleglowOverlay = LK.getAsset('Circleglow', { width: newButton.width, height: newButton.height, x: newButton.x, y: newButton.y }); game.addChild(circleglowOverlay); whoequipped = 'Circleglow'; } else if (circlevalue === 2) { circlevalue = 1; // Toggle value back to 1 circleButtonText.setText('Owned'); // Update text to 'Owned' if (typeof circleglowOverlay !== 'undefined') { game.removeChild(circleglowOverlay); circleglowOverlay = undefined; } whoequipped = null; } else if (points >= 40 && circlevalue === 0) { points -= 40; pointsText.setText('Points: ' + points); storage.points = points; storage.unlockedSkins.push('Circleglow'); circlevalue = 1; circleButtonText.setText('Owned'); } }; // Add a close button to the shop menu var closeButton = LK.getAsset('Close', { width: 300, height: 300, x: shopMenu.x + shopMenu.width - 100, y: shopMenu.y + 10, shape: 'box' }); game.addChild(closeButton); var closeButtonText = new Text2('Close', { size: 80, fill: 0x000000 }); closeButtonText.x = closeButton.x + closeButton.width / 2 - closeButtonText.width / 2; closeButtonText.y = closeButton.y + closeButton.height / 2 - closeButtonText.height / 2 + 50; game.addChild(closeButtonText); closeButton.down = function (x, y, obj) { game.removeChild(shopMenu); game.removeChild(closeButton); game.removeChild(closeButtonText); game.removeChild(greenglowButton); game.removeChild(greenglowButtonText); game.removeChild(circleButton); // Ensure Circleglow is removed when shop is closed game.removeChild(circleButtonText); game.removeChild(retroglowButton); game.removeChild(retroglowButtonText); game.removeChild(shadowButton); game.removeChild(shadowButtonText); // Removed glowpack and glowpackText as they are not defined game.removeChild(LK.getAsset('Gloworange', {})); // Ensure Gloworange is removed when shop is closed }; } // Clear the interval when the game is over game.gameOver = function () { clearInterval(intervalId); }; var circleglowOverlay = undefined; var cloverskinOverlay = undefined; // Initialize cloverskinOverlay globally var leperachaunhatOverlay = undefined; // Initialize leperachaunhatOverlay globally var leperachaunhatValue = 0; // Initialize leperachaunhatValue globally var cloverskinValue = 0; // Initialize cloverskinValue globally var greenglowOverlay = undefined; // Initialize greenglowOverlay globally var shadowOverlay = undefined; // Initialize shadowOverlay globally var shadowglowvalue = 0; // Initialize shadowglowvalue globally var shadowvalue = 0; // Initialize shadowvalue var greenglowyvalue = 0; var circlevalue = 0; // Initialize circlevalue var circleglowvalue = 0; // Initialize circleglowvalue to track Circleglow status var ppc = 1; // Initialize points per click to 1 var points = storage.points || 0; var currentButtonSkin = null; // Variable to track the current button skin obtained from the glow pack var whoequipped = null; // Variable to track which button skin is equipped var clickerUpgradePurchased = false; // Track if Clicker Upgrade is purchased var workerValue = storage.upgrades.workerValue || 0; // Create a text var pointsText = new Text2('Points: ' + points, { size: 100, fill: 0x000000 }); // Position the text on the left hand corner pointsText.x = 0; pointsText.y = 0; // Add the text to the game game.addChild(pointsText); // Create a text for clovers currency var clovers = storage.clovers || 0; // Initialize clovers from storage var cloversText = new Text2('Clovers: ' + clovers, { size: 100, fill: 0x000000 }); var buttonClickCount = 0; // Initialize button click count var cloverUpgradeActive = false; // Initialize clover upgrade active flag // Position the clovers text below the points text cloversText.x = 0; cloversText.y = pointsText.height + 10; // Add the clovers text to the game game.addChild(cloversText); // Add clover asset next to the clover currency text var cloverAsset = LK.getAsset('Clovers', { width: 100, height: 100, x: cloversText.x + cloversText.width + 10, y: cloversText.y }); game.addChild(cloverAsset); var newButton = LK.getAsset(currentButtonSkin || 'Button', { width: 400, height: 400, x: 2048 / 2 - 200, // Position the new button in the center of the screen y: 2732 / 2 - 200, shape: 'circle' }); // Add the new button to the game game.addChild(newButton); // Add a click event to the button newButton.down = function (x, y, obj) { // Increase the points points += ppc; // Increase points by ppc value pointsText.setText('Points: ' + points); buttonClickCount++; // Increment button click count if (buttonClickCount === 3) { buttonClickCount = 0; // Reset click count if (cloverUpgradeActive) { clovers += 2; // Increment clover count by 2 if upgrade is active } else { clovers += 1; // Increment clover count by 1 if upgrade is not active } cloversText.setText('Clovers: ' + clovers); // Update clovers text cloverAsset.x = cloversText.x + cloversText.width + 10; // Update clover asset position storage.clovers = clovers; // Save clovers to storage } storage.points = points; if (currentButtonSkin === 'Shadowglowy') { // Additional logic if needed when shadowglow is active } if (LK.getSound('clickSound')) { LK.getSound('clickSound').play(); } else { console.error("Click sound not found!"); } // Add clover effect only if cauldron is equipped if (whoequipped === 'Cauldron' && cauldronValue === 2) { for (var i = 0; i < 5; i++) { var clover = LK.getAsset('Clovers', { width: 50, height: 50, x: newButton.x + Math.random() * newButton.width, y: newButton.y + Math.random() * newButton.height }); game.addChild(clover); tween(clover, { y: clover.y - 200, alpha: 0 }, { duration: 1000, onFinish: function onFinish() { game.removeChild(clover); } }); } for (var i = 0; i < 5; i++) { var goldCoin = LK.getAsset('Goldcoin', { width: 50, height: 50, x: newButton.x + Math.random() * newButton.width, y: newButton.y + Math.random() * newButton.height }); game.addChild(goldCoin); tween(goldCoin, { y: goldCoin.y - 200, alpha: 0 }, { duration: 1000, onFinish: function onFinish() { game.removeChild(goldCoin); } }); } } if (whoequipped === 'Circleglow' && circleglowvalue === 2) { if (greenglowOverlay) { game.removeChild(greenglowOverlay); } if (circleglowOverlay) { game.removeChild(circleglowOverlay); } circleglowOverlay = LK.getAsset('Circleglow', { width: newButton.width, height: newButton.height, x: newButton.x, y: newButton.y }); game.addChild(circleglowOverlay); } else if (whoequipped === 'Greenglowy' && greenglowyvalue === 2) { if (circleglowOverlay) { game.removeChild(circleglowOverlay); } if (greenglowOverlay) { game.removeChild(greenglowOverlay); } greenglowOverlay = LK.getAsset('Greenglowy', { width: newButton.width, height: newButton.height, x: newButton.x, y: newButton.y }); game.addChild(greenglowOverlay); } else if (whoequipped === 'Button') { if (circleglowOverlay) { game.removeChild(circleglowOverlay); } if (greenglowOverlay) { game.removeChild(greenglowOverlay); } var buttonOverlay = LK.getAsset('Button', { width: newButton.width, height: newButton.height, x: newButton.x, y: newButton.y }); game.addChild(buttonOverlay); } // Update the text pointsText.setText('Points: ' + points); storage.points = points; }; var shopButton = LK.getAsset('Shop', { width: 400, height: 200, x: 2048 - 400, // Position the button on the bottom right corner y: 2732 - 200 }); game.addChild(shopButton); var shopButtonText = new Text2('Shop', { size: 70, fill: 0x000000 }); shopButtonText.x = shopButton.x + shopButton.width / 2 - shopButtonText.width / 2; shopButtonText.y = shopButton.y + shopButton.height / 2 - shopButtonText.height / 2; game.addChild(shopButtonText); shopButton.down = function (x, y, obj) { // Logic to open the shop menu openShopMenu(); }; // Add St. Patrick's shop button var patrickShopButton = LK.getAsset('patrickshop', { width: 400, height: 200, x: 0, // Position at the bottom left corner y: 2732 - 200 // Align with the bottom }); game.addChild(patrickShopButton); var patrickShopButtonText = new Text2("St. Patrick's Shop", { size: 70, fill: 0x000000 }); patrickShopButtonText.x = patrickShopButton.x + patrickShopButton.width / 2 - patrickShopButtonText.width / 2; patrickShopButtonText.y = patrickShopButton.y + patrickShopButton.height / 2 - patrickShopButtonText.height / 2; game.addChild(patrickShopButtonText); patrickShopButton.down = function (x, y, obj) { console.log("St. Patrick's Shop button clicked."); // Create a St. Patrick's shop menu using the patrick asset var patrickShopMenu = LK.getAsset('patrickshop', { width: 1600, // Set the width of the shop menu height: 1600, // Set the height of the shop menu x: 2048 / 2 - 800, // Center horizontally y: 2732 / 2 - 800 // Center vertically }); game.addChild(patrickShopMenu); // Add a close button to the St. Patrick's shop menu var patrickCloseButton = LK.getAsset('Close', { width: 300, height: 300, x: patrickShopMenu.x + patrickShopMenu.width - 100, y: patrickShopMenu.y + 10 }); game.addChild(patrickCloseButton); var patrickCloseButtonText = new Text2('Close', { size: 80, fill: 0x000000 }); patrickCloseButtonText.x = patrickCloseButton.x + patrickCloseButton.width / 2 - patrickCloseButtonText.width / 2; patrickCloseButtonText.y = patrickCloseButton.y + patrickCloseButton.height / 2 - patrickCloseButtonText.height / 2 + 50; game.addChild(patrickCloseButtonText); // Add cloverskin asset purchase option var cloverskinButton = LK.getAsset('Cloverskin', { width: 400, height: 400, x: patrickShopMenu.x + 100, y: patrickShopMenu.y + 100 }); game.addChild(cloverskinButton); var cloverskinButtonText = new Text2(cloverskinValue === 2 ? 'Equipped' : cloverskinValue === 1 ? 'Owned' : '30 Clovers', { size: 70, fill: 0x000000 }); cloverskinButtonText.x = cloverskinButton.x + cloverskinButton.width / 2 - cloverskinButtonText.width / 2; cloverskinButtonText.y = cloverskinButton.y + cloverskinButton.height / 2 - cloverskinButtonText.height / 2 + 250; game.addChild(cloverskinButtonText); // Add leperachaunhat asset purchase option var leperachaunhatButton = LK.getAsset('Leperachaunhat', { width: 400, height: 400, x: patrickShopMenu.x + 600, y: patrickShopMenu.y + 100 }); game.addChild(leperachaunhatButton); var leperachaunhatButtonText = new Text2(leperachaunhatValue === 2 ? 'Equipped' : leperachaunhatValue === 1 ? 'Owned' : '50 Clovers', { size: 70, fill: 0x000000 }); leperachaunhatButtonText.x = leperachaunhatButton.x + leperachaunhatButton.width / 2 - leperachaunhatButtonText.width / 2; leperachaunhatButtonText.y = leperachaunhatButton.y + leperachaunhatButton.height / 2 - leperachaunhatButtonText.height / 2 + 250; game.addChild(leperachaunhatButtonText); // Add cauldron asset purchase option var cauldronButton = LK.getAsset('Cauldron', { width: 400, height: 400, x: patrickShopMenu.x + 1100, y: patrickShopMenu.y + 100 }); game.addChild(cauldronButton); var cauldronButtonText = new Text2(cauldronValue === 2 ? 'Equipped' : cauldronValue === 1 ? 'Owned' : '200 Clovers', { size: 70, fill: 0x000000 }); cauldronButtonText.x = cauldronButton.x + cauldronButton.width / 2 - cauldronButtonText.width / 2; cauldronButtonText.y = cauldronButton.y + cauldronButton.height / 2 - cauldronButtonText.height / 2 + 250; game.addChild(cauldronButtonText); cauldronButton.down = function (x, y, obj) { if (cauldronValue === 1) { console.log("Cauldron already owned."); cauldronValue = 2; // Set value to 2 if clicked again after purchase cauldronButtonText.setText('Equipped'); // Update text to 'Equipped' if (typeof cauldronOverlay !== 'undefined') { game.removeChild(cauldronOverlay); cauldronOverlay = undefined; } } else if (cauldronValue === 2) { cauldronValue = 1; // Toggle value back to 1 cauldronButtonText.setText('Owned'); // Update text to 'Owned' if (typeof cauldronOverlay !== 'undefined') { game.removeChild(cauldronOverlay); cauldronOverlay = undefined; } } else if (clovers >= 200 && cauldronValue === 0) { clovers -= 200; cloversText.setText('Clovers: ' + clovers); storage.clovers = clovers; storage.unlockedSkins.push('Cauldron'); cauldronValue = 1; cauldronButtonText.setText('Owned'); currentButtonSkin = 'Cauldron'; if (whoequipped === 'Circleglow' && typeof circleglowOverlay !== 'undefined') { game.removeChild(circleglowOverlay); } if (typeof cauldronOverlay !== 'undefined') { game.removeChild(cauldronOverlay); } whoequipped = 'Cauldron'; } else { console.log("Not enough clovers for Cauldron."); } if (whoequipped === 'Cauldron' && cauldronValue === 2) { if (typeof circleglowOverlay !== 'undefined') { game.removeChild(circleglowOverlay); } if (typeof cauldronOverlay !== 'undefined') { game.removeChild(cauldronOverlay); } cauldronOverlay = LK.getAsset('Cauldron', { width: newButton.width, height: newButton.height, x: newButton.x, y: newButton.y }); game.addChild(cauldronOverlay); whoequipped = 'Cauldron'; // Create clover flying effect for (var i = 0; i < 5; i++) { var clover = LK.getAsset('Clovers', { width: 50, height: 50, x: cauldronButton.x + Math.random() * cauldronButton.width, y: cauldronButton.y + Math.random() * cauldronButton.height }); game.addChild(clover); tween(clover, { y: clover.y - 200, alpha: 0 }, { duration: 1000, onFinish: function onFinish() { game.removeChild(clover); } }); } for (var i = 0; i < 5; i++) { var goldCoin = LK.getAsset('Goldcoin', { width: 50, height: 50, x: cauldronButton.x + Math.random() * cauldronButton.width, y: cauldronButton.y + Math.random() * cauldronButton.height }); game.addChild(goldCoin); tween(goldCoin, { y: goldCoin.y - 200, alpha: 0 }, { duration: 1000, onFinish: function onFinish() { game.removeChild(goldCoin); } }); } } }; leperachaunhatButton.down = function (x, y, obj) { if (leperachaunhatValue === 1) { console.log("Leperachaunhat already owned."); leperachaunhatValue = 2; // Set value to 2 if clicked again after purchase leperachaunhatButtonText.setText('Equipped'); // Update text to 'Equipped' if (typeof leperachaunhatOverlay !== 'undefined') { game.removeChild(leperachaunhatOverlay); leperachaunhatOverlay = undefined; } } else if (leperachaunhatValue === 2) { leperachaunhatValue = 1; // Toggle value back to 1 leperachaunhatButtonText.setText('Owned'); // Update text to 'Owned' if (typeof leperachaunhatOverlay !== 'undefined') { game.removeChild(leperachaunhatOverlay); leperachaunhatOverlay = undefined; } } else if (clovers >= 50 && leperachaunhatValue === 0) { clovers -= 50; cloversText.setText('Clovers: ' + clovers); storage.clovers = clovers; storage.unlockedSkins.push('Leperachaunhat'); leperachaunhatValue = 1; leperachaunhatButtonText.setText('Owned'); currentButtonSkin = 'Leperachaunhat'; if (whoequipped === 'Circleglow' && typeof circleglowOverlay !== 'undefined') { game.removeChild(circleglowOverlay); } if (typeof leperachaunhatOverlay !== 'undefined') { game.removeChild(leperachaunhatOverlay); } whoequipped = 'Leperachaunhat'; } else { console.log("Not enough clovers for Leperachaunhat."); } if (whoequipped === 'Leperachaunhat' && leperachaunhatValue === 2) { if (typeof circleglowOverlay !== 'undefined') { game.removeChild(circleglowOverlay); } if (typeof leperachaunhatOverlay !== 'undefined') { game.removeChild(leperachaunhatOverlay); } leperachaunhatOverlay = LK.getAsset('Leperachaunhat', { width: newButton.width, height: newButton.height, x: newButton.x, y: newButton.y }); game.addChild(leperachaunhatOverlay); whoequipped = 'Leperachaunhat'; } }; cloverskinButton.down = function (x, y, obj) { if (cloverskinValue === 1) { console.log("Cloverskin already owned."); cloverskinValue = 2; // Set value to 2 if clicked again after purchase cloverskinButtonText.setText('Equipped'); // Update text to 'Equipped' if (typeof cloverskinOverlay !== 'undefined') { game.removeChild(cloverskinOverlay); cloverskinOverlay = undefined; } } else if (cloverskinValue === 2) { cloverskinValue = 1; // Toggle value back to 1 cloverskinButtonText.setText('Owned'); // Update text to 'Owned' if (typeof cloverskinOverlay !== 'undefined') { game.removeChild(cloverskinOverlay); cloverskinOverlay = undefined; } } else if (clovers >= 30 && cloverskinValue === 0) { clovers -= 30; cloversText.setText('Clovers: ' + clovers); storage.clovers = clovers; storage.unlockedSkins.push('Cloverskin'); cloverskinValue = 1; cloverskinButtonText.setText('Owned'); currentButtonSkin = 'Cloverskin'; if (whoequipped === 'Circleglow' && typeof circleglowOverlay !== 'undefined') { game.removeChild(circleglowOverlay); } if (typeof cloverskinOverlay !== 'undefined') { game.removeChild(cloverskinOverlay); } whoequipped = 'Cloverskin'; } else { console.log("Not enough clovers for Cloverskin."); } if (whoequipped === 'Cloverskin' && cloverskinValue === 2) { if (typeof circleglowOverlay !== 'undefined') { game.removeChild(circleglowOverlay); } if (typeof cloverskinOverlay !== 'undefined') { game.removeChild(cloverskinOverlay); } cloverskinOverlay = LK.getAsset('Cloverskin', { width: newButton.width, height: newButton.height, x: newButton.x, y: newButton.y }); game.addChild(cloverskinOverlay); whoequipped = 'Cloverskin'; } }; patrickCloseButton.down = function (x, y, obj) { game.removeChild(patrickShopMenu); game.removeChild(patrickCloseButton); game.removeChild(patrickCloseButtonText); game.removeChild(cloverskinButton); game.removeChild(cloverskinButtonText); game.removeChild(leperachaunhatButton); game.removeChild(leperachaunhatButtonText); game.removeChild(cauldronButton); game.removeChild(cauldronButtonText); }; }; // Add an inventory button to the bottom left corner var clickerUpgradeButton = LK.getAsset('Clickupgrade', { width: 600, // Same width as worker upgrade button height: 300, // Same height as worker upgrade button x: 1448, // Align with the worker upgrade button horizontally y: 310 // Position below the worker upgrade button }); game.addChild(clickerUpgradeButton); var clickerUpgradeText = new Text2('+2 click 40$', { size: 100, fill: 0x808080 }); clickerUpgradeText.x = clickerUpgradeButton.x + clickerUpgradeButton.width / 2 - clickerUpgradeText.width / 2; clickerUpgradeText.y = clickerUpgradeButton.y + clickerUpgradeButton.height / 2 - clickerUpgradeText.height / 2; game.addChild(clickerUpgradeText); clickerUpgradeButton.down = function (x, y, obj) { // Logic for clicker upgrade if (points >= 40 && !clickerUpgradePurchased) { points -= 40; pointsText.setText('Points: ' + points); storage.points = points; clickerUpgradePurchased = true; ppc = 2; // Set points per click to 2 after purchasing the first clicker upgrade clickerUpgradeText.setText('+4 click 120$'); // Update text to '+4 click 120$' console.log("Clicker Upgrade to +2 purchased."); } else if (points >= 120 && clickerUpgradePurchased) { points -= 120; pointsText.setText('Points: ' + points); storage.points = points; ppc = 4; // Set points per click to 4 after purchasing the second clicker upgrade clickerUpgradeText.setText('+8 click 500$'); // Update text to '+8 click 500$' console.log("Clicker Upgrade to +4 purchased."); game.removeChild(clickerUpgradeButton); // Remove the second clicker upgrade button // Add the last clicker upgrade button var lastClickerUpgradeButton = LK.getAsset('Clickupgrade', { width: 600, height: 300, x: 1448, y: 310 }); game.addChild(lastClickerUpgradeButton); var lastClickerUpgradeText = new Text2('+8 click 500$', { size: 100, fill: 0x808080 }); lastClickerUpgradeText.x = lastClickerUpgradeButton.x + lastClickerUpgradeButton.width / 2 - lastClickerUpgradeText.width / 2; lastClickerUpgradeText.y = lastClickerUpgradeButton.y + lastClickerUpgradeButton.height / 2 - lastClickerUpgradeText.height / 2; game.addChild(lastClickerUpgradeText); lastClickerUpgradeButton.down = function (x, y, obj) { if (points >= 500) { points -= 500; pointsText.setText('Points: ' + points); storage.points = points; ppc = 8; // Set points per click to 8 after purchasing the last clicker upgrade lastClickerUpgradeText.setText('Max Upgrade'); // Indicate max upgrade reached console.log("Last Clicker Upgrade to +8 purchased."); game.removeChild(lastClickerUpgradeButton); // Remove the third clicker upgrade button game.removeChild(lastClickerUpgradeText); // Remove the text associated with the third clicker upgrade button // Add autoclicker button var autoclickerButton = LK.getAsset('Autoclick', { width: 600, height: 300, x: 1448, y: 310 }); game.addChild(autoclickerButton); var autoclickerText = new Text2('Autoclicker 550$', { size: 100, fill: 0x808080 }); autoclickerText.x = autoclickerButton.x + autoclickerButton.width / 2 - autoclickerText.width / 2; autoclickerText.y = autoclickerButton.y + autoclickerButton.height / 2 - autoclickerText.height / 2; game.addChild(autoclickerText); autoclickerButton.down = function (x, y, obj) { if (points >= 550) { points -= 550; pointsText.setText('Points: ' + points); storage.points = points; console.log("Autoclicker purchased."); // Implement autoclicker functionality intervalId = LK.setInterval(function () { newButton.down(); // Simulate button click }, 500); // Click every 0.5 seconds game.removeChild(autoclickerButton); // Remove the autoclicker button after purchase game.removeChild(autoclickerText); // Remove the autoclicker text after purchase // Add Ultra Clicker upgrade var ultraClickerButton = LK.getAsset('Autoclick', { width: 600, height: 300, x: 1448, y: 310 }); game.addChild(ultraClickerButton); var ultraClickerText = new Text2('Ultra clicker 850$', { size: 100, fill: 0x808080 }); ultraClickerText.x = ultraClickerButton.x + ultraClickerButton.width / 2 - ultraClickerText.width / 2; ultraClickerText.y = ultraClickerButton.y + ultraClickerButton.height / 2 - ultraClickerText.height / 2; game.addChild(ultraClickerText); ultraClickerButton.down = function (x, y, obj) { if (points >= 850) { points -= 850; pointsText.setText('Points: ' + points); storage.points = points; console.log("Ultra Clicker purchased."); // Implement ultra clicker functionality LK.clearInterval(intervalId); intervalId = LK.setInterval(function () { newButton.down(); // Simulate button click }, 200); // Click every 0.2 seconds game.removeChild(ultraClickerButton); // Remove the ultra clicker button after purchase game.removeChild(ultraClickerText); // Remove the ultra clicker text after purchase // Add Hyper Clicker 2k upgrade var hyperClickerButton = LK.getAsset('Autoclick', { width: 600, height: 300, x: 1448, y: 310 }); game.addChild(hyperClickerButton); var hyperClickerText = new Text2('Hyper Clicker 2k 2000$', { size: 100, fill: 0x808080 }); hyperClickerText.x = hyperClickerButton.x + hyperClickerButton.width / 2 - hyperClickerText.width / 2; hyperClickerText.y = hyperClickerButton.y + hyperClickerButton.height / 2 - hyperClickerText.height / 2; game.addChild(hyperClickerText); hyperClickerButton.down = function (x, y, obj) { if (points >= 2000) { points -= 2000; pointsText.setText('Points: ' + points); storage.points = points; console.log("Hyper Clicker 2k purchased."); // Implement hyper clicker functionality LK.clearInterval(intervalId); intervalId = LK.setInterval(function () { newButton.down(); // Simulate button click }, 100); // Click every 0.1 seconds game.removeChild(hyperClickerButton); // Remove the hyper clicker button after purchase game.removeChild(hyperClickerText); // Remove the hyper clicker text after purchase } else { console.log("Not enough points for Hyper Clicker 2k."); } }; } else { console.log("Not enough points for Ultra Clicker."); } }; } else { console.log("Not enough points for Autoclicker."); } }; } else { console.log("Not enough points for Last Clicker Upgrade."); } }; } else if (points >= 500 && clickerUpgradePurchased === true && ppc === 4) { points -= 500; pointsText.setText('Points: ' + points); storage.points = points; ppc = 8; // Set points per click to 8 after purchasing the third clicker upgrade clickerUpgradeText.setText('Max Upgrade'); // Indicate max upgrade reached console.log("Clicker Upgrade to +8 purchased."); } else { console.log("Not enough points for Clicker Upgrade."); } }; var intervalId; var button = LK.getAsset('Shop', { width: 600, height: 300, x: 1448, // Position the button on the right hand corner y: 0 }); // Add the button to the game game.addChild(button); // Add a click event to the button button.down = function (x, y, obj) { // Check if the points are 20 or more if (points >= 20) { // Decrease the points points -= 20; // Update the text pointsText.setText('Points: ' + points); storage.points = points; // Update workerValue to 1 workerValue = 1; storage.upgrades.workerValue = workerValue; storage.upgrades = { workerValue: workerValue }; // Start getting workerValue points every second intervalId = LK.setInterval(function () { points += workerValue; // Update the text pointsText.setText('Points: ' + points); }, 1000); // Remove the old button and its text button.alpha = 0; // Make the original button invisible instead of removing it game.removeChild(buttonText); // Remove the old text // Create a new button with different text var newButton = LK.getAsset('Shop', { width: 600, height: 300, x: 1448, y: 0 }); // Add the new button to the game game.addChild(newButton); // Create a new text var newText = new Text2('50$ +5 worker', { size: 100, fill: 0x000000 }); // Position the text on the new button newText.x = newButton.x + newButton.width / 2 - newText.width / 2; newText.y = newButton.y + newButton.height / 2 - newText.height / 2; // Add the text to the game game.addChild(newText); // Add a click event to the new button newButton.down = function (x, y, obj) { // Check if the points are 50 or more if (points >= 50) { // Decrease the points points -= 50; // Update the text pointsText.setText('Points: ' + points); storage.points = points; // Update workerValue to 5 workerValue = 5; storage.upgrades.workerValue = workerValue; storage.upgrades = { workerValue: workerValue }; // Clear the previous interval LK.clearInterval(intervalId); // Start getting workerValue points every second intervalId = LK.setInterval(function () { points += workerValue; // Update the text pointsText.setText('Points: ' + points); }, 1000); // Remove the old button game.removeChild(newButton); // Create a new button with different text var newButton2 = LK.getAsset('Shop', { width: 600, height: 300, x: 1448, y: 0 }); // Add the new button to the game game.addChild(newButton2); // Create a new text var newText2 = new Text2('150$ +10 worker', { size: 100, fill: 0x000000 }); // Position the text on the new button newText2.x = newButton2.x + newButton2.width / 2 - newText2.width / 2; newText2.y = newButton2.y + newButton2.height / 2 - newText2.height / 2; // Add the text to the game game.addChild(newText2); // Add a click event to the new button newButton2.down = function (x, y, obj) { // Check if the points are 150 or more if (points >= 150 && workerValue === 5) { // Decrease the points points -= 150; // Update the text pointsText.setText('Points: ' + points); storage.points = points; // Update workerValue to 10 workerValue = 10; storage.upgrades.workerValue = workerValue; storage.upgrades = { workerValue: workerValue }; // Clear the previous interval LK.clearInterval(intervalId); // Start getting workerValue points every second intervalId = LK.setInterval(function () { points += workerValue; // Update the text pointsText.setText('Points: ' + points); }, 1000); // Remove the button and all worker texts after purchasing the upgrade game.removeChild(newButton2); game.removeChild(newText2); game.removeChild(button); game.removeChild(buttonText); game.removeChild(newText); // Display 'Worker max: 10/s' text var maxWorkerText = new Text2('Worker max: 10/s', { size: 100, fill: 0x000000 }); maxWorkerText.x = button.x + button.width / 2 - maxWorkerText.width / 2; maxWorkerText.y = button.y + button.height / 2 - maxWorkerText.height / 2; game.addChild(maxWorkerText); } }; } }; } }; // Create a text var buttonText = new Text2('20$ +1 worker', { size: 120, fill: 0x000000 }); // Position the text on the button buttonText.x = button.x + button.width / 2 - buttonText.width / 2; buttonText.y = button.y + button.height / 2 - buttonText.height / 2; // Add the text to the game game.addChild(buttonText); ; whoequipped = 'Circleglow'; // Update whoequipped to track the equipped skin
===================================================================
--- original.js
+++ change.js
@@ -37,10 +37,10 @@
game.addChild(forcefield);
// Add click event to forcefield to display protect asset on button
forcefield.down = function (x, y, obj) {
var protectAsset = LK.getAsset('Protect', {
- width: newButton.width,
- height: newButton.height,
+ width: newButton.width * 1.5,
+ height: newButton.height * 1.5,
x: newButton.x,
y: newButton.y
});
protectAsset.alpha = 0.5;