User prompt
Make checklist 3 once 10 items have been purchased
User prompt
Please fix the bug: 'ReferenceError: shoppingListItems is not defined' in or related to this line: 'for (var j = 0; j < shoppingListItems.length; j++) {' Line Number: 843
User prompt
Once 5 items on checklist are purchased, bring up a new checklist with 5 different items
User prompt
Add visual checkmarks**: For purchased items, add a checkmark asset (like 'checkmark' or 'tick') positioned next to or overlaying the item text/checkbox.
User prompt
Check purchase status**: When creating the enlarged shopping list, for each shopping list item, check if that item's name exists in the `purchasedItems` array using `purchasedItems.indexOf(itemName) !== -1`.
User prompt
*Track purchased items** ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Please do this
User prompt
When built in onesie with socks is purchased tick the box in enlarged shopping list
User prompt
Please fix the bug: 'ReferenceError: enlargedShoppingList is not defined' in or related to this line: 'if (enlargedShoppingList) {' Line Number: 969
User prompt
When an item is purchased add a tick to the checkbox display next to said item
User prompt
How to I create a checklist in shopping list text screen
User prompt
Please fix the bug: 'ReferenceError: shoppingListItems is not defined' in or related to this line: 'for (var i = 0; i < shoppingListItems.length; i++) {' Line Number: 233
User prompt
Please fix the bug: 'ReferenceError: shoppingListItems is not defined' in or related to this line: 'for (var i = 0; i < shoppingListItems.length; i++) {' Line Number: 233
User prompt
Please fix the bug: 'ReferenceError: updateShoppingListItems is not defined' in or related to this line: 'updateShoppingListItems();' Line Number: 1012
User prompt
Please fix the bug: 'ReferenceError: updateShoppingListItems is not defined' in or related to this line: 'updateShoppingListItems();' Line Number: 1012
User prompt
Define updateShoppingListItems function globally to fix ReferenceError
User prompt
Please fix the bug: 'ReferenceError: updateShoppingListItems is not defined' in or related to this line: 'updateShoppingListItems();' Line Number: 1012
User prompt
Please fix the bug: 'ReferenceError: updateShoppingListItems is not defined' in or related to this line: 'updateShoppingListItems();' Line Number: 1012
User prompt
Please fix the bug: 'ReferenceError: updateShoppingListItems is not defined' in or related to this line: 'updateShoppingListItems();' Line Number: 1012
User prompt
Update shopping list UI immediately when an item is purchased, even if enlargedShoppingList is not open 🔄 Update shopping list UI immediately when an item is purchased (item click path), even if enlargedShoppingList is not open
User prompt
Why isn't it crossing items off the shopping list
User prompt
When items are collected ensure they are crossed off shopping list
User prompt
Ensure all price tags are visible on screen
User prompt
Change name of lord jumpsuit to velour jumpsuit
User prompt
Add pricetagbuiltinonesiewithsocks to price tags add discountbuiltinonesiewithsocks to discount tags
/**** * Classes ****/ // Discount class to handle discounted item prices var Discount = Container.expand(function () { var self = Container.call(this); // Set the discount tag asset self.setDiscountTag = function (assetId, options) { if (self.discountTagAsset) { self.removeChild(self.discountTagAsset); } options = options || {}; if (options.anchorX === undefined) options.anchorX = 0.5; if (options.anchorY === undefined) options.anchorY = 0.5; if (options.x === undefined) options.x = 0; if (options.y === undefined) options.y = 0; self.discountTagAsset = self.attachAsset(assetId, {}); }; // Set the discounted price text self.setDiscountPrice = function (discountPrice, options) { if (self.discountPriceText) { self.removeChild(self.discountPriceText); } options = options || {}; var size = options.size || 40; var fill = options.fill || "#ff0"; self.discountPriceText = new Text2('$' + discountPrice.toFixed(2), { size: size, fill: fill }); self.discountPriceText.anchor.set(0.5, 0.5); self.discountPriceText.x = options.x !== undefined ? options.x : 0; self.discountPriceText.y = options.y !== undefined ? options.y : 0; self.addChild(self.discountPriceText); }; return self; }); // Pricetag class to organize pricetag assets var Pricetag = Container.expand(function () { var self = Container.call(this); // Add a pricetag asset (default is the generic 'pricetag' shape, can be replaced with a specific asset) self.setTag = function (assetId, options) { // Remove previous tag if any if (self.tagAsset) { self.removeChild(self.tagAsset); } // Default options options = options || {}; if (options.anchorX === undefined) options.anchorX = 0.5; if (options.anchorY === undefined) options.anchorY = 0.5; if (options.x === undefined) options.x = 0; if (options.y === undefined) options.y = 0; self.tagAsset = self.attachAsset(assetId, {}); }; // Optionally, add price text self.setPrice = function (price, options) { if (self.priceText) { self.removeChild(self.priceText); } options = options || {}; var size = options.size || 40; var fill = options.fill || "#fff"; self.priceText = new Text2('$' + price.toFixed(2), { size: size, fill: fill }); self.priceText.anchor.set(0.5, 0.5); self.priceText.x = options.x !== undefined ? options.x : 0; self.priceText.y = options.y !== undefined ? options.y : 0; self.addChild(self.priceText); }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ // List of items and their price tag asset/image IDs and prices // --- Begin floating price tag and click-to-buy system --- var itemData = [{ name: 'Big Ass Coat', asset: 'bigAssCoat', price: 3.20, // Discounted price pricetagAsset: 'Pricetagbigasscoat', x: 1524, y: 2040 }, { name: 'Dookie Brown Leather Jacket', asset: 'dookieBrownLeatherJacket', price: 2.80, // Discounted price pricetagAsset: 'pricetagdookiebrownjacket', x: 2004, y: 2040 }, { name: 'Grandad\'s Coat', asset: 'granddadsClothes', price: 2.00, // Discounted price pricetagAsset: 'pricetaggrandadscoat', x: 1769, y: 2020 }, { name: 'Pink Leopard Mink', asset: 'pinkLeopardMink', price: 4.00, // Discounted price pricetagAsset: 'pricetagpinkleaperdmink', x: 300, y: 2100 }, { name: 'Plaid Button-Up Shirt', asset: 'plaidButtonUpShirt', price: 1.60, // Discounted price pricetagAsset: 'pricetagpladbuttonupshirt', x: 550, y: 1620 }, { name: 'Velour Jumpsuit', asset: 'velourJumpsuit', price: 2.40, // Discounted price pricetagAsset: 'Pricetagvelourjumpsuit', x: 100, y: 2120 }, { name: 'Built-In Onesie With Socks', asset: 'builtInOnesieWithSocks', price: 1.60, // Discounted price pricetagAsset: 'Pricetagbuiltinonesiewithsocks', discountTagAsset: 'Discountbuiltinonesiewithsocks', x: 820, y: 1600 }, { name: 'Zebra Pajamas', asset: 'flannelZebraPyjamas', price: 2.00, // Discounted price pricetagAsset: 'Pricetagzebrapyjamas', x: 750, y: 2020 }, { name: 'Fox Skin', asset: 'furFoxSkin', price: 3.60, // Discounted price pricetagAsset: 'pricetagfoxskin', x: 970, y: 2000 }, { name: 'Skeet Blanket', asset: 'skeetBlanket', price: 1.60, // Discounted price pricetagAsset: 'Pricetagskeetblanket', x: 1200, y: 2000 }, { name: 'House Slippers', asset: 'houseSlippers', price: 1.20, // Discounted price pricetagAsset: 'pricetaghouseslippers', x: 1700, y: 1320 }, { name: 'Wolf Skin Hat', asset: 'wolfSkinHat', price: 1.60, // Discounted price pricetagAsset: 'pricetagwolfskinhat', x: 520, y: 1290 }, { name: 'Gator Shoes', asset: 'gatorShoes', price: 2.40, // Discounted price pricetagAsset: 'Pricetaggatorshoes', x: 1800, y: 1430 }, { name: 'Velcro Sneakers', asset: 'velcroSneakers', price: 1.60, // Discounted price pricetagAsset: 'Pricetagvelcrosneakers', x: 1900, y: 1310 }, { name: 'Beanie', asset: 'Beanie', price: 1.20, // Discounted price pricetagAsset: 'pricetagbeanie', x: 370, y: 1150 }, { name: 'Baseball Cap', asset: 'baseballcap', price: 1.20, // Discounted price pricetagAsset: 'pricetagbaseballcap', x: 540, y: 1150 }, { name: 'Telescope', asset: 'telescope', price: 2.40, // Discounted price pricetagAsset: 'Pricetagtelescope', x: 900, y: 1030 }, { name: 'Kneeboard', asset: 'kneeBoard', price: 3.20, // Discounted price pricetagAsset: 'Pricetagkneeboard', x: 1500, y: 2200 }, { name: 'Broken Keyboard', asset: 'brokenKeyboard', price: 1.60, // Discounted price pricetagAsset: 'pricetagbrokenkeybord', x: 1770, y: 970 }]; var titlePage = game.addChild(new Container()); titlePage.addChild(LK.getAsset('titlescreen', { anchorX: 0.5, anchorY: 0.5, x: 1124, y: 1366 })); // Create a start button using the Startbutton asset var startButton = titlePage.addChild(LK.getAsset('Startbutton', { anchorX: 0.5, anchorY: 0.5, x: 1024 + 300 + 300 - 100 - 25, y: 1666 + 150 + 100 })); startButton.interactive = true; startButton.on('down', function () { // Remove the title page when the start button is clicked titlePage.destroy(); // Add the thrift background when the start button is clicked game.addChild(LK.getAsset('thriftBackground', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366 })); // Initialize inventory bar without background var inventoryBar = new Container(); inventoryBar.y += 300; // Extend inventory bar on top screen by 300 pixels game.addChild(inventoryBar); // Initialize bottom inventory bar without background var bottomInventoryBar = new Container(); game.addChild(bottomInventoryBar); // Add shopkeeper to the game screen var shopkeeper = game.addChild(LK.getAsset('shopkeeper', { anchorX: 0.5, anchorY: 0.5, x: 1224, y: 1430 })); // --- Shopkeeper dialogue logic --- var shopkeeperDialogue = null; shopkeeper.interactive = true; shopkeeper.on('down', function () { // If dialogue is already showing, do nothing if (shopkeeperDialogue) return; // Create dialogue container shopkeeperDialogue = game.addChild(new Container()); shopkeeperDialogue.x = 1024; shopkeeperDialogue.y = 900; // Add background for dialogue (bigger and transparent) var dialogueBg = shopkeeperDialogue.addChild(LK.getAsset('instructionBox', { anchorX: 0.5, anchorY: 0.5, x: 0, y: 0, scaleX: 1.2, scaleY: 1.0, alpha: 0.7 // semi-transparent })); // Add dialogue text var dialogueText = shopkeeperDialogue.addChild(new Text2("Welcome to Macklemore's Thrift Shop!\n\nCan I help you with anything?", { size: 90, fill: 0xFFFFFF, align: "center", wordWrap: true, wordWrapWidth: 1500 })); dialogueText.anchor.set(0.5, 0.5); dialogueText.x = 0; dialogueText.y = -120; // Add Yes and No buttons var buttonWidth = 350; var buttonHeight = 120; var buttonSpacing = 80; var buttonY = 180; // Yes button var yesButtonBg = shopkeeperDialogue.addChild(LK.getAsset('categoryButton', { anchorX: 0.5, anchorY: 0.5, x: -buttonWidth / 2 - buttonSpacing / 2, y: buttonY, scaleX: buttonWidth / 200, scaleY: buttonHeight / 80, alpha: 0.85 })); var yesButtonText = shopkeeperDialogue.addChild(new Text2("Yes", { size: 70, fill: "#fff" })); yesButtonText.anchor.set(0.5, 0.5); yesButtonText.x = yesButtonBg.x; yesButtonText.y = yesButtonBg.y; yesButtonBg.interactive = true; yesButtonBg.on('down', function () { // Dismiss dialogue on Yes if (shopkeeperDialogue) { shopkeeperDialogue.destroy(); shopkeeperDialogue = null; } }); // No button var noButtonBg = shopkeeperDialogue.addChild(LK.getAsset('categoryButton', { anchorX: 0.5, anchorY: 0.5, x: buttonWidth / 2 + buttonSpacing / 2, y: buttonY, scaleX: buttonWidth / 200, scaleY: buttonHeight / 80, alpha: 0.85 })); var noButtonText = shopkeeperDialogue.addChild(new Text2("No", { size: 70, fill: "#fff" })); noButtonText.anchor.set(0.5, 0.5); noButtonText.x = noButtonBg.x; noButtonText.y = noButtonBg.y; noButtonBg.interactive = true; noButtonBg.on('down', function () { // Dismiss dialogue on No if (shopkeeperDialogue) { shopkeeperDialogue.destroy(); shopkeeperDialogue = null; } // Show follow-up message shopkeeperDialogue = game.addChild(new Container()); shopkeeperDialogue.x = 1024; shopkeeperDialogue.y = 900; // Add background for dialogue (bigger and transparent) var dialogueBg = shopkeeperDialogue.addChild(LK.getAsset('instructionBox', { anchorX: 0.5, anchorY: 0.5, x: 0, y: 0, scaleX: 1.2, scaleY: 1.0, alpha: 0.7 // semi-transparent })); // Add follow-up text var dialogueText = shopkeeperDialogue.addChild(new Text2("One man's trash is another man's come up!", { size: 90, fill: 0xFFFFFF, align: "center", wordWrap: true, wordWrapWidth: 1500 })); dialogueText.anchor.set(0.5, 0.5); dialogueText.x = 0; dialogueText.y = 0; // Make the follow-up message dismissible on tap shopkeeperDialogue.interactive = true; shopkeeperDialogue.on('down', function () { if (shopkeeperDialogue) { shopkeeperDialogue.destroy(); shopkeeperDialogue = null; } }); }); // Remove old tap-to-dismiss logic (dialogue is now dismissed by Yes/No buttons only) }); // --- Begin floating price tag and click-to-buy system --- // List of items and their price tag asset/image IDs and prices var itemData = [{ name: 'Big Ass Coat', asset: 'bigAssCoat', price: 4.00, pricetagAsset: 'Pricetagbigasscoat', x: 1524, y: 2040 }, { name: 'Dookie Brown Leather Jacket', asset: 'dookieBrownLeatherJacket', price: 3.50, pricetagAsset: 'pricetagdookiebrownjacket', x: 2004, y: 2040 }, { name: 'Grandad\'s Coat', asset: 'granddadsClothes', price: 2.50, pricetagAsset: 'pricetaggrandadscoat', x: 1769, y: 2020 }, { name: 'Pink Leopard Mink', asset: 'pinkLeopardMink', price: 5.00, pricetagAsset: 'pricetagpinkleaperdmink', x: 300, y: 2100 }, { name: 'Plaid Button-Up Shirt', asset: 'plaidButtonUpShirt', price: 2.00, pricetagAsset: 'pricetagpladbuttonupshirt', x: 550, y: 1620 }, { name: 'Velour Jumpsuit', asset: 'velourJumpsuit', price: 3.00, pricetagAsset: 'Pricetagvelourjumpsuit', x: 100, y: 2120 }, { name: 'Built-In Onesie With Socks', asset: 'builtInOnesieWithSocks', price: 2.00, pricetagAsset: 'Pricetagbuiltinonesiewithsocks', discountTagAsset: 'Discountbuiltinonesiewithsocks', x: 820, y: 1600 }, { name: 'Zebra Pajamas', asset: 'flannelZebraPyjamas', price: 2.50, pricetagAsset: 'Pricetagzebrapyjamas', x: 750, y: 2020 }, { name: 'Fox Skin', asset: 'furFoxSkin', price: 4.50, pricetagAsset: 'pricetagfoxskin', x: 970, y: 2000 }, { name: 'Skeet Blanket', asset: 'skeetBlanket', price: 2.00, pricetagAsset: 'Pricetagskeetblanket', x: 1200, y: 2000 }, { name: 'House Slippers', asset: 'houseSlippers', price: 1.50, pricetagAsset: 'pricetaghouseslippers', x: 1700, y: 1320 }, { name: 'Wolf Skin Hat', asset: 'wolfSkinHat', price: 2.00, pricetagAsset: 'pricetagwolfskinhat', x: 520, y: 1290 }, { name: 'Gator Shoes', asset: 'gatorShoes', price: 3.00, pricetagAsset: 'Pricetaggatorshoes', x: 1800, y: 1430 }, { name: 'Velcro Sneakers', asset: 'velcroSneakers', price: 2.00, pricetagAsset: 'Pricetagvelcrosneakers', x: 1900, y: 1310 }, { name: 'Beanie', asset: 'Beanie', price: 1.50, pricetagAsset: 'pricetagbeanie', x: 370, y: 1150 }, { name: 'Baseball Cap', asset: 'baseballcap', price: 1.50, pricetagAsset: 'pricetagbaseballcap', x: 540, y: 1150 }, { name: 'Telescope', asset: 'telescope', price: 3.00, pricetagAsset: 'Pricetagtelescope', x: 900, y: 1030 }, { name: 'Kneeboard', asset: 'kneeBoard', price: 4.00, pricetagAsset: 'Pricetagkneeboard', x: 1500, y: 2200 }, { name: 'Broken Keyboard', asset: 'brokenKeyboard', price: 2.00, pricetagAsset: 'pricetagbrokenkeybord', x: 1770, y: 970 }]; // Store references to item containers and price tags var itemObjects = []; var priceTagObjects = []; // Helper to get a random position within the game area (not overlapping items) function getRandomTagPosition() { var margin = 120; var x = Math.random() * (2048 - 2 * margin) + margin; var y = Math.random() * (2732 - 2 * margin) + margin; return { x: x, y: y }; } // Create items (static, not interactive for buying) for (var i = 0; i < itemData.length; ++i) { var data = itemData[i]; var item = game.addChild(LK.getAsset(data.asset, { anchorX: 0.5, anchorY: 0.5, x: data.x, y: data.y })); item.itemName = data.name; item.itemPrice = data.price; item.pricetagAsset = data.pricetagAsset; itemObjects.push(item); } // Create floating price tags for (var i = 0; i < itemData.length; ++i) { var data = itemData[i]; var tag = new Pricetag(); tag.setTag(data.pricetagAsset, { anchorX: 0.5, anchorY: 0.5 }); tag.setPrice(data.price, { size: 36, fill: "#fff", x: 0, y: 60 }); var pos = getRandomTagPosition(); tag.x = pos.x; tag.y = pos.y; tag.anchorX = 0.5; tag.anchorY = 0.5; tag.itemName = data.name; tag.itemPrice = data.price; tag.pricetagAsset = data.pricetagAsset; tag.interactive = true; priceTagObjects.push(tag); game.addChild(tag); } // Animate price tags to float around randomly game.update = function () { for (var i = 0; i < priceTagObjects.length; ++i) { var tag = priceTagObjects[i]; if (!tag.floatAngle) tag.floatAngle = Math.random() * Math.PI * 2; if (!tag.floatSpeed) tag.floatSpeed = 0.5 + Math.random() * 0.5; if (!tag.floatRadius) tag.floatRadius = 30 + Math.random() * 40; if (!tag.baseX) tag.baseX = tag.x; if (!tag.baseY) tag.baseY = tag.y; tag.floatAngle += 0.01 * tag.floatSpeed; tag.x = tag.baseX + Math.cos(tag.floatAngle) * tag.floatRadius; tag.y = tag.baseY + Math.sin(tag.floatAngle) * tag.floatRadius; // Clamp tag.x and tag.y to stay within the visible game area (with margin) var margin = 60; var tagWidth = tag.width || 100; var tagHeight = tag.height || 100; // Clamp so the entire tag is visible (not just center) if (tag.x - tagWidth / 2 < margin) tag.x = margin + tagWidth / 2; if (tag.x + tagWidth / 2 > 2048 - margin) tag.x = 2048 - margin - tagWidth / 2; if (tag.y - tagHeight / 2 < margin) tag.y = margin + tagHeight / 2; if (tag.y + tagHeight / 2 > 2732 - margin) tag.y = 2732 - margin - tagHeight / 2; } }; // --- Discount price tag swap logic --- // Map of itemName to discount assetId (if available) var discountTagMap = { "Big Ass Coat": "discountbigasscoat", "Dookie Brown Leather Jacket": "discountleatherjacket", "Grandad's Coat": "discountgrandadscoat", "Pink Leopard Mink": "discountpinkleoperdmink", "Plaid Button-Up Shirt": "discountplaidbuttonupshirt", "Velour Jumpsuit": "discountvelourjumpsuit", "Built-In Onesie With Socks": "Discountbuiltinonesiewithsocks", "Zebra Pajamas": "discountzebrapajamas", "Fox Skin": "discountfoxskin", "Skeet Blanket": "discountskeetblanket", "House Slippers": "discounthouseslippers", "Wolf Skin Hat": "discountwolfskinhat", "Gator Shoes": "Discountgatorshoes", "Velcro Sneakers": "Discountvelcrosneakers", "Beanie": "Discountbeanie", "Baseball Cap": "Discountbaseballhat", "Telescope": "Discounttelescope", "Kneeboard": "Discountkneeboard", "Broken Keyboard": "Discountbrokenkeyboard" }; // Track which tags are currently discounted var discountedTagIndices = []; // Helper to swap a price tag to its discount version function swapToDiscount(tag, itemName) { var discountAsset = discountTagMap[itemName]; if (discountAsset) { tag.setTag(discountAsset, { anchorX: 0.5, anchorY: 0.5 }); // Find the discounted price from the original itemData array var discountPrice = null; for (var i = 0; i < itemData.length; ++i) { if (itemData[i].name === itemName) { // Use the lower of the two prices if both are present, or just the original price if not if (typeof itemData[i].price === "number" && itemData[i].price < tag.itemPrice) { discountPrice = itemData[i].price; } else { discountPrice = tag.itemPrice * 0.7; // Default: 30% off if not specified } break; } } if (discountPrice === null) discountPrice = tag.itemPrice * 0.7; tag.setPrice(discountPrice, { size: 36, fill: "#ff0", x: 0, y: 60 }); tag.itemPrice = discountPrice; tag.isDiscounted = true; } } // Helper to swap a price tag back to its original version function swapToOriginal(tag, itemName) { // Find the original asset and price from itemData for (var i = 0; i < itemData.length; ++i) { if (itemData[i].name === itemName) { tag.setTag(itemData[i].pricetagAsset, { anchorX: 0.5, anchorY: 0.5 }); tag.setPrice(itemData[i].price, { size: 36, fill: "#fff", x: 0, y: 60 }); tag.itemPrice = itemData[i].price; tag.isDiscounted = false; break; } } } // Timer to randomly swap price tags with discount assets every 10 seconds LK.setInterval(function () { // First, revert any currently discounted tags to original for (var i = 0; i < discountedTagIndices.length; ++i) { var idx = discountedTagIndices[i]; if (priceTagObjects[idx]) { swapToOriginal(priceTagObjects[idx], priceTagObjects[idx].itemName); } } discountedTagIndices = []; // Pick a random number of tags to discount (at least 1, up to 1/3 of tags) var numToDiscount = 1 + Math.floor(Math.random() * Math.max(1, Math.floor(priceTagObjects.length / 3))); var availableIndices = []; for (var i = 0; i < priceTagObjects.length; ++i) { // Only allow discount if a discount asset exists for this item if (discountTagMap[priceTagObjects[i].itemName]) { availableIndices.push(i); } } // Shuffle availableIndices for (var i = availableIndices.length - 1; i > 0; --i) { var j = Math.floor(Math.random() * (i + 1)); var temp = availableIndices[i]; availableIndices[i] = availableIndices[j]; availableIndices[j] = temp; } // Apply discount to the first numToDiscount tags for (var i = 0; i < numToDiscount && i < availableIndices.length; ++i) { var idx = availableIndices[i]; swapToDiscount(priceTagObjects[idx], priceTagObjects[idx].itemName); discountedTagIndices.push(idx); } }, 10000); // --- Click-to-buy logic --- // Track selection state var selectedTag = null; var selectedItem = null; // Track purchased items globally var purchasedItems = []; // Helper: highlight a tag or item function highlight(obj, on) { if (!obj) return; if (on) { obj.alpha = 0.7; } else { obj.alpha = 1.0; } } // Price tag click handler function onTagDown(tag) { return function () { // If already selected, deselect if (selectedTag === tag) { highlight(selectedTag, false); selectedTag = null; return; } // If an item is already selected, try to buy if (selectedItem && selectedItem.itemName === tag.itemName) { // Calculate price - apply 20% discount if tag is discounted var finalPrice = tag.itemPrice; if (tag.isDiscounted) { // Find original price from itemData var originalPrice = null; for (var i = 0; i < itemData.length; ++i) { if (itemData[i].name === tag.itemName) { originalPrice = itemData[i].price; break; } } if (originalPrice) { finalPrice = originalPrice * 0.8; // 20% off original price } } // Attempt to buy if (shoppingCart.addItem(tag.itemName, finalPrice)) { budgetText.setText('$' + shoppingCart.getBudget()); // Track purchased item if (purchasedItems.indexOf(tag.itemName) === -1) { purchasedItems.push(tag.itemName); } // Update shopping list items immediately updateShoppingListItems(); // Remove both tag and item from scene tag.destroy(); selectedItem.destroy(); // Add to inventory bar var targetBar = inventoryBar.children.length < 10 ? inventoryBar : bottomInventoryBar; var itemSlot = targetBar.addChild(LK.getAsset('itemSlot', { anchorX: 0.5, anchorY: 0.5, x: targetBar.children.length * 180 + 90, y: 125 })); itemSlot.addChild(LK.getAsset(selectedItem.assetId || tag.assetId || tag.itemName, { anchorX: 0.5, anchorY: 0.5, x: 0, y: 0, scaleX: 0.5, scaleY: 0.5 })); // Cross off item in shopping list if enlargedShoppingList is open if (typeof enlargedShoppingList !== "undefined" && enlargedShoppingList && shoppingListItems && shoppingListItems.length > 0) { // Rebuild the shopping list UI to reflect purchased items for (var i = 0; i < shoppingListItems.length; i++) { var isPurchased = purchasedItems.indexOf(shoppingListItems[i].name) !== -1; for (var j = 0; j < enlargedShoppingList.children.length; j++) { var child = enlargedShoppingList.children[j]; if (child && child.text && child.text.indexOf(shoppingListItems[i].name) !== -1) { if (isPurchased) { child.setText('• ' + shoppingListItems[i].name + ' [collected]'); child.style = Object.assign({}, child.style, { fill: "#888", fontStyle: "italic" }); } else { child.setText('• ' + shoppingListItems[i].name); child.style = Object.assign({}, child.style, { fill: "#000", fontStyle: "normal" }); } } } // Add checkmark if purchased and not already present if (isPurchased) { var alreadyChecked = false; for (var k = 0; k < enlargedShoppingList.children.length; k++) { var c = enlargedShoppingList.children[k]; if (c && c.anchorX === 0.5 && c.anchorY === 0.5 && c.x === 400 && c.y === -100 + i * 80) { alreadyChecked = true; break; } } if (!alreadyChecked) { enlargedShoppingList.addChild(LK.getAsset('checkmark', { anchorX: 0.5, anchorY: 0.5, x: 400, y: -100 + i * 80, scaleX: 0.8, scaleY: 0.8 })); } } } } } highlight(selectedTag, false); highlight(selectedItem, false); selectedTag = null; selectedItem = null; return; } // Otherwise, select this tag if (selectedTag) highlight(selectedTag, false); selectedTag = tag; highlight(selectedTag, true); }; } // Item click handler function onItemDown(item) { return function () { // If already selected, deselect if (selectedItem === item) { highlight(selectedItem, false); selectedItem = null; return; } // If a tag is already selected, try to buy if (selectedTag && selectedTag.itemName === item.itemName) { // Calculate price - apply 20% discount if tag is discounted var finalPrice = selectedTag.itemPrice; if (selectedTag.isDiscounted) { // Find original price from itemData var originalPrice = null; for (var i = 0; i < itemData.length; ++i) { if (itemData[i].name === selectedTag.itemName) { originalPrice = itemData[i].price; break; } } if (originalPrice) { finalPrice = originalPrice * 0.8; // 20% off original price } } // Attempt to buy if (shoppingCart.addItem(item.itemName, finalPrice)) { budgetText.setText('$' + shoppingCart.getBudget()); // Track purchased item if (purchasedItems.indexOf(item.itemName) === -1) { purchasedItems.push(item.itemName); } // Update shopping list items immediately updateShoppingListItems(); // Remove both tag and item from scene selectedTag.destroy(); item.destroy(); // Add to inventory bar var targetBar = inventoryBar.children.length < 10 ? inventoryBar : bottomInventoryBar; var itemSlot = targetBar.addChild(LK.getAsset('itemSlot', { anchorX: 0.5, anchorY: 0.5, x: targetBar.children.length * 180 + 90, y: 125 })); itemSlot.addChild(LK.getAsset(item.assetId || selectedTag.assetId || item.itemName, { anchorX: 0.5, anchorY: 0.5, x: 0, y: 0, scaleX: 0.5, scaleY: 0.5 })); // Cross off item in shopping list if enlargedShoppingList is open if (typeof enlargedShoppingList !== "undefined" && enlargedShoppingList && shoppingListItems && shoppingListItems.length > 0) { // Rebuild the shopping list UI to reflect purchased items for (var i = 0; i < shoppingListItems.length; i++) { var isPurchased = purchasedItems.indexOf(shoppingListItems[i].name) !== -1; for (var j = 0; j < enlargedShoppingList.children.length; j++) { var child = enlargedShoppingList.children[j]; if (child && child.text && child.text.indexOf(shoppingListItems[i].name) !== -1) { if (isPurchased) { child.setText('• ' + shoppingListItems[i].name + ' [collected]'); child.style = Object.assign({}, child.style, { fill: "#888", fontStyle: "italic" }); } else { child.setText('• ' + shoppingListItems[i].name); child.style = Object.assign({}, child.style, { fill: "#000", fontStyle: "normal" }); } } } // Add checkmark if purchased and not already present if (isPurchased) { var alreadyChecked = false; for (var k = 0; k < enlargedShoppingList.children.length; k++) { var c = enlargedShoppingList.children[k]; if (c && c.anchorX === 0.5 && c.anchorY === 0.5 && c.x === 400 && c.y === -100 + i * 80) { alreadyChecked = true; break; } } if (!alreadyChecked) { enlargedShoppingList.addChild(LK.getAsset('checkmark', { anchorX: 0.5, anchorY: 0.5, x: 400, y: -100 + i * 80, scaleX: 0.8, scaleY: 0.8 })); } } } } } highlight(selectedTag, false); highlight(selectedItem, false); selectedTag = null; selectedItem = null; return; } // Otherwise, select this item if (selectedItem) highlight(selectedItem, false); selectedItem = item; highlight(selectedItem, true); }; } // Attach click handlers for (var i = 0; i < priceTagObjects.length; ++i) { var tag = priceTagObjects[i]; tag.on('down', onTagDown(tag)); } for (var i = 0; i < itemObjects.length; ++i) { var item = itemObjects[i]; item.interactive = true; item.assetId = itemData[i].asset; item.on('down', onItemDown(item)); } // --- End floating price tag and click-to-buy system --- // Add instruction box with black background to the middle of the screen var instructionBox = game.addChild(LK.getAsset('instructionBox', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366, scaleX: 1.5, scaleY: 1.5 })); var shoppingCart = new ShoppingCart(20); // Initialize shoppingCart with $20 in budget var budgetText = new Text2('$' + shoppingCart.getBudget(), { size: 50, fill: 0xFFFFFF }); budgetText.anchor.set(0.5, 0.5); budgetText.zIndex = 2; // Increase zIndex to place text in front of shopping cart var instructionText = new Text2('Welcome to Poppin\' Tags: A Thrift Shop Adventure.', { size: 50, fill: 0xFFFFFF }); instructionText.anchor.set(0.5, 0.5); instructionText.zIndex = 2; // Increase zIndex to place text in front of instruction box instructionBox.addChild(instructionText); instructionBox.interactive = true; var clickCount = 0; instructionBox.on('down', function () { clickCount++; if (clickCount === 1) { instructionText.setText('You have $20 in your pocket and are huntin\' for a come-up.'); } else if (clickCount === 2) { instructionText.setText('Try and buy all items on your shopping list \n as cheap as you can. This is gonna be AWESOME!!!'); } else if (clickCount === 3) { // Click handler for shopping list var _updateShoppingListItems = function _updateShoppingListItems() { if (typeof enlargedShoppingList !== "undefined" && enlargedShoppingList && shoppingListItems && shoppingListItems.length > 0) { // Rebuild the shopping list UI to reflect purchased items for (var i = 0; i < shoppingListItems.length; i++) { var isPurchased = purchasedItems.indexOf(shoppingListItems[i].name) !== -1; for (var j = 0; j < enlargedShoppingList.children.length; j++) { var child = enlargedShoppingList.children[j]; if (child && child.text && child.text.indexOf(shoppingListItems[i].name) !== -1) { if (isPurchased) { child.setText('• ' + shoppingListItems[i].name + ' [collected]'); child.style = Object.assign({}, child.style, { fill: "#888", fontStyle: "italic" }); } else { child.setText('• ' + shoppingListItems[i].name); child.style = Object.assign({}, child.style, { fill: "#000", fontStyle: "normal" }); } } } // Add checkmark if purchased and not already present if (isPurchased) { var alreadyChecked = false; for (var k = 0; k < enlargedShoppingList.children.length; k++) { var c = enlargedShoppingList.children[k]; if (c && c.anchorX === 0.5 && c.anchorY === 0.5 && c.x === 400 && c.y === -100 + i * 80) { alreadyChecked = true; break; } } if (!alreadyChecked) { enlargedShoppingList.addChild(LK.getAsset('checkmark', { anchorX: 0.5, anchorY: 0.5, x: 400, y: -100 + i * 80, scaleX: 0.8, scaleY: 0.8 })); } } } } for (var i = 0; i < shoppingListItems.length; i++) { var item = shoppingListItems[i]; item.isPurchased = purchasedItems.indexOf(item.name) !== -1; } }; // Click handler for shopping list instructionBox.destroy(); shoppingCart = new ShoppingCart(20); // Create a shopping cart with $20 in budget var shoppingCartDisplay = game.addChild(LK.getAsset('moneyContainer', { anchorX: 0.5, anchorY: 0.5, x: 200, y: 300, scaleX: 1.5, scaleY: 1.5 })); budgetText = new Text2('$' + shoppingCart.getBudget(), { size: 50, fill: 0xFFFFFF }); budgetText.anchor.set(0.5, 0.5); budgetText.zIndex = 2; // Increase zIndex to place text in front of shopping cart shoppingCartDisplay.addChild(budgetText); // Add shopping list to top left corner (avoiding the menu icon area) var shoppingListDisplay = game.addChild(LK.getAsset('Shoppinglist', { anchorX: 0, anchorY: 0, x: 0, // Position away from top-left menu icon y: 370, scaleX: 0.6, scaleY: 0.6 })); // Make shopping list interactive shoppingListDisplay.interactive = true; // Create enlarged shopping list (initially hidden) var enlargedShoppingList = null; // Track purchased items var purchasedItems = []; // Store shopping list items globally so they persist var shoppingListItems = []; shoppingListDisplay.on('down', function () { if (enlargedShoppingList) { // If already showing, hide it enlargedShoppingList.destroy(); enlargedShoppingList = null; } else { // Create enlarged shopping list container enlargedShoppingList = game.addChild(new Container()); enlargedShoppingList.x = 1024; enlargedShoppingList.y = 1366; // Add background for enlarged list var listBackground = enlargedShoppingList.addChild(LK.getAsset('listBackground', { anchorX: 0.5, anchorY: 0.5, x: 0, y: 0, scaleX: 1.2, scaleY: 2.5 })); // Initialize shopping list items if not already done if (shoppingListItems.length === 0) { var usedIndices = []; while (shoppingListItems.length < 5 && usedIndices.length < itemData.length) { var randomIndex = Math.floor(Math.random() * itemData.length); if (usedIndices.indexOf(randomIndex) === -1) { shoppingListItems.push(itemData[randomIndex]); usedIndices.push(randomIndex); } } } // Add title text var titleText = enlargedShoppingList.addChild(new Text2('Shopping List', { size: 60, fill: 0x000000 })); titleText.anchor.set(0.5, 0.5); titleText.x = 0; titleText.y = -200; // Add items to the list with checkmarks for purchased items for (var i = 0; i < shoppingListItems.length; i++) { var isPurchased = purchasedItems.indexOf(shoppingListItems[i].name) !== -1; var itemName = shoppingListItems[i].name; var displayText = isPurchased ? '• ' + itemName + ' [collected]' : '• ' + itemName; var textColor = isPurchased ? "#888" : 0x000000; var itemText = enlargedShoppingList.addChild(new Text2(displayText, { size: 45, fill: textColor, fontStyle: isPurchased ? "italic" : "normal" })); itemText.anchor.set(0.5, 0.5); itemText.x = 0; itemText.y = -100 + i * 80; // Add green checkmark if item is purchased if (isPurchased) { var checkmark = enlargedShoppingList.addChild(LK.getAsset('checkmark', { anchorX: 0.5, anchorY: 0.5, x: 400, y: -100 + i * 80, scaleX: 0.8, scaleY: 0.8 })); } } // Make enlarged list clickable to close enlargedShoppingList.interactive = true; enlargedShoppingList.on('down', function () { enlargedShoppingList.destroy(); enlargedShoppingList = null; }); } }); } }); }); var ShoppingCart = /*#__PURE__*/function () { function ShoppingCart(initialBudget) { _classCallCheck(this, ShoppingCart); this.budget = Math.round(initialBudget * 100) / 100; // Round to 2 decimal places this.items = []; } return _createClass(ShoppingCart, [{ key: "addItem", value: function addItem(item, price) { var roundedPrice = Math.round(price * 100) / 100; // Round price to 2 decimal places if (this.budget >= roundedPrice) { this.items.push(item); this.budget = Math.round((this.budget - roundedPrice) * 100) / 100; // Prevent floating-point errors if (this.items.length === 17) { LK.showYouWin(); // Trigger win condition when all 17 items are collected } return true; } return false; } }, { key: "removeItem", value: function removeItem(item, price) { var index = this.items.indexOf(item); if (index > -1) { this.items.splice(index, 1); var roundedPrice = Math.round(price * 100) / 100; // Round price to 2 decimal places this.budget = Math.round((this.budget + roundedPrice) * 100) / 100; // Prevent floating-point errors } } }, { key: "getBudget", value: function getBudget() { return Math.round(this.budget * 100) / 100; // Always return properly rounded budget } }, { key: "getItems", value: function getItems() { return this.items; } }]); }(); function _createClass(Constructor, protoProps, staticProps) { if (protoProps) { protoProps.forEach(function (prop) { Object.defineProperty(Constructor.prototype, prop.key, prop); }); } if (staticProps) { staticProps.forEach(function (prop) { Object.defineProperty(Constructor, prop.key, prop); }); } return Constructor; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
===================================================================
--- original.js
+++ change.js
@@ -1006,10 +1006,10 @@
instructionText.setText('You have $20 in your pocket and are huntin\' for a come-up.');
} else if (clickCount === 2) {
instructionText.setText('Try and buy all items on your shopping list \n as cheap as you can. This is gonna be AWESOME!!!');
} else if (clickCount === 3) {
- // Function to update shopping list items with purchased status
- var updateShoppingListItems = function updateShoppingListItems() {
+ // Click handler for shopping list
+ var _updateShoppingListItems = function _updateShoppingListItems() {
if (typeof enlargedShoppingList !== "undefined" && enlargedShoppingList && shoppingListItems && shoppingListItems.length > 0) {
// Rebuild the shopping list UI to reflect purchased items
for (var i = 0; i < shoppingListItems.length; i++) {
var isPurchased = purchasedItems.indexOf(shoppingListItems[i].name) !== -1;
@@ -1057,10 +1057,9 @@
for (var i = 0; i < shoppingListItems.length; i++) {
var item = shoppingListItems[i];
item.isPurchased = purchasedItems.indexOf(item.name) !== -1;
}
- };
- // Click handler for shopping list
+ }; // Click handler for shopping list
instructionBox.destroy();
shoppingCart = new ShoppingCart(20); // Create a shopping cart with $20 in budget
var shoppingCartDisplay = game.addChild(LK.getAsset('moneyContainer', {
anchorX: 0.5,
onesie with socks. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
big coat. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
brown leather jacket. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
flannel zebra pyjamas. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
fur fox skin. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Pink leopard mink coat. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Wolf skin hat. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Velour jumpsuit. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Telescope. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Dirty blanket. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Velcro sneakers. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Plaid button up shirt. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
music keyboard. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Shopping list that says Big ass coat, Broken keyboard, skeet blanket, pink leopard mink, built-in onesie with the socks. In-Game asset. 2d. High contrast. No shadows
Price tag that says big ass coat $4.00. In-Game asset. 2d. High contrast. No shadows
Price tag that says Kneeboard $4.00. In-Game asset. 2d. High contrast. No shadows
police tag that says Broken Keyboard for $2. In-Game asset. 2d. High contrast. No shadows
Price tag that says Telescope $3.00. In-Game asset. 2d. High contrast. No shadows
price tag that's says Dookie Brown Leather Jacket $3.50. In-Game asset. 2d. High contrast. No shadows
price tag that says pink leopard mink $5. In-Game asset. 2d. High contrast. No shadows
price tag that says plaid button up shirt $2. In-Game asset. 2d. High contrast. No shadows
Price tag that says Gator shoes $3.00. In-Game asset. 2d. High contrast. No shadows
price tag that says fox skin $4.50. In-Game asset. 2d. High contrast. No shadows
Price tag that says Velcro sneakers $2.00. In-Game asset. 2d. High contrast. No shadows
price tag that says house slippers $1.50. In-Game asset. 2d. High contrast. No shadows
Price tag that says velour jumpsuit $3.00. In-Game asset. 2d. High contrast. No shadows
price tag that says wolf skin hat $2. In-Game asset. 2d. High contrast. No shadows
Price tag that says skeet blanket $2.00. In-Game asset. 2d. High contrast. No shadows
Price tag that says Zebra Pyjamas $2.50. In-Game asset. 2d. High contrast. No shadows
Green Discount price tag that says Big ass coat $2.40. In-Game asset. 2d. High contrast. No shadows
green price tag that says discount Dookie Brown Leather Jacket $2.80. In-Game asset. 2d. High contrast. No shadows
Green price tag that says discount kneeboard $3.20. In-Game asset. 2d. High contrast. No shadows
green price tag that says discount plaid button up shirt $1.60. In-Game asset. 2d. High contrast. No shadows
green price tag that says discount zebra pajamas $2. In-Game asset. 2d. High contrast. No shadows
Green pricetag that says discount Telescope $2.40. In-Game asset. 2d. High contrast. No shadows
green price tag that says discount velour jumpsuit $2.40. In-Game asset. 2d. High contrast. No shadows
Green pricetag that says discount Velcro sneakers $1.60. In-Game asset. 2d. High contrast. No shadows
green price tag that says discount house slippers $1.20. In-Game asset. 2d. High contrast. No shadows
green price tag that says discount wolf skin hat $1.60. In-Game asset. 2d. High contrast. No shadows
Green pricetag that says discount gator shoes $2.40. In-Game asset. 2d. High contrast. No shadows
Green pricetag that says discount built in onesie with socks $1.60. In-Game asset. 2d. High contrast. No shadows
Price tag that says built-in onesie with socks $2.00. In-Game asset. 2d. High contrast. No shadows
green price tag that says discount pink leopard mink 99 cents! In-Game asset. 2d. High contrast. No shadows
green price tag that says discount fox skin $2 In-Game asset. 2d. High contrast. No shadows
green price tag that says discount skeet blanket $0.50 In-Game asset. 2d. High contrast. No shadows
Green price tag that says discount broken keyboard $1 In-Game asset. 2d. High contrast. No shadows
Make picture transparent
Make picture transparent
Make picture transparent
Make picture transparent
Make picture transparent
Add number 5 to painted area
Sign that says play the notes in right order to start the game. In-Game asset. 2d. High contrast. No shadows
portrait banner, high definition, for a game titled "Poppin' Tags: A Thrift Shop Trubute"
How to play button. In-Game asset. 2d. High contrast. No shadows
1
Sound effect
2
Sound effect
3
Sound effect
4
Sound effect
5
Sound effect
6
Sound effect
7
Sound effect
8
Sound effect
Item1
Sound effect
Instrumental
Music
instrumentalMusic
Music
Heymacklemore
Sound effect
Cash
Sound effect
Leopardmink
Sound effect
Gatorshoes
Sound effect
Houseslippers
Sound effect
Dookiebrown
Sound effect
Velcros
Sound effect
Grandmascoat
Sound effect
Bigasscoat
Sound effect
Kneeboard
Sound effect
Brokenkeyboard
Sound effect
Skeetblanket
Sound effect
Foxfur
Sound effect
Builtinonesie
Sound effect
Plaidshirt
Sound effect
Telescope
Sound effect
Velourjumpsuit
Sound effect
Wolfhat
Sound effect
Zebrajamies
Sound effect
Poptags
Sound effect
Probsshoulda
Sound effect