User prompt
1. Move Journal Button to align with TEA BASES and HERBS, and match size Change the journal button’s coordinates and dimensions to align horizontally with them: x: startX + (buttonWidth + buttonSpacing) * 2, // place it after HERBS y: 2050, width: 350, height: 120, Also adjust the journalButtonText: journalButtonText.x = startX + (buttonWidth + buttonSpacing) * 2; journalButtonText.y = 2050; 2. Rename "CRAFT POTION" button to "SERVE" everywhere Fixes required: Change label: var craftButtonText = new Text2('SERVE', { ... }); Rename variable craftButton and craftButtonText to serveButton and serveButtonText for clarity. Update the handler: serveButton.down = function (x, y, obj) { craftPotion(); }; Also, check for all other references to craftButton (like attachAsset, .down, .addChild) and update them to serveButton.
User prompt
move the thermometer graphic downward vertically by 300 pixels
User prompt
move the text hint box and hint text down vertically by 250 pixels
User prompt
Please fix the bug: 'can't access property "down", craftButton is undefined' in or related to this line: 'craftButton.down = function (x, y, obj) {' Line Number: 1112
User prompt
here’s a cleaned up version of your CRAFT POTION button block. I moved it after the counter code so it always renders on top, and I kept the y=2650 placement you originally wanted: // --- COUNTER LAYER --- // var behindCounter = game.attachAsset('behind_Counter', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 2100, width: 2048, height: 1400 // make it fill the bottom half }); var counter = game.attachAsset('counterTop', { anchorX: 0.5, anchorY: 1, x: 1024, y: 1850 }); // --- CRAFT POTION BUTTON (placed after counter so it's visible) --- // var craftButton = game.attachAsset('craftButton', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 2650, width: 450, height: 120, tint: 0x661caa // optional: tint to make sure it's visible }); var craftButtonText = new Text2('CRAFT POTION', { size: 48, fill: 0xFFFFFF }); craftButtonText.anchor.set(0.5, 0.5); craftButtonText.x = 1024; craftButtonText.y = 2650; game.addChild(craftButtonText); // Click handler craftButton.down = function (x, y, obj) { craftPotion(); }; This way: The counter graphics are drawn first. Then the craft button is drawn above them. The button will no longer be hidden behind behind_Counter.
User prompt
🔨 Step 1 — Remove reputation deduction on drop if (heldItem.isMenuPurchase) { if (distance < 200 && cauldron.ingredients.length < 3) { cauldron.ingredients.push(heldItem.name); updateCauldronDisplay(); game.removeChild(heldItem); } } 🔨 Step 2 — Make herbs/bases infinite Currently, when you drag from the menu, the herb gets removed from the game. That’s why you needed a cost system. Instead, let the menu re-spawn herbs infinitely. ✅ Fix = clone the item instead of moving the original. heldItem = obj.clone(); // make a new draggable copy And don’t call game.removeChild(heldItem) at the end — just let the copy vanish into the cauldron while the menu stays. 🔨 Step 3 — Summary of changes Delete reputation -= heldItem.cost; anywhere in your code. Never remove the menu herbs. Dragging should spawn a new copy each time. Reputation is now only adjusted in craftPotion() (success/failure). Herbs and bases are infinite, since the menu items always stay visible.
User prompt
✅ Fix Use the new array-based check we set up earlier. Only end the patient interaction after a tea attempt (so they can retry until they cure or reputation is drained). Here’s a corrected craftPotion(): function craftPotion() { if (!currentPatient || isProcessingTreatment || cauldron.ingredients.length !== 3) { return; } isProcessingTreatment = true; var baseName = cauldron.ingredients[0]; var herb1Name = cauldron.ingredients[1]; var herb2Name = cauldron.ingredients[2]; var brewedTea = brewTea(baseName, herb1Name, herb2Name); var repChange = 0; if (brewedTea) { var illness = ILLNESS_DATA[currentPatient]; if (illness) { var required = illness.element_imbalance; // always an array var brewed = brewedTea.elements; // ✅ NEW: check arrays var cureOK = required.every(e => brewed.includes(e)); if (cureOK) { repChange = illness.gold_reward; tween(patient, { tint: 0x90EE90 }, { duration: 1000 }); LK.getSound('success').play(); // ✅ patient is cured → clear them currentPatient = null; patientStatusText.setText("Patient cured! +" + repChange + " reputation"); treatmentTimer = LK.ticks + 120; // delay before next patient } else { // ❌ Wrong tea → penalty, but patient stays repChange = -20; tween(patient, { tint: 0xFF6666 }, { duration: 1000 }); LK.getSound('failure').play(); patientStatusText.setText("That didn't work... -" + Math.abs(repChange) + " reputation"); isProcessingTreatment = false; // allow retry } } } else { // Invalid tea combination (not a real brew) repChange = -10; // smaller penalty tween(patient, { tint: 0xFF6666 }, { duration: 1000 }); LK.getSound('failure').play(); patientStatusText.setText("Invalid brew! -" + Math.abs(repChange) + " reputation"); isProcessingTreatment = false; // allow retry } reputation += repChange; currentScore += Math.max(0, repChange); reputationText.setText('Reputation: ' + reputation); cauldron.ingredients = []; updateCauldronDisplay(); } 🔎 Why this works Wrong teas subtract rep but don’t kick the patient out → player can retry. Game only ends when reputation <= 0 (already in your game.update). Invalid teas (nonsense combos) have a smaller penalty than wrong-but-valid teas. Only a successful cure clears the patient and spawns a new one.
User prompt
making every illness use an array keeps your data consistent and makes the cure logic super clean. Here’s how to set it up: Step 1 — Update ILLNESS_DATA Convert all single-element strings to arrays with one entry. For example: "hollowshiver": { id: "hollowshiver", name: "Hollowshiver", ... element_imbalance: ["fire"], // was "fire" symptom_color: 0x4444FF, gold_reward: 120 }, "unmovable_phlegm": { id: "unmovable_phlegm", name: "Unmovable Phlegm", ... element_imbalance: ["fire", "wind"], // hybrid cure symptom_color: 0xFFCC44, gold_reward: 125 } So every illness uses an array, even if it only has one element. Step 2 — Update brewTea Now teas always return arrays of elements: function brewTea(baseName, herb1Name, herb2Name) { if (!teaBases[baseName]) return null; var base = teaBases[baseName]; var herb1 = HERB_DATA[herb1Name]; var herb2 = HERB_DATA[herb2Name]; if (!herb1 || !herb2 || herb1Name === herb2Name) return null; // Gather all elements in the mix var elements = [base.element, herb1.element, herb2.element]; // Pure tea (all the same element) if (herb1.element === herb2.element && herb1.element === base.element) { return { name: base.name + " + " + herb1Name + " + " + herb2Name, elements: [base.element] }; } // Hybrid tea (mixed elements) var uniqueElements = [...new Set(elements)]; return { name: base.name + " + " + herb1Name + " + " + herb2Name, elements: uniqueElements }; } Step 3 — Update craftPotion cure check Now it only needs one rule: the tea must contain all required elements. if (illness) { var required = illness.element_imbalance; // always an array now var brewed = brewedTea.elements; // Check if brewed tea covers all required elements var cureOK = required.every(e => brewed.includes(e)); if (cureOK) { repChange = illness.gold_reward; tween(patient, { tint: 0x90EE90 }, { duration: 1000 }); LK.getSound('success').play(); } else { repChange = -20; tween(patient, { tint: 0xFF6666 }, { duration: 1000 }); LK.getSound('failure').play(); } } Result A pure fire illness like Hollowshiver has ["fire"] → any tea with fire covers it. A hybrid illness like Unmovable Phlegm has ["fire","wind"] → only a tea with both elements works. Easy to extend later (e.g. ["earth","fire","wind"]).
User prompt
✅ Fix: Add the hint box and text after you add the patient, or explicitly change its zIndex if supported: // Add patient first var patient = game.addChild(new Patient()); patient.x = 1024; patient.y = 500; // Then add hint box + text so they are above patient var hintBox = game.attachAsset('craftButton', { ... }); var patientStatusText = new Text2(...); game.addChild(patientStatusText); 2.fix Hint text not showing / always blank by add a hint property to each illness, if (illness) { var symptom = illness.symptoms[Math.floor(Math.random() * illness.symptoms.length)]; patientStatusText.setText(symptom); } |
User prompt
remove Chilling Mist and Stone Sickness, and replace the entire illness list with your new, official set. That means we’ll rebuild ILLNESS_DATA so it matches the details you provided — including name, description (journal text), temperature, causes, cures, and hint text. Here’s how your ILLNESS_DATA block should look after updating: var ILLNESS_DATA = { "hollowshiver": { id: "hollowshiver", name: "Hollowshiver", description: "A creeping cold that settles in the bones, no matter how many blankets are piled on. Common after wandering too long near mushroom circles or in moonlit glades. Warming the body will help.", temperature: "Cold", causes: ["Getting too cold", "Too many water herbs", "Swimming in cold waters"], cure: "Brew fire-aligned broth with Kitty Mitten, Sommeral, or Brindleroot", symptoms: [ "I took a swim, but the water was so cold...", "I feel a cold damp in my bones..." ], element_imbalance: "fire", symptom_color: 0x4444FF, gold_reward: 120 }, "driftlimb": { id: "driftlimb", name: "Driftlimb", description: "A peculiar tiredness that makes even teacups feel too heavy. Believed to come from skipping too many meals or carrying burdens not your own. A wind-based approach will help uplift the body.", temperature: "Normal", causes: ["Working too hard", "Being ill for a long time"], cure: "Brew wind-aligned tea with Fuzzy Peeper, Demeter’s Arrow or Pipeweed", symptoms: [ "I’ve been working so hard lately, my arms feel so heavy...", "I feel like I have no muscles in my legs..." ], element_imbalance: "wind", symptom_color: 0xFFFF44, gold_reward: 130 }, "greyheart": { id: "greyheart", name: "Greyheart", description: "A sadness with no clear shape. Often spoken of in hushed tones as the malaise of quiet souls or lonely seasons. To heal Greyheart, one must nourish the body, warm the limbs, and lift the spirit at the same time.", temperature: "Normal", causes: ["Tragedy of the heart", "Ennui"], cure: "Earthy Tea Base with Kitty Mitten and Demeter’s Arrow", symptoms: [ "I feel so low. As if I'm haunted somehow by the troubles of my past...", "This weather has been hard for me... I feel so... I don't know.", "I feel as if I've been flattened or hollowed out. Something is missing and I don't know what..." ], element_imbalance: "earth", symptom_color: 0x888888, gold_reward: 140 }, "the_wilt": { id: "the_wilt", name: "The Wilt", description: "When one's spirit feels dim and steps feel cloud-soft. A common complaint after long travels or encounters with annoying relatives. The wilt requires a wind based tea.", temperature: "Normal", causes: ["Not sleeping enough", "Over excitement"], cure: "Uplifting Tea Base with Demeter’s Arrow and Fuzzy Peeper", symptoms: [ "I’m so tired no matter how much I sleep." ], element_imbalance: "wind", symptom_color: 0xAAAAFF, gold_reward: 110 }, "wretching_waters": { id: "wretching_waters", name: "Wretching Waters", description: "A twisting in the gut, often after eating something wild or questionably cooked. One needs a strong, nourishing broth.", temperature: "Hot", causes: ["Rotten food", "Ingesting poisonous fungi"], cure: "Earthy Tea Base with Sheep’s Bane and Common Snupe", symptoms: [ "I’ve been in the bathroom all morning!", "My stomach.... uurrgghhh..." ], element_imbalance: "earth", symptom_color: 0x44FF44, gold_reward: 150 }, "unmovable_phlegm": { id: "unmovable_phlegm", name: "Unmovable Phlegm", description: "More irritating than dangerous, this thick muck often makes sleep difficult. A combination of heat and wind is necessary to clear it.", temperature: "Normal", causes: ["Pollen exposure", "Allergies to animals"], cure: "Spicy Tea Base with Demeter’s Arrow and Fuzzy Peeper", symptoms: [ "I can’t stop sneezing since I went to that petting zoo!", "I feel like I can’t breathe, especially at night.", "This dust in the air is making me feel awful!" ], element_imbalance: "fire", // fire + wind needed symptom_color: 0xFFCC44, gold_reward: 125 }, "dagger_hex": { id: "dagger_hex", name: "Dagger Hex", description: "A stiffness that clings to joints and limbs like thistleburs. Believed to follow poor posture or sleeping under cursed trees. Heat and nourish the body to encourage healing.", temperature: "Normal", causes: ["Overexertion"], cure: "Spicy Tea Base with Sheep’s Bane and Common Snupe", symptoms: [ "I’ve got this pain in my back!", "Ack! My neck is killing me. I’ve been working too hard..." ], element_imbalance: "fire", symptom_color: 0xFF8844, gold_reward: 135 }, "witchrattle": { id: "witchrattle", name: "Witchrattle", description: "A dry, scratchy cough that echoes oddly through the throat. Caught mostly in deep winter and under cold moons. The treatment must warm the body but cool the throat.", temperature: "Cold", causes: ["Getting too cold", "Contact with sick people"], cure: "Spicy Tea Base with Frogwick and Geneva’s Dewdrop or River Leek", symptoms: [ "Hack hack! Excuse my cough!", "These frosty evenings have been so hard on my lungs..." ], element_imbalance: "fire", symptom_color: 0x99CCFF, gold_reward: 120 }, "twiddlecurse": { id: "twiddlecurse", name: "Twiddlecurse", description: "A jittery, jumpy itch in the fingers and feet. Common among those plagued by tragedies or nightmares. A cooling tea is required.", temperature: "Normal", causes: ["Stress", "Too many wind-aligned herbs"], cure: "Cooling Tea Base with Geneva’s Dewdrop and Frogwick", symptoms: [ "Demeter’s Arrow is so good but I think I had too many...", "I’m so restless lately, I can’t stop fidgeting!" ], element_imbalance: "water", symptom_color: 0x66CCFF, gold_reward: 115 }, "purging_rot": { id: "purging_rot", name: "Purging Rot", description: "A slow-burning ailment marked by greenish skin and sweating. Often follows the consumption of misidentified mushrooms or cursed teas. Expel the rot but make sure to also nourish the body.", temperature: "Hot", causes: ["Poisonous mushrooms", "Cursed teas"], cure: "Uplifting Tea Base with Sheep’s Bane and Common Snupe", symptoms: [ "I must have eaten something that went bad...", "Purple mushrooms are safe to eat... right?" ], element_imbalance: "wind", symptom_color: 0x77DD77, gold_reward: 160 } };
User prompt
Restructure patient area
User prompt
1. Remove Score Counter var scoreText = new Text2('Score: ' + currentScore, { size: 60, fill: 0xFFFFFF }); scoreText.anchor.set(1, 0); LK.gui.topRight.addChild(scoreText); 2. Move Patient Hint Text + Add Background // Hint background box var hintBox = game.attachAsset('craftButton', { anchorX: 0.5, anchorY: 0.5, x: 1500, // to the right of patient portrait y: 600, width: 600, height: 200, tint: 0x222222, alpha: 0.7 }); // Hint text var patientStatusText = new Text2('Welcome! A patient awaits...', { size: 48, fill: 0xFFFFFF, align: 'center' }); patientStatusText.anchor.set(0.5, 0.5); patientStatusText.x = 1500; patientStatusText.y = 600; game.addChild(patientStatusText); 3. Journal Description Margin + Wrapping The issue is text running to the window edges. We’ll add a uniform margin inside wrapTextByWords. function wrapTextByWords(str, maxLen) { var words = str.split(' '); var lines = []; var current = ''; for (var i = 0; i < words.length; i++) { var tryLine = current.length ? current + ' ' + words[i] : words[i]; if (tryLine.length > maxLen) { if (current.length) { lines.push(current); } current = words[i]; } else { current = tryLine; } } if (current.length) { lines.push(current); } return lines.join('\n'); } ➡️ For journal content, increase margin and reduce line width (to ~60 characters instead of 70). Example inside updateSectionContent:sectionDescription.setText(wrapTextByWords(desc, 60)); 4. Change Yellow Text (ILLNESS, PLANT, TEA BASE) → Dark Green fill: 0x006400 // dark green ✅ Result No score counter in HUD. Patient hint always visible beside portrait with dark background. Journal text wrapped with margins, no more overflow. Section type text now dark green for visibility.
User prompt
when game begins, play BackgroundMusic, loop until game over state.
User prompt
1. Behind Counter Graphic Layering Right now, the paper background (journal overlay) is rendering on top of everything and covering the bottom UI (counter + cauldron area). The behind counter graphic is set, but its y position and depth need adjusting so it always fills the lower half of the screen and sits above the parchment overlay. 🔧 Fix: Move the behindCounter down and make it taller so it clearly takes up half the screen. Ensure it’s drawn after the background but before overlays like the journal. // Behind counter graphic in bottom layer (depth 1) var behindCounter = game.attachAsset('behind_Counter', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 2000, // push it lower width: 2048, height: 1400 // make it fill the bottom half }); 2. Journal Text Readability Right now, journal text is too small and too light on the parchment. The Back/Next buttons look good and should stay as-is. 👍 🔧 Fixes for Journal Text: Make herb/element/description substantially larger (about 25–30% bigger). Use a darker text color (0x000000 black or 0x222222 dark gray). Keep centered alignment.var sectionTitle = new Text2('', { size: 80, // larger fill: 0x000000, // darker fontWeight: 'bold' }); sectionTitle.anchor.set(0.5, 0.5); sectionTitle.x = 1024; sectionTitle.y = 750; self.addChild(sectionTitle); var sectionType = new Text2('', { size: 56, // larger fill: 0xFFD700 // golden type text stays }); sectionType.anchor.set(0.5, 0.5); sectionType.x = 1024; sectionType.y = 880; self.addChild(sectionType); var sectionElement = new Text2('', { size: 56, fill: 0x000000 // darker, readable }); sectionElement.anchor.set(0.5, 0.5); sectionElement.x = 1024; sectionElement.y = 1000; self.addChild(sectionElement); var sectionDescription = new Text2('', { size: 50, // substantially larger fill: 0x000000, // darker align: 'center' }); sectionDescription.anchor.set(0.5, 0); sectionDescription.x = 1024; sectionDescription.y = 1150; self.addChild(sectionDescription); ✨ With these fixes: Counter graphic will fill the bottom half and not be covered. Journal entries will look bold, dark, and properly legible on parchment. Back/Next buttons stay the same.
User prompt
swap the Gold system for a Reputation system pretty cleanly since all of the bookkeeping is already centralized. 🔧 Changes Needed Replace goldAmount with reputation Start player with reputation = 100 (or another value you want). Remove all references to "Gold" in the UI and code. Update UI Change the top-left label from "Gold: X" → "Reputation: X". Update Rewards/Penalties In craftPotion(), instead of adding/removing gold: reputation += illness.reward (for correct cure). reputation -= penalty (for incorrect or invalid cure). Use positive values for success and negative values for failure. Game Over Condition Instead of if (goldAmount < -100) → if (reputation <= 0). var reputation = 100; // start with 100 rep var currentScore = 0; UI label: var reputationText = new Text2('Reputation: ' + reputation, { size: 60, fill: 0xFFD700 }); reputationText.anchor.set(0, 0); reputationText.x = 120; reputationText.y = 50; LK.gui.topLeft.addChild(reputationText); Craft potion logic (craftPotion) function craftPotion() { if (!currentPatient || isProcessingTreatment || cauldron.ingredients.length !== 3) { return; } isProcessingTreatment = true; var baseName = cauldron.ingredients[0]; var herb1Name = cauldron.ingredients[1]; var herb2Name = cauldron.ingredients[2]; var brewedTea = brewTea(baseName, herb1Name, herb2Name); var repChange = 0; if (brewedTea) { var illness = ILLNESS_DATA[currentPatient]; if (illness && brewedTea.element === illness.element_imbalance) { repChange = illness.gold_reward; // reuse reward value as reputation tween(patient, { tint: 0x90EE90 }, { duration: 1000 }); LK.getSound('success').play(); } else { repChange = -20; tween(patient, { tint: 0xFF6666 }, { duration: 1000 }); LK.getSound('failure').play(); } } else { repChange = -20; tween(patient, { tint: 0xFF6666 }, { duration: 1000 }); LK.getSound('failure').play(); } reputation += repChange; currentScore += Math.max(0, repChange); // Update UI reputationText.setText('Reputation: ' + reputation); scoreText.setText('Score: ' + currentScore); cauldron.ingredients = []; updateCauldronDisplay(); if (repChange > 0) { patientStatusText.setText('Treatment successful! +' + repChange + ' reputation'); } else { patientStatusText.setText('Treatment failed! ' + repChange + ' reputation'); } treatmentTimer = LK.ticks + 120; } Game Over Condition (in game.update): if (reputation <= 0) { LK.showGameOver(); } Reset Button Logic: resetButton.down = function (x, y, obj) { reputation = 100; currentScore = 0; reputationText.setText('Reputation: ' + reputation); scoreText.setText('Score: ' + currentScore); patientStatusText.setText('Game Reset! Build your reputation again!'); }; Gold is fully replaced by Reputation. You win reputation for successful cures, lose it for mistakes. Game ends if your reputation hits 0.
User prompt
✅ Fixes to Implement Consistent Entry Layout Herb/Element/Illness entries will follow this format: SHEEP’S BANE (bold, centered, large) Herb (smaller, yellow/golden text) Element: Earth Description of the herb here, wrapped properly. Scale text to window Increase font sizes to fill the journal window better (but still wrap text within margins so it doesn’t overflow). Apply wrapTextByWords() but with dynamic width (e.g., ~70 chars per line instead of 50). BACK and NEXT buttons Make buttons larger (about double size). Change button text color to white. Center horizontally along the bottom of the journal window. Apply same formatting to HERBS, ELEMENTS, and ILLNESSES sections so they’re consistent. Here’s the main section in your JournalPopup that needs replacing: // Section View Elements (hidden initially) var sectionTitle = new Text2('', { size: 64, fill: 0xFFFFFF, fontWeight: 'bold' }); sectionTitle.anchor.set(0.5, 0.5); sectionTitle.x = 1024; sectionTitle.y = 800; self.addChild(sectionTitle); var sectionType = new Text2('', { size: 48, fill: 0xFFD700 }); sectionType.anchor.set(0.5, 0.5); sectionType.x = 1024; sectionType.y = 900; self.addChild(sectionType); var sectionElement = new Text2('', { size: 48, fill: 0xFFFFFF }); sectionElement.anchor.set(0.5, 0.5); sectionElement.x = 1024; sectionElement.y = 1000; self.addChild(sectionElement); var sectionDescription = new Text2('', { size: 42, fill: 0xFFFFFF, align: 'center' }); sectionDescription.anchor.set(0.5, 0); sectionDescription.x = 1024; sectionDescription.y = 1100; self.addChild(sectionDescription); And update Back/Next buttons: var backToContentsButton = self.attachAsset('craftButton', { anchorX: 0.5, anchorY: 0.5, x: 750, y: 2200, width: 300, // bigger height: 100, tint: 0x222222 }); var backToContentsText = new Text2('⬅ Back', { size: 42, fill: 0xFFFFFF }); backToContentsText.anchor.set(0.5, 0.5); backToContentsText.x = 750; backToContentsText.y = 2200; self.addChild(backToContentsText); var nextEntryButton = self.attachAsset('craftButton', { anchorX: 0.5, anchorY: 0.5, x: 1300, y: 2200, width: 300, // bigger height: 100, tint: 0x222222 }); var nextEntryText = new Text2('Next ➡', { size: 42, fill: 0xFFFFFF }); nextEntryText.anchor.set(0.5, 0.5); nextEntryText.x = 1300; nextEntryText.y = 2200; self.addChild(nextEntryText); 🔄 Update updateSectionContent Instead of dumping everything into one text block, we assign to sectionTitle, sectionType, sectionElement, and sectionDescription separately. For example: self.updateSectionContent = function () { var entries = self.journalData[self.currentSection]; var entry = entries[self.currentIndex]; if (self.currentSection === 'herbs') { var herbData = HERB_DATA[entry]; sectionTitle.setText(entry.toUpperCase()); // Bold, centered sectionType.setText(herbData.type); sectionElement.setText("Element: " + herbData.alignment); sectionDescription.setText(wrapTextByWords(herbData.description, 70)); } else if (self.currentSection === 'teaBases') { var baseData = teaBases[entry]; sectionTitle.setText(entry.toUpperCase()); sectionType.setText("Tea Base"); sectionElement.setText("Element: " + baseData.element); sectionDescription.setText("A light base for brewing teas, often combined with matching herbs."); } else if (self.currentSection === 'illnesses') { var illnessData = ILLNESS_DATA[entry]; sectionTitle.setText(illnessData.name.toUpperCase()); sectionType.setText("Illness"); sectionElement.setText("Element: " + illnessData.element_imbalance); var desc = "Description: " + illnessData.description + "\n\n" + "Cure: Use " + illnessData.element_imbalance + " base with herbs."; sectionDescription.setText(wrapTextByWords(desc, 70)); } };
User prompt
Remove the guide section from the game, including the button to access it from the screen. Move the RESET and JOUNRAL buttons to the right side of the screen, stack them vertically, and bold the font of the label for better visibility. increase the font for descriptions of HERBS, ELEMENTS, and ILLNESSES in journal by 50%. Increase the size and text of the START OVER button by 50% Increase the size and text of the CRAFT POTION button by 50%
User prompt
remove text indicator on screen for the cauldron being empty.
User prompt
remove "cauldron empty" text from screen
User prompt
increase the smallest font in the game text to 25px, no font should be smaller than 25px.
User prompt
1. Enlarge Start Over & Craft Potion buttons If they already have a class (e.g. .game-button or .cauldron-button), just scale them: .start-over-button, .craft-potion-button { transform: scale(1.75); /* increases size by 75% */ transform-origin: center; } ✅ 2. Herb / Illness / Element descriptions & titles Your popups likely look like this:
description text here
Update CSS: .popup-title { font-size: 50px; margin-bottom: 20px; } .popup-text { font-size: 25px; line-height: 1.6; } ✅ 3. Shadow behind Hint text Let’s assume your hint is drawn at the bottom of the screen like:User prompt
.popup-window { width: 75vw; height: 75vh; font-size: 22px; line-height: 1.5; padding: 20px; } .tea-base-popup { display: flex; flex-direction: column; /* stack vertically */ align-items: center; /* center horizontally */ justify-content: center; /* center vertically */ gap: 20px; /* space between buttons */ height: 100%; /* fill popup */ } .tea-base-button { font-size: 24px; /* bigger text */ padding: 16px 32px; background-color: #1a237e; /* deep blue */ color: white; border: none; border-radius: 10px; cursor: pointer; width: 60%; /* wider buttons */ text-align: center; } .tea-base-button:hover { background-color: #3949ab; /* lighter blue on hover */ }
User prompt
✅ 1. Make Guide, Reset, Journal buttons larger Find your UI button styles — right now they probably default to the browser’s tiny button size. Add this CSS: button { font-size: 20px; padding: 12px 24px; border-radius: 10px; background-color: #444; color: white; cursor: pointer; } button:hover { background-color: #666; } ✅ 2. Move Patient graphic down Find where you position the patient (likely something like patient.style.top = "Xpx";). Change it so it’s more centered: patient.style.position = "absolute"; patient.style.top = "150px"; // adjust until it sits nicely above counter patient.style.left = "50%"; patient.style.transform = "translateX(-50%)"; ✅ 3. Raise Cauldron graphic so it sits on the counter cauldron.style.position = "absolute"; cauldron.style.bottom = "120px"; // raises it up from bottom cauldron.style.left = "50%"; cauldron.style.transform = "translateX(-50%)"; ✅ 4. Enlarge TEA BASES and HERBS windows Currently they’re probably fixed small. Instead, scale them to 75% screen width & height and bump up font size. .popup-window { width: 75vw; height: 75vh; font-size: 22px; /* bigger text */ padding: 20px; overflow-y: auto; } ✅ 5. Fix Table of Contents button text visibility Your TOC buttons probably blend into the background. Force a high contrast style: .toc-button { font-size: 24px; padding: 16px 32px; background-color: #222; color: #fff; /* white text */ border: 2px solid #fff; margin: 10px; display: block; } .toc-button:hover { background-color: #444; }
User prompt
1. Add a Table of Contents Screen When the player clicks the journal, instead of going straight to herbs or elements, show this first:
User prompt
You want each journal entry (for Herbs, Tea Bases, Illnesses) to appear inside its own window-like card, with a consistent layout (title, info, description, navigation). Not all in one screen at once, but one card per page that the player flips through. Here’s an HTML + CSS example you can drop into your game to get that style started: Example Journal Window (Herb Entry)
Element: Wind
Plant Type: Herb
Element: Wind
Temperature: Hot
Causes: Overexertion, getting caught in the rain.
Symptoms: Fatigue, flushed skin, sweating.
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var HerbPopup = Container.expand(function () { var self = Container.call(this); // Semi-transparent background overlay var overlay = self.attachAsset('background', { anchorX: 0, anchorY: 0, x: 0, y: 0, width: 2048, height: 2732, alpha: 0.8, tint: 0x000000 }); // Main popup window - larger and centered var popupWindow = self.attachAsset('background', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366, width: 1600, height: 1000, tint: 0x8B4513 }); // Close button (X) - larger var closeButton = self.attachAsset('craftButton', { anchorX: 0.5, anchorY: 0.5, x: 1700, y: 950, width: 120, height: 120, tint: 0xFF0000 }); var closeButtonText = new Text2('X', { size: 80, fill: 0xFFFFFF }); closeButtonText.anchor.set(0.5, 0.5); closeButtonText.x = 1700; closeButtonText.y = 950; self.addChild(closeButtonText); // Herb name title - much larger var nameText = new Text2('', { size: 72, fill: 0xFFFFFF }); nameText.anchor.set(0.5, 0.5); nameText.x = 1024; nameText.y = 1050; self.addChild(nameText); // Type text (Plant/Fungus) var typeText = new Text2('', { size: 48, fill: 0xFFD700 }); typeText.anchor.set(0.5, 0.5); typeText.x = 1024; typeText.y = 1150; self.addChild(typeText); // Element text - larger var elementText = new Text2('', { size: 52, fill: 0xFFFFFF }); elementText.anchor.set(0.5, 0.5); elementText.x = 1024; elementText.y = 1250; self.addChild(elementText); // Description text - much larger and wrapped var descriptionText = new Text2('', { size: 40, fill: 0xFFFFFF }); descriptionText.anchor.set(0.5, 0.5); descriptionText.x = 1024; descriptionText.y = 1500; self.addChild(descriptionText); self.isVisible = false; self.showPopup = function (herbName, x, y) { var herbData = HERB_DATA[herbName]; if (!herbData) return; nameText.setText(herbName); typeText.setText(herbData.type); elementText.setText('Element: ' + herbData.alignment); // Wrap long descriptions var wrappedDesc = wrapTextByWords(herbData.description, 50); descriptionText.setText(wrappedDesc); // Color the element text based on alignment var color = colorForAlignment(herbData.alignment); elementText.tint = color; self.visible = true; self.isVisible = true; }; self.hidePopup = function () { self.visible = false; self.isVisible = false; }; // Close button handler closeButton.down = function (x, y, obj) { self.hidePopup(); }; // Overlay click to close overlay.down = function (x, y, obj) { self.hidePopup(); }; // Start hidden self.visible = false; return self; }); // Shop button event handler removed per requirements // === Herbalist's Journal with Table of Contents === var JournalPopup = Container.expand(function () { var self = Container.call(this); // Semi-transparent background overlay var overlay = self.attachAsset('background', { anchorX: 0, anchorY: 0, x: 0, y: 0, width: 2048, height: 2732, alpha: 0.8, tint: 0x000000 }); // Main journal window - 75% of screen var journalWindow = self.attachAsset('background', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366, width: 1536, // 75% of 2048 height: 2050, // 75% of 2732 tint: 0xfdf6e3 }); // Close button (X) var closeButton = self.attachAsset('craftButton', { anchorX: 0.5, anchorY: 0.5, x: 1700, y: 500, width: 60, height: 60, tint: 0xFF0000 }); var closeButtonText = new Text2('✕', { size: 40, fill: 0xFFFFFF }); closeButtonText.anchor.set(0.5, 0.5); closeButtonText.x = 1700; closeButtonText.y = 500; self.addChild(closeButtonText); // Table of Contents View var contentsTitle = new Text2('Herbalist\'s Journal', { size: 64, fill: 0x000000 }); contentsTitle.anchor.set(0.5, 0.5); contentsTitle.x = 1024; contentsTitle.y = 650; self.addChild(contentsTitle); var contentsSubtitle = new Text2('Contents', { size: 48, fill: 0x444444 }); contentsSubtitle.anchor.set(0.5, 0.5); contentsSubtitle.x = 1024; contentsSubtitle.y = 750; self.addChild(contentsSubtitle); // Content section buttons - improved styling var herbsContentButton = self.attachAsset('craftButton', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 950, width: 500, // Increased width height: 120, // Increased height tint: 0x222222 // Dark background for contrast }); var herbsContentText = new Text2('Herbs & Fungi', { size: 48, // Increased from 40 fill: 0xFFFFFF // White text for contrast }); herbsContentText.anchor.set(0.5, 0.5); herbsContentText.x = 1024; herbsContentText.y = 950; self.addChild(herbsContentText); var basesContentButton = self.attachAsset('craftButton', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1100, width: 500, // Increased width height: 120, // Increased height tint: 0x222222 // Dark background for contrast }); var basesContentText = new Text2('Tea Bases', { size: 48, // Increased from 40 fill: 0xFFFFFF // White text for contrast }); basesContentText.anchor.set(0.5, 0.5); basesContentText.x = 1024; basesContentText.y = 1100; self.addChild(basesContentText); var illnessesContentButton = self.attachAsset('craftButton', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1250, width: 500, // Increased width height: 120, // Increased height tint: 0x222222 // Dark background for contrast }); var illnessesContentText = new Text2('Illnesses', { size: 48, // Increased from 40 fill: 0xFFFFFF // White text for contrast }); illnessesContentText.anchor.set(0.5, 0.5); illnessesContentText.x = 1024; illnessesContentText.y = 1250; self.addChild(illnessesContentText); // Section View Elements (hidden initially) var sectionTitle = new Text2('', { size: 80, // larger fill: 0x000000, // darker fontWeight: 'bold' }); sectionTitle.anchor.set(0.5, 0.5); sectionTitle.x = 1024; sectionTitle.y = 750; self.addChild(sectionTitle); var sectionType = new Text2('', { size: 56, // larger fill: 0x006400 // dark green }); sectionType.anchor.set(0.5, 0.5); sectionType.x = 1024; sectionType.y = 880; self.addChild(sectionType); var sectionElement = new Text2('', { size: 56, fill: 0x000000 // darker, readable }); sectionElement.anchor.set(0.5, 0.5); sectionElement.x = 1024; sectionElement.y = 1000; self.addChild(sectionElement); var sectionDescription = new Text2('', { size: 50, // substantially larger fill: 0x000000, // darker align: 'center' }); sectionDescription.anchor.set(0.5, 0); sectionDescription.x = 1024; sectionDescription.y = 1150; self.addChild(sectionDescription); // Navigation buttons for sections var backToContentsButton = self.attachAsset('craftButton', { anchorX: 0.5, anchorY: 0.5, x: 750, y: 2200, width: 300, height: 100, tint: 0x222222 }); var backToContentsText = new Text2('⬅ Back', { size: 42, fill: 0xFFFFFF }); backToContentsText.anchor.set(0.5, 0.5); backToContentsText.x = 750; backToContentsText.y = 2200; self.addChild(backToContentsText); var nextEntryButton = self.attachAsset('craftButton', { anchorX: 0.5, anchorY: 0.5, x: 1300, y: 2200, width: 300, height: 100, tint: 0x222222 }); var nextEntryText = new Text2('Next ➡', { size: 42, fill: 0xFFFFFF }); nextEntryText.anchor.set(0.5, 0.5); nextEntryText.x = 1300; nextEntryText.y = 2200; self.addChild(nextEntryText); // State management self.currentView = 'contents'; // 'contents' or 'section' self.currentSection = ''; self.currentIndex = 0; self.journalData = { herbs: Object.keys(HERB_DATA), teaBases: Object.keys(teaBases), illnesses: Object.keys(ILLNESS_DATA) }; self.isVisible = false; // Show/hide content elements self.showContents = function () { self.currentView = 'contents'; // Show contents elements contentsTitle.visible = true; contentsSubtitle.visible = true; herbsContentButton.visible = true; herbsContentText.visible = true; basesContentButton.visible = true; basesContentText.visible = true; illnessesContentButton.visible = true; illnessesContentText.visible = true; // Hide section elements sectionTitle.visible = false; sectionType.visible = false; sectionElement.visible = false; sectionDescription.visible = false; backToContentsButton.visible = false; backToContentsText.visible = false; nextEntryButton.visible = false; nextEntryText.visible = false; }; self.showSection = function (section) { self.currentView = 'section'; self.currentSection = section; self.currentIndex = 0; // Hide contents elements contentsTitle.visible = false; contentsSubtitle.visible = false; herbsContentButton.visible = false; herbsContentText.visible = false; basesContentButton.visible = false; basesContentText.visible = false; illnessesContentButton.visible = false; illnessesContentText.visible = false; // Show section elements sectionTitle.visible = true; sectionType.visible = true; sectionElement.visible = true; sectionDescription.visible = true; backToContentsButton.visible = true; backToContentsText.visible = true; nextEntryButton.visible = true; nextEntryText.visible = true; self.updateSectionContent(); }; self.updateSectionContent = function () { var entries = self.journalData[self.currentSection]; var entry = entries[self.currentIndex]; if (self.currentSection === 'herbs') { var herbData = HERB_DATA[entry]; sectionTitle.setText(entry.toUpperCase()); sectionType.setText(herbData.type); sectionElement.setText("Element: " + herbData.alignment); sectionDescription.setText(wrapTextByWords(herbData.description, 60)); } else if (self.currentSection === 'teaBases') { var baseData = teaBases[entry]; sectionTitle.setText(entry.toUpperCase()); sectionType.setText("Tea Base"); sectionElement.setText("Element: " + baseData.element.charAt(0).toUpperCase() + baseData.element.slice(1)); sectionDescription.setText(wrapTextByWords("A light base for brewing teas, often combined with matching herbs.", 60)); } else if (self.currentSection === 'illnesses') { var illnessData = ILLNESS_DATA[entry]; sectionTitle.setText(illnessData.name.toUpperCase()); sectionType.setText("Illness"); var elementText = "Element: "; for (var i = 0; i < illnessData.element_imbalance.length; i++) { if (i > 0) elementText += " + "; elementText += illnessData.element_imbalance[i].charAt(0).toUpperCase() + illnessData.element_imbalance[i].slice(1); } sectionElement.setText(elementText); var cureText = "Cure: Use "; for (var i = 0; i < illnessData.element_imbalance.length; i++) { if (i > 0) cureText += " + "; cureText += illnessData.element_imbalance[i]; } cureText += " base with herbs."; var desc = "Description: " + illnessData.description + "\n\n" + cureText; sectionDescription.setText(wrapTextByWords(desc, 60)); } }; self.nextEntry = function () { var entries = self.journalData[self.currentSection]; if (self.currentIndex < entries.length - 1) { self.currentIndex++; } else { self.currentIndex = 0; // Loop back to first } self.updateSectionContent(); }; self.showJournal = function () { self.visible = true; self.isVisible = true; self.showContents(); }; self.hideJournal = function () { self.visible = false; self.isVisible = false; }; // Button handlers herbsContentButton.down = function (x, y, obj) { self.showSection('herbs'); }; basesContentButton.down = function (x, y, obj) { self.showSection('teaBases'); }; illnessesContentButton.down = function (x, y, obj) { self.showSection('illnesses'); }; backToContentsButton.down = function (x, y, obj) { self.showContents(); }; nextEntryButton.down = function (x, y, obj) { self.nextEntry(); }; // Close button handler closeButton.down = function (x, y, obj) { self.hideJournal(); }; // Overlay click to close overlay.down = function (x, y, obj) { self.hideJournal(); }; // Start hidden self.visible = false; return self; }); // Create journal popup var Patient = Container.expand(function () { var self = Container.call(this); var patientBody = self.attachAsset('patient', { anchorX: 0.5, anchorY: 0.5 }); // symptomGlow moved to main game - reference will be set externally self.symptomGlow = null; self.symptomType = ''; self.requiredBase = ''; self.requiredElement = ''; self.requiredHerb = ''; self.goldReward = 0; self.setSymptom = function (type) { self.symptomType = type; var illness = ILLNESS_DATA[type]; if (illness) { if (self.symptomGlow) self.symptomGlow.tint = illness.symptom_color; self.element_imbalance = illness.element_imbalance; self.goldReward = illness.gold_reward; self.illnessName = illness.name; self.description = illness.description; } }; // reactToPotion method removed - cure logic now handled in craftPotion function return self; }); var PopupMenu = Container.expand(function () { var self = Container.call(this); // Semi-transparent background overlay var overlay = self.attachAsset('background', { anchorX: 0, anchorY: 0, x: 0, y: 0, width: 2048, height: 2732, alpha: 0.7, tint: 0x000000 }); // Main popup window - 75% of screen size var popupWindow = self.attachAsset('background', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366, width: 1536, // 75% of 2048 height: 2050, // 75% of 2732 tint: 0x8B4513 }); // Close button (X) var closeButton = self.attachAsset('craftButton', { anchorX: 0.5, anchorY: 0.5, x: 1600, y: 600, width: 80, height: 80, tint: 0xFF0000 }); var closeButtonText = new Text2('X', { size: 40, fill: 0xFFFFFF }); closeButtonText.anchor.set(0.5, 0.5); closeButtonText.x = 1600; closeButtonText.y = 600; self.addChild(closeButtonText); // Title text - larger for better visibility var titleText = new Text2('', { size: 72, // Increased from 50 to 72 fill: 0xFFFFFF }); titleText.anchor.set(0.5, 0.5); titleText.x = 1024; titleText.y = 700; self.addChild(titleText); self.menuItems = []; self.isVisible = false; self.showMenu = function (title, items, itemColors) { titleText.setText(title); self.visible = true; self.isVisible = true; // Clear existing menu items for (var i = 0; i < self.menuItems.length; i++) { game.removeChild(self.menuItems[i]); } self.menuItems = []; // Special layout for Tea Bases (centered vertical stack) if (title.indexOf('TEA BASES') !== -1) { var buttonWidth = 800; // 60% of screen width (1536 * 0.6) var buttonHeight = 120; var buttonSpacing = 40; var startY = 1000; for (var i = 0; i < items.length; i++) { var y = startY + i * (buttonHeight + buttonSpacing); // Create button-style container var menuItem = new Container(); menuItem.x = 1024; // Center horizontally menuItem.y = y; game.addChild(menuItem); // Create button background var buttonBg = menuItem.attachAsset('craftButton', { anchorX: 0.5, anchorY: 0.5, x: 0, y: 0, width: buttonWidth, height: buttonHeight, tint: 0x1a237e // Deep blue for tea bases }); // Create centered button text var buttonText = new Text2(items[i], { size: 48, // Larger text for tea bases fill: 0xFFFFFF }); buttonText.anchor.set(0.5, 0.5); buttonText.x = 0; buttonText.y = 0; menuItem.addChild(buttonText); menuItem.name = items[i]; menuItem.draggable = true; menuItem.type = 'ingredient'; menuItem.isDragging = false; menuItem.originalX = 1024; menuItem.originalY = y; menuItem.isMenuPurchase = true; menuItem.cost = 50; self.menuItems.push(menuItem); } } else { // Regular grid layout for other items (herbs, etc.) var itemsPerRow = 3; var buttonWidth = 400; var buttonHeight = 120; var buttonSpacing = 60; var totalRowWidth = itemsPerRow * buttonWidth + (itemsPerRow - 1) * buttonSpacing; var startX = 1024 - totalRowWidth / 2 + buttonWidth / 2; var startY = 1050; var rowSpacing = 150; for (var i = 0; i < items.length; i++) { var row = Math.floor(i / itemsPerRow); var col = i % itemsPerRow; var x = startX + col * (buttonWidth + buttonSpacing); var y = startY + row * rowSpacing; // Create button-style container var menuItem = new Container(); menuItem.x = x; menuItem.y = y; game.addChild(menuItem); // Create button background var buttonBg = menuItem.attachAsset('craftButton', { anchorX: 0.5, anchorY: 0.5, x: 0, y: 0, width: buttonWidth, height: buttonHeight, tint: itemColors[i] || 0x8B4513 }); // Create centered button text - larger for better visibility var buttonText = new Text2(items[i], { size: 36, // Increased from 28 to 36 fill: 0xFFFFFF }); buttonText.anchor.set(0.5, 0.5); buttonText.x = 0; buttonText.y = 0; menuItem.addChild(buttonText); menuItem.name = items[i]; menuItem.draggable = true; menuItem.type = 'ingredient'; menuItem.isDragging = false; menuItem.originalX = x; menuItem.originalY = y; menuItem.isMenuPurchase = true; menuItem.cost = 50; // Cost to purchase from menu self.menuItems.push(menuItem); } } }; self.hideMenu = function () { self.visible = false; self.isVisible = false; // Remove menu items for (var i = 0; i < self.menuItems.length; i++) { game.removeChild(self.menuItems[i]); } self.menuItems = []; }; self.showDetails = function (itemName) { if (HERB_DATA[itemName]) { herbPopup.showPopup(itemName, 0, 0); } }; // Close button handler closeButton.down = function (x, y, obj) { self.hideMenu(); }; // Overlay click to close overlay.down = function (x, y, obj) { self.hideMenu(); }; // Start hidden self.visible = false; return self; }); var PotionBottle = Container.expand(function () { var self = Container.call(this); var bottle = self.attachAsset('potionBottle', { anchorX: 0.5, anchorY: 0.5 }); self.setColor = function (base, element, herb) { var color = 0x87CEEB; if (element === 'fire') color = 0xFF6B6B;else if (element === 'water') color = 0x6BB6FF;else if (element === 'earth') color = 0x8B4513;else if (element === 'wind') color = 0xE6E6FA; bottle.tint = color; tween(bottle, { scaleX: 1.2, scaleY: 1.2 }, { duration: 200, onFinish: function onFinish() { tween(bottle, { scaleX: 1, scaleY: 1 }, { duration: 200 }); } }); }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x2F4F2F }); /**** * Game Code ****/ // Add global button styling var buttonStyle = { fontSize: 20, padding: "12px 24px", borderRadius: 10, backgroundColor: "#444", color: "white", cursor: "pointer" }; var gameBackground = game.attachAsset('background', { anchorX: 0, anchorY: 0, x: 0, y: 0 }); // === Tap vs Drag state === var downItemCandidate = null; var downStartX = 0, downStartY = 0; var DRAG_THRESHOLD = 22; // px movement to start dragging // helper: rectangular hit test function hitRect(x, y, cx, cy, halfW, halfH) { return Math.abs(x - cx) <= halfW && Math.abs(y - cy) <= halfH; } function createDragGhostFromMenu(name, color, cost, startX, startY) { var ghost = new Container(); ghost.x = startX; ghost.y = startY; game.addChild(ghost); var bg = ghost.attachAsset('craftButton', { anchorX: 0.5, anchorY: 0.5, x: 0, y: 0, tint: color, width: 220, height: 100 }); var txt = new Text2(name, { size: 44, fill: 0xFFFFFF }); txt.anchor.set(0.5, 0.5); txt.x = 0; txt.y = 0; ghost.addChild(txt); ghost.name = name; ghost.isDragging = true; ghost.isMenuPurchase = true; ghost.cost = 0; ghost.dragOffsetX = 0; ghost.dragOffsetY = 0; // subtle pop so it feels grabbed tween(ghost, { scaleX: 1.08, scaleY: 1.08 }, { duration: 120 }); return ghost; } var reputation = 100; var currentScore = 0; var currentPatient = null; var isProcessingTreatment = false; // Menu buttons are already implemented at the top of the screen: // - Instructions button (blue) at x=400, y=100 // - New Game button (red) at x=1024, y=100 // - Shop button (green) at x=1648, y=100 // All buttons have proper styling, text labels, and event handlers // HUD / TOP BAR LAYER var reputationText = new Text2('Reputation: ' + reputation, { size: 60, fill: 0xFFD700 }); reputationText.anchor.set(0, 0); reputationText.x = 120; reputationText.y = 50; LK.gui.topLeft.addChild(reputationText); // CENTER LAYER - Patient + Cauldron + Dialogue var patient = game.addChild(new Patient()); patient.x = 1024; patient.y = 500; // Moved up to create space for hint text below // Create symptom indicator positioned near patient var symptomIndicator = game.attachAsset('symptomIndicator', { anchorX: 0.5, anchorY: 0.5, x: 200, y: 400 }); // Link symptom indicator to patient patient.symptomGlow = symptomIndicator; // Patient status text with background - positioned below patient portrait var hintBox = game.attachAsset('craftButton', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 800, width: 800, height: 120, tint: 0x222222, alpha: 0.9 }); // Hint text var patientStatusText = new Text2('Welcome! A patient awaits...', { size: 42, fill: 0xFFFFFF, align: 'center' }); patientStatusText.anchor.set(0.5, 0.5); patientStatusText.x = 1024; patientStatusText.y = 800; game.addChild(patientStatusText); // Potion Bottle positioned near cauldron var potionBottle = game.addChild(new PotionBottle()); potionBottle.x = 1024; potionBottle.y = 1100; potionBottle.visible = false; // Start hidden // BOTTOM LAYER - Ingredient Buttons + Craft Button (craft button moved after counter layer) // Wheel labels and selection display removed // Illness definitions with element imbalances and cure rules var ILLNESS_DATA = { "hollowshiver": { id: "hollowshiver", name: "Hollowshiver", description: "A creeping cold that settles in the bones, no matter how many blankets are piled on. Common after wandering too long near mushroom circles or in moonlit glades. Warming the body will help.", temperature: "Cold", causes: ["Getting too cold", "Too many water herbs", "Swimming in cold waters"], cure: "Brew fire-aligned broth with Kitty Mitten, Sommeral, or Brindleroot", symptoms: ["I took a swim, but the water was so cold…", "I feel a cold damp in my bones…"], element_imbalance: ["fire"], symptom_color: 0x4444FF, gold_reward: 120 }, "driftlimb": { id: "driftlimb", name: "Driftlimb", description: "A peculiar tiredness that makes even teacups feel too heavy. Believed to come from skipping too many meals or carrying burdens not your own. A wind-based approach will help uplift the body.", temperature: "Normal", causes: ["Working too hard", "Being ill for a long time"], cure: "Brew wind-aligned tea with Fuzzy Peeper, Demeter's Arrow or Pipeweed", symptoms: ["I've been working so hard lately, my arms feel so heavy…", "I feel like I have no muscles in my legs…"], element_imbalance: ["wind"], symptom_color: 0xFFFF44, gold_reward: 130 }, "greyheart": { id: "greyheart", name: "Greyheart", description: "A sadness with no clear shape. Often spoken of in hushed tones as the malaise of quiet souls or lonely seasons. To heal Greyheart, one must nourish the body, warm the limbs, and lift the spirit at the same time.", temperature: "Normal", causes: ["Tragedy of the heart", "Ennui"], cure: "Earthy Tea Base with Kitty Mitten and Demeter's Arrow", symptoms: ["I feel so low. As if I'm haunted somehow by the troubles of my past…", "This weather has been hard for me… I feel so… I don't know.", "I feel as if I've been flattened or hollowed out. Something is missing and I don't know what…"], element_imbalance: ["earth"], symptom_color: 0x888888, gold_reward: 140 }, "the_wilt": { id: "the_wilt", name: "The Wilt", description: "When one's spirit feels dim and steps feel cloud-soft. A common complaint after long travels or encounters with annoying relatives. The wilt requires a wind based tea.", temperature: "Normal", causes: ["Not sleeping enough", "Over excitement"], cure: "Uplifting Tea Base with Demeter's Arrow and Fuzzy Peeper", symptoms: ["I'm so tired no matter how much I sleep."], element_imbalance: ["wind"], symptom_color: 0xAAAAFF, gold_reward: 110 }, "wretching_waters": { id: "wretching_waters", name: "Wretching Waters", description: "A twisting in the gut, often after eating something wild or questionably cooked. One needs a strong, nourishing broth.", temperature: "Hot", causes: ["Rotten food", "Ingesting poisonous fungi"], cure: "Earthy Tea Base with Sheep's Bane and Common Snupe", symptoms: ["I've been in the bathroom all morning!", "My stomach…. uurrgghhh…"], element_imbalance: ["earth"], symptom_color: 0x44FF44, gold_reward: 150 }, "unmovable_phlegm": { id: "unmovable_phlegm", name: "Unmovable Phlegm", description: "More irritating than dangerous, this thick muck often makes sleep difficult. A combination of heat and wind is necessary to clear it.", temperature: "Normal", causes: ["Pollen exposure", "Allergies to animals"], cure: "Spicy Tea Base with Demeter's Arrow and Fuzzy Peeper", symptoms: ["I can't stop sneezing since I went to that petting zoo!", "I feel like I can't breathe, especially at night.", "This dust in the air is making me feel awful!"], element_imbalance: ["fire", "wind"], symptom_color: 0xFFCC44, gold_reward: 125 }, "dagger_hex": { id: "dagger_hex", name: "Dagger Hex", description: "A stiffness that clings to joints and limbs like thistleburs. Believed to follow poor posture or sleeping under cursed trees. Heat and nourish the body to encourage healing.", temperature: "Normal", causes: ["Overexertion"], cure: "Spicy Tea Base with Sheep's Bane and Common Snupe", symptoms: ["I've got this pain in my back!", "Ack! My neck is killing me. I've been working too hard…"], element_imbalance: ["fire"], symptom_color: 0xFF8844, gold_reward: 135 }, "witchrattle": { id: "witchrattle", name: "Witchrattle", description: "A dry, scratchy cough that echoes oddly through the throat. Caught mostly in deep winter and under cold moons. The treatment must warm the body but cool the throat.", temperature: "Cold", causes: ["Getting too cold", "Contact with sick people"], cure: "Spicy Tea Base with Frogwick and Geneva's Dewdrop or River Leek", symptoms: ["Hack hack! Excuse my cough!", "These frosty evenings have been so hard on my lungs…"], element_imbalance: ["fire"], symptom_color: 0x99CCFF, gold_reward: 120 }, "twiddlecurse": { id: "twiddlecurse", name: "Twiddlecurse", description: "A jittery, jumpy itch in the fingers and feet. Common among those plagued by tragedies or nightmares. A cooling tea is required.", temperature: "Normal", causes: ["Stress", "Too many wind-aligned herbs"], cure: "Cooling Tea Base with Geneva's Dewdrop and Frogwick", symptoms: ["Demeter's Arrow is so good but I think I had too many…", "I'm so restless lately, I can't stop fidgeting!"], element_imbalance: ["water"], symptom_color: 0x66CCFF, gold_reward: 115 }, "purging_rot": { id: "purging_rot", name: "Purging Rot", description: "A slow-burning ailment marked by greenish skin and sweating. Often follows the consumption of misidentified mushrooms or cursed teas. Expel the rot but make sure to also nourish the body.", temperature: "Hot", causes: ["Poisonous mushrooms", "Cursed teas"], cure: "Uplifting Tea Base with Sheep's Bane and Common Snupe", symptoms: ["I must have eaten something that went bad…", "Purple mushrooms are safe to eat… right?"], element_imbalance: ["wind"], symptom_color: 0x77DD77, gold_reward: 160 } }; var symptoms = Object.keys(ILLNESS_DATA); var patientTimer = 0; var treatmentTimer = 0; function spawnNewPatient() { if (currentPatient) return; var randomSymptom = symptoms[Math.floor(Math.random() * symptoms.length)]; patient.setSymptom(randomSymptom); currentPatient = randomSymptom; var illness = ILLNESS_DATA[randomSymptom]; if (illness) { var symptom = illness.symptoms[Math.floor(Math.random() * illness.symptoms.length)]; patientStatusText.setText(symptom); } else { patientStatusText.setText('A new patient has arrived!'); } tween(patient, { scaleX: 1.1, scaleY: 1.1 }, { duration: 500, onFinish: function onFinish() { tween(patient, { scaleX: 1, scaleY: 1 }, { duration: 500 }); } }); } // updateSelectionDisplay function removed function brewTea(baseName, herb1Name, herb2Name) { if (!teaBases[baseName]) return null; var base = teaBases[baseName]; var herb1 = HERB_DATA[herb1Name]; var herb2 = HERB_DATA[herb2Name]; if (!herb1 || !herb2 || herb1Name === herb2Name) return null; // Gather all elements in the mix var elements = [base.element, herb1.element, herb2.element]; // Pure tea (all the same element) if (herb1.element === herb2.element && herb1.element === base.element) { return { name: base.name + " + " + herb1Name + " + " + herb2Name, elements: [base.element] }; } // Hybrid tea (mixed elements) var uniqueElements = []; for (var i = 0; i < elements.length; i++) { if (uniqueElements.indexOf(elements[i]) === -1) { uniqueElements.push(elements[i]); } } return { name: base.name + " + " + herb1Name + " + " + herb2Name, elements: uniqueElements }; } function craftPotion() { if (!currentPatient || isProcessingTreatment || cauldron.ingredients.length !== 3) { return; } isProcessingTreatment = true; var baseName = cauldron.ingredients[0]; var herb1Name = cauldron.ingredients[1]; var herb2Name = cauldron.ingredients[2]; var brewedTea = brewTea(baseName, herb1Name, herb2Name); var repChange = 0; if (brewedTea) { var illness = ILLNESS_DATA[currentPatient]; if (illness) { var required = illness.element_imbalance; // always an array var brewed = brewedTea.elements; // ✅ NEW: check arrays using every method var cureOK = required.every(function (element) { return brewed.indexOf(element) !== -1; }); if (cureOK) { repChange = illness.gold_reward; tween(patient, { tint: 0x90EE90 }, { duration: 1000 }); LK.getSound('success').play(); // ✅ patient is cured → clear them currentPatient = null; patientStatusText.setText("Patient cured! +" + repChange + " reputation"); treatmentTimer = LK.ticks + 120; // delay before next patient } else { // ❌ Wrong tea → penalty, but patient stays repChange = -20; tween(patient, { tint: 0xFF6666 }, { duration: 1000 }); LK.getSound('failure').play(); patientStatusText.setText("That didn't work... -" + Math.abs(repChange) + " reputation"); isProcessingTreatment = false; // allow retry } } } else { // Invalid tea combination (not a real brew) repChange = -10; // smaller penalty tween(patient, { tint: 0xFF6666 }, { duration: 1000 }); LK.getSound('failure').play(); patientStatusText.setText("Invalid brew! -" + Math.abs(repChange) + " reputation"); isProcessingTreatment = false; // allow retry } reputation += repChange; currentScore += Math.max(0, repChange); reputationText.setText('Reputation: ' + reputation); cauldron.ingredients = []; updateCauldronDisplay(); } var heldItem = null; var dragGhost = null; game.down = function (x, y, obj) { // If popup visible, prefer its items if (popupMenu.isVisible) { downItemCandidate = null; for (var i = popupMenu.menuItems.length - 1; i >= 0; i--) { var it = popupMenu.menuItems[i]; // rectangular hit for reliability var hw = (it.hitW || 120) / 2; var hh = (it.hitH || 120) / 2; if (hitRect(x, y, it.x, it.y, hw, hh)) { downItemCandidate = it; break; } } downStartX = x; downStartY = y; return; // wait to see if this becomes a tap or a drag } // Regular inventory items (unchanged) for (var i = inventoryItems.length - 1; i >= 0; i--) { var item = inventoryItems[i]; var dx = x - item.x, dy = y - item.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance < 50) { heldItem = item; item.isDragging = true; item.dragOffsetX = x - item.x; item.dragOffsetY = y - item.y; break; } } }; game.move = function (x, y, obj) { // Handle hover effects for tea base buttons if (popupMenu.isVisible && !heldItem && !downItemCandidate) { for (var i = popupMenu.menuItems.length - 1; i >= 0; i--) { var it = popupMenu.menuItems[i]; var hw = (it.hitW || 120) / 2; var hh = (it.hitH || 120) / 2; var isHovering = hitRect(x, y, it.x, it.y, hw, hh); // Apply hover effect for tea base buttons if (it.children[0] && it.children[0].tint === 0x1a237e) { // Tea base button if (isHovering && it.children[0].tint !== 0x3949ab) { it.children[0].tint = 0x3949ab; // Lighter blue on hover } else if (!isHovering && it.children[0].tint === 0x3949ab) { it.children[0].tint = 0x1a237e; // Return to original deep blue } } } } // If we have a candidate from popup and movement crosses threshold, start drag with a visible ghost if (downItemCandidate && !heldItem) { var moved = Math.sqrt((x - downStartX) * (x - downStartX) + (y - downStartY) * (y - downStartY)); if (moved > DRAG_THRESHOLD) { // Create infinite drag ghost (no cost check needed) var tint = downItemCandidate.children[0] ? downItemCandidate.children[0].tint : 0x1565C0; heldItem = dragGhost = createDragGhostFromMenu(downItemCandidate.name, tint, 0, x, y); heldItem.dragOffsetX = 0; heldItem.dragOffsetY = 0; } } // Move the active drag item (ghost or regular) if (heldItem && heldItem.isDragging) { heldItem.x = x - (heldItem.dragOffsetX || 0); heldItem.y = y - (heldItem.dragOffsetY || 0); } }; function createDragGhost(item) { if (dragGhost) { game.removeChild(dragGhost); } dragGhost = new Container(); dragGhost.x = item.x; dragGhost.y = item.y; game.addChild(dragGhost); // Ghost background with transparency var ghostBg = dragGhost.attachAsset('background', { anchorX: 0.5, anchorY: 0.5, x: 0, y: 0, width: 150, height: 150, alpha: 0.7, tint: 0x444444 }); // Ghost text var ghostText = new Text2(item.name, { size: 28, fill: 0xFFFFFF }); ghostText.anchor.set(0.5, 0.5); ghostText.x = 0; ghostText.y = 0; dragGhost.addChild(ghostText); } function removeDragGhost() { if (dragGhost) { game.removeChild(dragGhost); dragGhost = null; } } game.up = function (x, y, obj) { // TAP on popup item -> show details (no drag started) if (downItemCandidate && !heldItem) { if (HERB_DATA[downItemCandidate.name]) { herbPopup.showPopup(downItemCandidate.name, x, y); } downItemCandidate = null; return; } downItemCandidate = null; // DROP logic (ghost from menu or regular inventory) if (heldItem) { heldItem.isDragging = false; // Calculate distance to cauldron var dx = heldItem.x - cauldron.x; var dy = heldItem.y - cauldron.y; var distance = Math.sqrt(dx * dx + dy * dy); // Menu purchase ghost dropped on cauldron if (heldItem.isMenuPurchase) { if (distance < 200 && cauldron.ingredients.length < 3) { cauldron.ingredients.push(heldItem.name); updateCauldronDisplay(); tween(cauldron, { tint: 0x44FF44 }, { duration: 200, onFinish: function onFinish() { tween(cauldron, { tint: 0xFFFFFF }, { duration: 200 }); } }); // remove ghost, keep popup open for multiple adds game.removeChild(heldItem); } else { // Not dropped in valid area -> cancel purchase, remove ghost game.removeChild(heldItem); } heldItem = null; dragGhost = null; return; } // Regular inventory item drop (unchanged) if (distance < 200 && cauldron.ingredients.length < 3) { cauldron.ingredients.push(heldItem.name); updateCauldronDisplay(); tween(cauldron, { tint: 0x44FF44 }, { duration: 200, onFinish: function onFinish() { tween(cauldron, { tint: 0xFFFFFF }, { duration: 200 }); } }); var itemIndex = inventoryItems.indexOf(heldItem); if (itemIndex > -1) { game.removeChild(heldItem); inventoryItems.splice(itemIndex, 1); } } else { tween(cauldron, { tint: 0xFF4444 }, { duration: 200, onFinish: function onFinish() { tween(cauldron, { tint: 0xFFFFFF }, { duration: 200 }); } }); resetItem(heldItem); } heldItem = null; } }; game.update = function () { patientTimer++; // Spawn new patient every 8 seconds if none exists if (!currentPatient && patientTimer % 480 === 0) { spawnNewPatient(); } // Clear patient after treatment if (isProcessingTreatment && LK.ticks >= treatmentTimer) { isProcessingTreatment = false; currentPatient = null; patientStatusText.setText('Next patient incoming...'); patientTimer = 0; } // Selection display update removed // Check for game over condition (reputation too low) if (reputation <= 0) { LK.showGameOver(); } // Check for win condition (high score) if (currentScore >= 2000) { LK.showYouWin(); } }; // Create draggable inventory items function createInventoryItem(name, x, y, color, isMenuItem) { var container = new Container(); container.x = x; container.y = y; game.addChild(container); // Use big rounded rectangles for menu items; bottles for inventory var assetType = isMenuItem ? 'craftButton' : 'potionBottle'; var item = container.attachAsset(assetType, { anchorX: 0.5, anchorY: 0.5, x: 0, y: 0, tint: color }); if (isMenuItem) { item.width = 220; item.height = 100; } else { // inventory representation can stay as-is } var label = new Text2(name, { size: isMenuItem ? 44 : 25, // bigger menu text - minimum 25px fill: 0xFFFFFF }); label.anchor.set(0.5, 0.5); label.x = 0; label.y = 0; container.addChild(label); // attach metadata (if this is a herb, we have more info) container.name = name; container.meta = HERB_DATA[name] || null; container.draggable = true; container.type = 'ingredient'; container.isDragging = false; container.originalX = x; container.originalY = y; // for rectangular hit test container.hitW = isMenuItem ? item.width : 120; container.hitH = isMenuItem ? item.height : 120; return container; } // Inventory labels removed - ingredients now accessed through category buttons var inventoryItems = []; // Tea Bases - each has an element alignment var teaBases = { "Uplifting Tea Base": { name: "Uplifting Tea Base", element: "wind" }, "Earthy Tea Base": { name: "Earthy Tea Base", element: "earth" }, "Cooling Tea Base": { name: "Cooling Tea Base", element: "water" }, "Spicy Tea Base": { name: "Spicy Tea Base", element: "fire" } }; var baseItems = Object.keys(teaBases); /**** * Herb Data & Helpers ****/ var HERB_DATA = { "Sheep Bane": { type: "Plant", alignment: "Earth", element: "earth", description: "A nourishing plant with small white flowers found in lush meadows with plenty of sunshine." }, "Fuzzy Peeper": { type: "Plant", alignment: "Wind", element: "wind", description: "A pale puffball perched on a long stem; it turns gently to face any breeze, no matter how faint." }, "Sommeral": { type: "Plant", alignment: "Fire", element: "fire", description: "A spiny red blossom that thrives in sun-scorched fields; its petals crackle faintly when crushed." }, "Common Snupe": { type: "Plant", alignment: "Earth", element: "earth", description: "A squat, stubby herb with ridged leaves and a sharp nutty scent—grows best near compost heaps and pig pens." }, "Geneva's Dewdrop": { type: "Plant", alignment: "Water", element: "water", description: "Delicate blue bulbs that drip a perpetual cool dew; said to be first planted by a weeping maiden." }, "Brindleroot": { type: "Plant", alignment: "Fire", element: "fire", description: "A twisted root that glows faintly from within—often brewed to stoke warmth into cold limbs." }, "Frogwick": { type: "Plant", alignment: "Water", element: "water", description: "Rubbery, semi-aquatic herb found near marshes—tastes awful but soothes the throat like magic." }, "Demeter's Arrow": { type: "Plant", alignment: "Wind", element: "wind", description: "Thin silvery leaves that grow in spirals. When burned, they produce a vapor that clears the lungs and bowels." }, "River Leek": { type: "Plant", alignment: "Water", element: "water", description: "A long, fragrant stalk that grows in riverside soil; its boiled leaves soothe fevers and dampen restlessness." }, "Pipeweed": { type: "Plant", alignment: "Wind", element: "wind", description: "Fragrant and slightly numbing, this herb is often smoked by hill witches and daydreaming farmhands." }, "Kitty Mitten": { type: "Plant", alignment: "Fire", element: "fire", description: "Soft red-orange fuzz covers these leaves, which are pleasantly warm to the touch. Cats love to nap on them." }, "Malicious Bule": { type: "Fungus", alignment: "Wind", element: "wind", description: "A pale fungus with twisting gills and a sweet, spoiled smell. It's said to whisper when the wind passes through a grove." }, "False Dunny Cap": { type: "Fungus", alignment: "Earth", element: "earth", description: "Often mistaken for its edible cousin, this fungus has a thick gray stalk and a damp cellar scent. Caution advised." }, "Callum's Perch": { type: "Fungus", alignment: "Earth", element: "earth", description: "Named for the druid who first brewed it into a sleep tonic, this squat, mossy mushroom grows on dead stumps in shadow." }, "Pinwort": { type: "Fungus", alignment: "Water", element: "water", description: "Soft and glossy with lilac-speckled caps, these fungi flourish in damp caves and give off a faint minty aroma." }, "Devil's Lantern": { type: "Fungus", alignment: "Fire", element: "fire", description: "This bioluminescent red fungus pulses with warmth. It grows in deep caverns and is rumored to attract fire spirits." }, "Lady's Teacup": { type: "Fungus", alignment: "Water", element: "water", description: "Shaped like a delicate bowl, often found filled with morning dew. Some fae insist it must only be harvested under moonlight." }, "Dead Man's Toe": { type: "Fungus", alignment: "Earth", element: "earth", description: "Black and bulbous, it pushes up from graveyard soil and smells of rust. Disturbing in appearance, yet grounding when dried." }, "Agarium": { type: "Fungus", alignment: "Earth", element: "earth", description: "Smooth and tan, with a satisfying snap when broken. This dependable fungus is a staple in many earthy decoctions." }, "Thimbliss": { type: "Fungus", alignment: "Wind", element: "wind", description: "Tiny, translucent caps that grow in clusters beneath bird nests. Harmless alone, but intensify the effects of other herbs." }, "Lesser Bluecap": { type: "Fungus", alignment: "Water", element: "water", description: "Short and stubby with a dusty blue top, this unassuming mushroom has mild cooling properties and is common in boggy woods." } }; // ordered list for the Herbs popup var herbItems = Object.keys(HERB_DATA); function colorForAlignment(align) { if (align === "Fire") return 0xFF6B6B; if (align === "Water") return 0x6BB6FF; if (align === "Earth") return 0x8B8F6B; if (align === "Wind") return 0xBEE3F8; return 0xADFF2F; } function wrapTextByWords(str, maxLen) { var words = str.split(' '); var lines = []; var current = ''; for (var i = 0; i < words.length; i++) { var tryLine = current.length ? current + ' ' + words[i] : words[i]; if (tryLine.length > maxLen) { if (current.length) lines.push(current); current = words[i]; } else { current = tryLine; } } if (current.length) lines.push(current); return lines.join('\n'); } // Keep backward compatibility with old herbs object var herbs = {}; for (var herbName in HERB_DATA) { if (HERB_DATA.hasOwnProperty(herbName)) { herbs[herbName] = { element: HERB_DATA[herbName].element, type: HERB_DATA[herbName].type, description: HERB_DATA[herbName].description }; } } // --- COUNTER LAYER --- var behindCounter = game.attachAsset('behind_Counter', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 2100, width: 2048, height: 1400 // make it fill the bottom half }); var counter = game.attachAsset('counterTop', { anchorX: 0.5, anchorY: 1, x: 1024, y: 1850 }); // --- CRAFT POTION BUTTON (placed after counter so it's visible) --- var craftButton = game.attachAsset('craftButton', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 2650, width: 450, height: 120, tint: 0x661caa // optional: tint to make sure it's visible }); var craftButtonText = new Text2('CRAFT POTION', { size: 48, fill: 0xFFFFFF }); craftButtonText.anchor.set(0.5, 0.5); craftButtonText.x = 1024; craftButtonText.y = 2650; game.addChild(craftButtonText); // Click handler craftButton.down = function (x, y, obj) { craftPotion(); }; // Cauldron in center layer (depth 3, positioned lower on counter) var cauldron = game.attachAsset('cauldronZone', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1500 // Moved down to create space above }); cauldron.ingredients = []; // Cauldron ingredients display var cauldronLabel = new Text2('', { size: 35, fill: 0xFFFFFF }); cauldronLabel.anchor.set(0.5, 0.5); cauldronLabel.x = 1024; cauldronLabel.y = 950; game.addChild(cauldronLabel); function updateCauldronDisplay() { if (cauldron.ingredients.length === 0) { cauldronLabel.setText(''); } else { cauldronLabel.setText('Added: ' + cauldron.ingredients.join(', ')); } // Show/hide potion bottle based on ingredient count if (cauldron.ingredients.length === 3) { potionBottle.visible = true; } else { potionBottle.visible = false; } } function resetItem(item) { tween(item, { x: item.originalX, y: item.originalY }, { duration: 300 }); } // Inventory items are now only created through menu purchases // No default items in main play area // Ingredient category buttons in bottom layer - positioned below counter // Larger buttons with better spacing, centered horizontally var buttonWidth = 350; var buttonHeight = 120; var buttonSpacing = 80; var totalWidth = buttonWidth * 2 + buttonSpacing * 1; var startX = (2048 - totalWidth) / 2 + buttonWidth / 2; var teaBasesButton = game.attachAsset('craftButton', { anchorX: 0.5, anchorY: 0.5, x: startX, y: 2050, width: buttonWidth, height: buttonHeight, tint: 0x20B2AA }); var teaBasesButtonText = new Text2('TEA BASES', { size: 48, fill: 0xFFFFFF }); teaBasesButtonText.anchor.set(0.5, 0.5); teaBasesButtonText.x = startX; teaBasesButtonText.y = 2050; game.addChild(teaBasesButtonText); var herbsButton = game.attachAsset('craftButton', { anchorX: 0.5, anchorY: 0.5, x: startX + buttonWidth + buttonSpacing, y: 2050, width: buttonWidth, height: buttonHeight, tint: 0xADFF2F }); var herbsButtonText = new Text2('HERBS', { size: 48, fill: 0xFFFFFF }); herbsButtonText.anchor.set(0.5, 0.5); herbsButtonText.x = startX + buttonWidth + buttonSpacing; herbsButtonText.y = 2050; game.addChild(herbsButtonText); // Menu buttons in HUD layer - RESET and JOURNAL moved to right side, stacked vertically var resetButton = game.attachAsset('craftButton', { anchorX: 0.5, anchorY: 0.5, x: 1750, y: 150, width: 240, // Increased from 180 height: 80, // Increased from 60 tint: 0x444444 // Darker for better contrast }); var resetButtonText = new Text2('RESET', { size: 32, // Increased from 24 fill: 0xFFFFFF, fontWeight: 'bold' }); resetButtonText.anchor.set(0.5, 0.5); resetButtonText.x = 1750; resetButtonText.y = 150; game.addChild(resetButtonText); // Shop button removed per requirements // Start Over button for tea mixture reset var startOverButton = game.attachAsset('craftButton', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 2550, width: 330, height: 90, tint: 0xFF8C00 }); var startOverButtonText = new Text2('START OVER', { size: 39, fill: 0xFFFFFF }); startOverButtonText.anchor.set(0.5, 0.5); startOverButtonText.x = 1024; startOverButtonText.y = 2550; game.addChild(startOverButtonText); // Start Over button event handler startOverButton.down = function (x, y, obj) { cauldron.ingredients = []; updateCauldronDisplay(); patientStatusText.setText('Tea mixture cleared. Start fresh!'); }; // Create popup menu var popupMenu = game.addChild(new PopupMenu()); // Create herb details popup var herbPopup = game.addChild(new HerbPopup()); // Category button event handlers teaBasesButton.down = function (x, y, obj) { var teaBaseColors = []; for (var i = 0; i < baseItems.length; i++) { teaBaseColors.push(0x20B2AA); } popupMenu.showMenu('TEA BASES - 50 Gold Each', baseItems, teaBaseColors); }; herbsButton.down = function (x, y, obj) { var herbColors = []; for (var i = 0; i < herbItems.length; i++) { herbColors.push(0xADFF2F); } popupMenu.showMenu('HERBS - 50 Gold Each', herbItems, herbColors); }; // Button event handlers resetButton.down = function (x, y, obj) { reputation = 100; currentScore = 0; reputationText.setText('Reputation: ' + reputation); patientStatusText.setText('Game Reset! Build your reputation again!'); }; // Create journal popup var journalPopup = game.addChild(new JournalPopup()); // Journal button in HUD layer - Enlarged and moved to right side var journalButton = game.attachAsset('craftButton', { anchorX: 0.5, anchorY: 0.5, x: 1750, y: 280, width: 240, // Increased from 180 height: 80, // Increased from 60 tint: 0x444444 // Darker for better contrast }); var journalButtonText = new Text2('JOURNAL', { size: 32, // Increased from 22 fill: 0xFFFFFF, fontWeight: 'bold' }); journalButtonText.anchor.set(0.5, 0.5); journalButtonText.x = 1750; journalButtonText.y = 280; game.addChild(journalButtonText); // Journal button event handler journalButton.down = function (x, y, obj) { journalPopup.showJournal(); }; // Play background music LK.playMusic('BackgroundMusic'); // Initialize first patient spawnNewPatient();
===================================================================
--- original.js
+++ change.js
@@ -1063,11 +1063,8 @@
reputationText.setText('Reputation: ' + reputation);
cauldron.ingredients = [];
updateCauldronDisplay();
}
-craftButton.down = function (x, y, obj) {
- craftPotion();
-};
var heldItem = null;
var dragGhost = null;
game.down = function (x, y, obj) {
// If popup visible, prefer its items
@@ -1543,8 +1540,12 @@
craftButtonText.anchor.set(0.5, 0.5);
craftButtonText.x = 1024;
craftButtonText.y = 2650;
game.addChild(craftButtonText);
+// Click handler
+craftButton.down = function (x, y, obj) {
+ craftPotion();
+};
// Cauldron in center layer (depth 3, positioned lower on counter)
var cauldron = game.attachAsset('cauldronZone', {
anchorX: 0.5,
anchorY: 0.5,