User prompt
When you unlock a button skin from the gloe pack, make it showin the inventory menu
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'if (glowSkinsSection) {' Line Number: 86
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'var unlockedSkin = glowSkinsSection.children.find(function (child) {' Line Number: 86
User prompt
Put all the buttons in the glowy pack in the inventory menu organized but make them all black so it is just the outline of each glow skin And when you get a button skin from the glow pack it's black outline turns normal
User prompt
The button outlines are still showing after you close the inevntory menu
User prompt
I found a glotch where when you go into the inventory menu and then close it the glow button outlines still show up.
User prompt
The glow button skins are not showing up in the inventory.
User prompt
When you unlock a glow pack button skin it is displayed in the inventory menu
User prompt
The outlined glow skins in the inventory should turn to their actual state when they are pulled in the glow pack
User prompt
So the black outlined glows in the inventory. When i unlock any glow that glow should be appeared in the imventory. So for example if i get greenglow then in the inventory instead of the greenglow bring black it will actually be the greenglow asset
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'var unlockedSkinButton = LK.getAsset(pulledSkin, {' Line Number: 86
User prompt
Now make it so when you unlock one from buying a pack. The one you unlock it appears in the inventory
User prompt
Now move them down a little
User prompt
Make them a bit bigger
User prompt
Awesome now apread them out and make them bigger
User prompt
Put all the buttons in the glowy pack in the inventory menu organized but make them all black so it is just the outline of each glow skin
User prompt
Put all the buttons in the glowy pack in the inventory menu organized but make them all black.
User prompt
Make it so when you close the inventory menu make the text dissapear
User prompt
Instead of the text in the inventory saying unlocked glow pack make it say glow pack skins
User prompt
Remove the glow pack asset just make a section, so when you have any glow skins unlocked they will appear there
User prompt
In the inventory make a section for the glow pack
User prompt
Now make an inventory menu when thr inventory button is clicked
User prompt
Now lets make an inventory button on the bottom left corner of the screen
User prompt
Rename glowy to sun glowy
User prompt
Lets rename glowy2 to purple glow
/**** * Plugins ****/ var storage = LK.import("@upit/storage.v1", { points: 0, upgrades: { workerValue: 0 } }); /**** * 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 ****/ //<Assets used in the game will automatically appear here> //<Write imports for supported plugins 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 the glowpack asset to the shop menu var glowpack = LK.getAsset('Glowpack', { x: shopMenu.x + 100, // Position it inside the shop menu y: shopMenu.y + 100, scaleX: 5.0, // Increase the width slightly scaleY: 5.0 // Increase the height slightly // Double the height }); game.addChild(glowpack); // Add text under the glowpack var glowpackText = new Text2('Glow Pack: 20$', { size: 70, // Increase the size of the text fill: 0x000000 }); glowpackText.x = glowpack.x; glowpackText.y = glowpack.y + glowpack.height + 400; // Position text a lot lower below the glowpack game.addChild(glowpackText); // Add a click event to the glowpack glowpack.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); // Logic to equip button skins from the glow pack console.log("Glow Pack purchased! Button skins equipped."); // Store the unlocked skin storage.unlockedSkins = storage.unlockedSkins || []; if (!storage.unlockedSkins.includes(pulledSkin)) { storage.unlockedSkins.push(pulledSkin); } // Close the shop menu when the animation starts game.removeChild(shopMenu); game.removeChild(closeButton); game.removeChild(closeButtonText); game.removeChild(glowpack); game.removeChild(glowpackText); // Ensure the shop menu is closed before starting the animation if (shopMenu.parent) { game.removeChild(shopMenu); } // Create an animation to show the button skin obtained // Ensure 'pulledSkin' is defined before use var skinAnimation; if (pulledSkin) { skinAnimation = LK.getAsset(pulledSkin, { scaleX: 6.0, scaleY: 6.0 }); } if (skinAnimation) { skinAnimation.x = 2048 / 2 - skinAnimation.width * skinAnimation.scaleX / 2; skinAnimation.y = 2732 / 2 - skinAnimation.height * skinAnimation.scaleY / 2; game.addChild(skinAnimation); } // Directly display the skinAnimation without fade-in LK.setTimeout(function () { game.removeChild(skinAnimation); game.removeChild(skinDetailsText); // Ensure the animation text is removed }, 2000); // Display for 2 seconds // Reopen the shop menu after the animation ends LK.setTimeout(function () { openShopMenu(); }, 2000); // Add logic for pulling Gloworange, Glowy, Greenglowy, Circleglow, or Retroglow with specified chances var randomValue = Math.random(); var pulledSkin; if (randomValue < 0.2) { pulledSkin = 'Gloworange'; } else if (randomValue < 0.4) { pulledSkin = 'SunGlowy'; } else if (randomValue < 0.6) { pulledSkin = 'Greenglowy'; } else if (randomValue < 0.72) { pulledSkin = 'Circleglow'; } else if (randomValue < 0.84) { pulledSkin = 'Yellowglowy'; } else if (randomValue < 0.90) { pulledSkin = 'Shadowglowy'; } else if (randomValue < 0.96) { pulledSkin = 'Purpleglow'; } else if (randomValue < 0.99) { pulledSkin = 'Retroglow'; } else { pulledSkin = 'Glowychroma'; } console.log(pulledSkin + " pulled! It's a common item."); // Create an animation to show the button skin obtained var skinAnimation = LK.getAsset(pulledSkin, { scaleX: 6.0, scaleY: 6.0 }); skinAnimation.x = 2048 / 2 - skinAnimation.width * skinAnimation.scaleX / 2; skinAnimation.y = 2732 / 2 - skinAnimation.height * skinAnimation.scaleY / 2; game.addChild(skinAnimation); // Determine rarity and chance var rarity, chance; if (pulledSkin === 'Gloworange' || pulledSkin === 'SunGlowy' || pulledSkin === 'Greenglowy') { rarity = 'Common'; chance = '20%'; } else if (pulledSkin === 'Circleglow' || pulledSkin === 'Yellowglowy') { rarity = 'Rare'; chance = '12%'; } else if (pulledSkin === 'Shadowglowy' || pulledSkin === 'Purpleglow') { rarity = 'Epic'; chance = '6%'; } else if (pulledSkin === 'Retroglow') { rarity = 'Legendary'; chance = '3%'; } else if (pulledSkin === 'Glowychroma') { rarity = 'Chroma'; chance = '1%'; } // Add text under the animation to show details var skinDetailsText = new Text2(pulledSkin + ': ' + rarity + ' (' + chance + ')', { size: 80, fill: 0x000000, fontWeight: 'bold' }); skinDetailsText.x = skinAnimation.x + skinAnimation.width * skinAnimation.scaleX / 2 - skinDetailsText.width / 2; skinDetailsText.y = skinAnimation.y + skinAnimation.height * skinAnimation.scaleY + 20; // Position text just below the animation game.addChild(skinDetailsText); // Set the new button skin to the pulled skin after the animation LK.setTimeout(function () { newButton.texture = LK.getAsset(pulledSkin, {}).texture; }, 2000); } else { console.log("Not enough points to purchase Glow Pack."); } }; // Add a close button to the shop menu var closeButton = LK.getAsset('button', { width: 400, // Double the width height: 200, // Double the height x: shopMenu.x + shopMenu.width - 410, // Adjust x position to accommodate increased size y: shopMenu.y + 10, shape: 'box' }); game.addChild(closeButton); var closeButtonText = new Text2('Close', { size: 60, fill: 0x000000 }); closeButtonText.x = closeButton.x + closeButton.width / 2 - closeButtonText.width / 2; closeButtonText.y = closeButton.y + closeButton.height / 2 - closeButtonText.height / 2; game.addChild(closeButtonText); closeButton.down = function (x, y, obj) { game.removeChild(shopMenu); game.removeChild(closeButton); game.removeChild(closeButtonText); game.removeChild(glowpack); game.removeChild(glowpackText); 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 points = storage.points || 0; 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); var newButton = LK.getAsset('button', { width: 300, height: 300, x: 2048 / 2 - 150, // Position the new button in the center of the screen y: 2732 / 2 - 150, 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++; // 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: 50, 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 an inventory button to the bottom left corner var inventoryButton = LK.getAsset('button', { width: 400, height: 200, x: 0, // Position the button on the bottom left corner y: 2732 - 200 }); game.addChild(inventoryButton); var inventoryButtonText = new Text2('Inventory', { size: 50, fill: 0x000000 }); inventoryButtonText.x = inventoryButton.x + inventoryButton.width / 2 - inventoryButtonText.width / 2; inventoryButtonText.y = inventoryButton.y + inventoryButton.height / 2 - inventoryButtonText.height / 2; game.addChild(inventoryButtonText); inventoryButton.down = function (x, y, obj) { // Logic to open the inventory menu // Create a large inventory menu var inventoryMenu = LK.getAsset('Shop', { width: 1600, height: 1600, x: 2048 / 2 - 800, y: 2732 / 2 - 800 }); game.addChild(inventoryMenu); // Add a close button to the inventory menu var closeInventoryButton = LK.getAsset('button', { width: 400, height: 200, x: inventoryMenu.x + inventoryMenu.width - 410, y: inventoryMenu.y + 10, shape: 'box' }); game.addChild(closeInventoryButton); var closeInventoryButtonText = new Text2('Close', { size: 60, fill: 0x000000 }); closeInventoryButtonText.x = closeInventoryButton.x + closeInventoryButton.width / 2 - closeInventoryButtonText.width / 2; closeInventoryButtonText.y = closeInventoryButton.y + closeInventoryButton.height / 2 - closeInventoryButtonText.height / 2; game.addChild(closeInventoryButtonText); // Add a section for unlocked glow skins in the inventory menu var glowSkinsSection = new Container(); glowSkinsSection.x = inventoryMenu.x + 100; glowSkinsSection.y = inventoryMenu.y + 100; game.addChild(glowSkinsSection); // Display unlocked glow pack skins var unlockedSkins = storage.unlockedSkins || []; unlockedSkins.forEach(function (skin, index) { var skinAsset = LK.getAsset(skin, { x: glowSkinsSection.x + index % 4 * 150, y: glowSkinsSection.y + Math.floor(index / 4) * 150, scaleX: 1.5, scaleY: 1.5 }); glowSkinsSection.addChild(skinAsset); }); // Add text for the glow skins section var glowSkinsSectionText = new Text2('Glow Pack Skins', { size: 70, fill: 0x000000 }); glowSkinsSectionText.x = glowSkinsSection.x; glowSkinsSectionText.y = glowSkinsSection.y - 50; // Position text above the section game.addChild(glowSkinsSectionText); closeInventoryButton.down = function (x, y, obj) { game.removeChild(inventoryMenu); game.removeChild(closeInventoryButton); game.removeChild(closeInventoryButtonText); game.removeChild(glowSkinsSectionText); }; }; ; var intervalId; var button = LK.getAsset('button', { 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 game.removeChild(button); // Create a new button with different text var newButton = LK.getAsset('button', { 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('button', { 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) { // 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); } }; } }; } }; // Create a text var buttonText = new Text2('20$ +1 worker', { size: 100, 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); ;
===================================================================
--- original.js
+++ change.js
@@ -65,17 +65,12 @@
// Update the text
pointsText.setText('Points: ' + points);
// Logic to equip button skins from the glow pack
console.log("Glow Pack purchased! Button skins equipped.");
- // Update the outline of the unlocked skin to normal
- if (typeof glowSkinsSection !== 'undefined' && glowSkinsSection) {
- var unlockedSkin = glowSkinsSection.children.find(function (child) {
- return child.texture === LK.getAsset(pulledSkin, {}).texture;
- });
- if (unlockedSkin) {
- unlockedSkin.tint = 0xFFFFFF; // Reset tint to normal
- unlockedSkin.alpha = 1.0; // Make it fully opaque
- }
+ // Store the unlocked skin
+ storage.unlockedSkins = storage.unlockedSkins || [];
+ if (!storage.unlockedSkins.includes(pulledSkin)) {
+ storage.unlockedSkins.push(pulledSkin);
}
// Close the shop menu when the animation starts
game.removeChild(shopMenu);
game.removeChild(closeButton);
@@ -302,22 +297,18 @@
var glowSkinsSection = new Container();
glowSkinsSection.x = inventoryMenu.x + 100;
glowSkinsSection.y = inventoryMenu.y + 100;
game.addChild(glowSkinsSection);
- // Define glow skin IDs
- var glowSkinIDs = ['Circleglow', 'Gloworange', 'Glowychroma', 'Greenglowy', 'Purpleglow', 'Retroglow', 'Shadowglowy', 'SunGlowy', 'Yellowglowy'];
- // Add black outline for each glow skin
- glowSkinIDs.forEach(function (skinID, index) {
- var skinOutline = LK.getAsset(skinID, {
- tint: 0x000000,
- // Set to black for outline
- alpha: 0.5,
- // Make it semi-transparent
- x: glowSkinsSection.x + index % 3 * 120,
- // Arrange in a grid
- y: glowSkinsSection.y + Math.floor(index / 3) * 120
+ // Display unlocked glow pack skins
+ var unlockedSkins = storage.unlockedSkins || [];
+ unlockedSkins.forEach(function (skin, index) {
+ var skinAsset = LK.getAsset(skin, {
+ x: glowSkinsSection.x + index % 4 * 150,
+ y: glowSkinsSection.y + Math.floor(index / 4) * 150,
+ scaleX: 1.5,
+ scaleY: 1.5
});
- glowSkinsSection.addChild(skinOutline);
+ glowSkinsSection.addChild(skinAsset);
});
// Add text for the glow skins section
var glowSkinsSectionText = new Text2('Glow Pack Skins', {
size: 70,