Code edit (1 edits merged)
Please save this source code
User prompt
Update with: // Update createUpgradeText to handle tab-specific containers function createUpgradeText(category, key, index, isLeftColumn, tab) { var upgrade = UPGRADE_CONFIG[category][key]; if (!upgrade) return; // Skip if upgrade doesn't exist var xOffset = isLeftColumn ? -550 : 100; var yPos = startY + index * upgradeSpacing; // Create hit container var hitContainer = new Container(); var hitArea = LK.getAsset('blower', { width: 400, height: 150, color: 0xFFFFFF, alpha: 0.0 }); hitContainer.addChild(hitArea); hitContainer.x = xOffset; hitContainer.y = yPos; hitArea.x = 0; hitArea.y = -40; // Create name text var nameText = new Text2(upgrade.name, { size: 96, fill: 0xFFFFFF, stroke: 0x000000, strokeThickness: 2, font: "Impact" }); nameText.x = xOffset; nameText.y = yPos; // Create cost text var cost = getUpgradeCost(upgrade); var costText = new Text2(cost + " BP", { size: 96, fill: 0xFFFF00, stroke: 0x000000, strokeThickness: 2, font: "Impact" }); costText.x = xOffset; costText.y = yPos + 100; // Special handling for color upgrades with requirements if (category === 'colors' && upgrade.requires) { var required = UPGRADE_CONFIG.colors[upgrade.requires]; if (required && required.currentLevel === 0) { costText.setText("LOCKED"); costText.setFill(0x888888); } } // Add click handler hitContainer.down = function() { var cost = getUpgradeCost(upgrade); // Check if this is a locked color upgrade if (category === 'colors' && upgrade.requires) { var required = UPGRADE_CONFIG.colors[upgrade.requires]; if (required && required.currentLevel === 0) { game.showError("Unlock " + required.name + " first!"); return true; } } if (game.bp >= cost) { if (upgrade.amount !== undefined) { // For clams and decorations with amount if (upgrade.amount < (upgrade.maxAmount || 999)) { upgrade.amount++; game.bp -= cost; bpText.setText(formatBP(game.bp) + " BP"); costText.setText(getUpgradeCost(upgrade) + " BP"); // Update clam visuals if needed if (category === 'machines') { updateClamVisuals(); } // Update decoration visuals if implemented if (category === 'decorations') { // TODO: Implement decoration visuals } } } else if (upgrade.currentLevel < upgrade.maxLevel) { // For regular upgrades with levels upgrade.currentLevel++; game.bp -= cost; bpText.setText(formatBP(game.bp) + " BP"); // Update cost text if (upgrade.currentLevel >= upgrade.maxLevel) { costText.setText("SOLD OUT"); } else { costText.setText(getUpgradeCost(upgrade) + " BP"); } // Handle specific upgrade effects if (category === 'player') { if (key === 'lungCapacity') { var baseSize = UPGRADE_EFFECTS.lungCapacity.baseValue; var increasePercent = UPGRADE_EFFECTS.lungCapacity.incrementPercent; var multiplier = 1 + increasePercent / 100 * upgrade.currentLevel; game.maxBubbleSize = baseSize * multiplier; } else if (key === 'quickBreath') { game.growthRate = UPGRADE_EFFECTS.quickBreath.baseValue * (1 + UPGRADE_EFFECTS.quickBreath.incrementPercent / 100 * upgrade.currentLevel); } // Other upgrade effects will be implemented later } } } else { game.showError("Not enough BP!"); } return true; }; // Add elements to the appropriate tab container tabContainers[tab].addChild(hitContainer); tabContainers[tab].addChild(nameText); tabContainers[tab].addChild(costText); }
User prompt
Please fix the bug: 'costText.setFill is not a function. (In 'costText.setFill(0x888888)', 'costText.setFill' is undefined)' in or related to this line: 'costText.setFill(0x888888);' Line Number: 1032
User prompt
Update with: // Update the createUpgradeText function to properly handle locked upgrades: // Inside createUpgradeText function, modify the cost text creation: var costText; if (category === 'colors' && upgrade.requires) { var required = UPGRADE_CONFIG.colors[upgrade.requires]; if (required && required.currentLevel === 0) { // Create "LOCKED" text for locked upgrades costText = new Text2("LOCKED", { size: 96, fill: 0x888888, // Gray color stroke: 0x000000, strokeThickness: 2, font: "Impact" }); } else { // Normal cost text costText = new Text2(cost + " BP", { size: 96, fill: 0xFFFF00, stroke: 0x000000, strokeThickness: 2, font: "Impact" }); } } else { // Normal cost text for non-color upgrades costText = new Text2(cost + " BP", { size: 96, fill: 0xFFFF00, stroke: 0x000000, strokeThickness: 2, font: "Impact" }); } costText.x = xOffset; costText.y = yPos + 100;
Code edit (6 edits merged)
Please save this source code
User prompt
Anchor tabs container to center x
Code edit (6 edits merged)
Please save this source code
User prompt
Equalize the spacing between menu tabs
User prompt
Lower the height of the menu text container by 80 pixels.
User prompt
Update as needed with: // Inside the createUpgradeText function, modify these values: // Adjust xOffset to move columns further apart var xOffset = isLeftColumn ? -650 : 200; // Changed from -550 and 100 // Lower all text by 120 pixels var yPos = startY + index * upgradeSpacing + 120; // Added 120 to move everything down // Update the corresponding positions nameText.x = xOffset; nameText.y = yPos; costText.x = xOffset; costText.y = yPos + 100; // Also update the hit area position hitContainer.x = xOffset; hitContainer.y = yPos;
User prompt
Update as needed with: // Inside the createUpgradeText function, modify just the left column xOffset: // Adjust xOffset for left column only var xOffset = isLeftColumn ? -650 : 100; // Changed from -550 for left column only, right column stays at 100 // Keep the rest of the positioning code the same var yPos = startY + index * upgradeSpacing; // Update positions based on these values nameText.x = xOffset; nameText.y = yPos; costText.x = xOffset; costText.y = yPos + 100; hitContainer.x = xOffset; hitContainer.y = yPos;
User prompt
Update with: // Find where createUpgradeText is defined function createUpgradeText(category, key, index, isLeftColumn, tab) { var upgrade = UPGRADE_CONFIG[category][key]; if (!upgrade) return; // EXPLICITLY set different values for each column var xOffset; if (isLeftColumn) { xOffset = -650; // Move left column further left (was -550) } else { xOffset = 100; // Keep right column at 100 } var yPos = startY + index * upgradeSpacing;
Code edit (1 edits merged)
Please save this source code
User prompt
Increase the spacing between the colors and decorations tabs by moving the decorations ones a little right.
User prompt
That moved all the tabs. Move the tabs back to where they just were and just add a slight x offset between the colors and decorations tab.
User prompt
Update with: // Add to Bubble.getBP() method, right before the return statement self.getBP = function () { let baseValue = Math.max(1, Math.floor(Math.pow(self.size, 1.4) * 0.02)); // Apply Bubble Refinement upgrade const refinementLevel = UPGRADE_CONFIG.player.bubbleRefinement.currentLevel; if (refinementLevel > 0) { baseValue *= (1 + 0.25 * refinementLevel); // +25% per level } return baseValue; };
User prompt
Update as needed with: // Add after spawnBubble function game.twinBubbles = []; // Add to where player blows bubbles (in update function where growingBubble is released) // Add after: game.growingBubble.driftX = (Math.random() * 2 - 1) * 2.5; const twinLevel = UPGRADE_CONFIG.player.twinBubbles.currentLevel; if (twinLevel > 0 && Math.random() < twinLevel * 0.05) { // 5/10/15% chance based on level const twinBubble = spawnBubble( game.growingBubble.x + (Math.random() * 40 - 20), game.growingBubble.y + (Math.random() * 40 - 20), game.growingBubble.size * 0.9, game.growingBubble.driftX * 0.8, false ); if (twinBubble) { // Link the bubbles game.twinBubbles.push({ bubble1: game.growingBubble, bubble2: twinBubble, popped: false, timestamp: LK.ticks }); } } // Add to Bubble.down method, after points calculation but before deactivation // Check if this bubble is part of twin pair let twinPair = game.twinBubbles.find(pair => (pair.bubble1 === self && !pair.popped) || (pair.bubble2 === self && !pair.popped) ); if (twinPair) { // Mark as popped twinPair.popped = true; twinPair.timestamp = LK.ticks; // Find the other bubble in the pair const otherBubble = twinPair.bubble1 === self ? twinPair.bubble2 : twinPair.bubble1; // Add bonus for twin pop const twinLevel = UPGRADE_CONFIG.player.twinBubbles.currentLevel; const bonusMultiplier = 0.5 + (0.25 * twinLevel); // 50/75/100% bonus // Pop the other bubble automatically and add bonus points if (otherBubble.visible) { const bonusPoints = Math.floor(otherBubble.getBP() * bonusMultiplier); game.addBP(bonusPoints, otherBubble.x, otherBubble.y, false); otherBubble.deactivate(); } } // Add to game.update, before updating active bubbles // Clean up old twin bubble pairs game.twinBubbles = game.twinBubbles.filter(pair => { // Remove pairs where both bubbles are gone or time expired (60 frames = 1 second) if (!pair.bubble1.visible || !pair.bubble2.visible || (pair.popped && LK.ticks - pair.timestamp > 60)) { return false; } return true; });
User prompt
Update with: // Modify where bubble size is set in clam bubbles inside updateClams function // After: bubble.activate(spawnPoint.x, spawnPoint.y, config.bubbleSize, false) if (UPGRADE_CONFIG.player.sizeVariance.currentLevel > 0) { const variance = UPGRADE_CONFIG.player.sizeVariance.currentLevel; const minIncrease = 0.1 * variance; // +10% per level to min size const maxIncrease = 0.15 * variance; // +15% per level to max size // Apply size variance const sizeMultiplier = 1 - minIncrease + (Math.random() * (minIncrease + maxIncrease)); bubble.size *= sizeMultiplier; } // Also add to the manual bubble blowing code where game.MIN_SPAWN_SIZE is used // Update the MIN_SPAWN_SIZE based on the upgrade const sizeVarianceLevel = UPGRADE_CONFIG.player.sizeVariance.currentLevel; const minSizeMultiplier = 1 + (0.1 * sizeVarianceLevel); const adjustedMinSize = game.MIN_SPAWN_SIZE * minSizeMultiplier; // Use adjustedMinSize instead of game.MIN_SPAWN_SIZE
User prompt
Update with: // Add to the part where the player releases bubbles (where growingBubble is set to null) // After: game.growingBubble = null; const breathLevel = UPGRADE_CONFIG.player.bubbleBreath.currentLevel; if (breathLevel > 0) { // Calculate chances for extra bubbles let extraBubbles = 0; // Level 1: 20% for +1 // Level 2: 40% for +1 // Level 3: 60% for +1, 20% for +2 // Level 4: 80% for +1, 40% for +2 const rand = Math.random(); if (rand < breathLevel * 0.2) { extraBubbles++; // Check for 2nd extra bubble at level 3-4 if (breathLevel >= 3 && rand < (breathLevel - 2) * 0.2) { extraBubbles++; } } // Spawn extra bubbles for (let i = 0; i < extraBubbles; i++) { const angle = Math.random() * Math.PI * 2; const distance = 20 + Math.random() * 30; const extraX = playerMask.x + Math.cos(angle) * distance; const extraY = playerMask.y + playerMask.height * 0.15 + Math.sin(angle) * distance; const extraSize = Math.max(game.MIN_SPAWN_SIZE, game.growingBubble.size * (0.6 + Math.random() * 0.2)); const extraBubble = spawnBubble(extraX, extraY, extraSize, 0, false); if (extraBubble) { extraBubble.verticalVelocity = -8 - Math.random() * 4; extraBubble.driftX = (Math.random() * 4 - 2); } } }
User prompt
Update with: // Modify the updateClams function where clam bubble production timing is calculated // Adjust after this line: var adjustedTime = Math.max(1, Math.floor(baseTime * speedMultiplier)); const qualityLevel = UPGRADE_CONFIG.machine.bubbleQuality.currentLevel; if (qualityLevel > 0) { // -10% production rate per level, +40% bubble value per level adjustedTime = Math.floor(adjustedTime * (1 + 0.1 * qualityLevel)); } // Modify the Bubble.getBP method to increase value based on quality upgrade // Add to the getBP function after Bubble Refinement calculation if (self.fromClam && UPGRADE_CONFIG.machine.bubbleQuality.currentLevel > 0) { const qualityLevel = UPGRADE_CONFIG.machine.bubbleQuality.currentLevel; baseValue *= (1 + 0.4 * qualityLevel); // +40% per level } // Add this flag when activating bubbles in updateClams bubble.fromClam = true;
User prompt
Update as needed with: // Add near game initialization game.coralContainer = new Container(); game.addChild(game.coralContainer); game.bubbleCorals = []; // Add function to create coral function createCoral() { if (game.bubbleCorals.length >= UPGRADE_CONFIG.decorations.bubbleCoral.maxAmount) { return; } // Create new coral const coralIndex = Math.floor(Math.random() * 5) + 1; // coral1 through coral5 const coral = LK.getAsset('coral' + coralIndex, { anchorX: 0.5, anchorY: 1.0, x: 100 + Math.random() * (game.width - 200), y: game.height - 10, scaleX: 0.8 + Math.random() * 0.4, scaleY: 0.8 + Math.random() * 0.4 }); game.coralContainer.addChild(coral); game.bubbleCorals.push({ sprite: coral, lastBubbleTime: 0 }); // Position corals evenly repositionCorals(); } // Helper to position corals function repositionCorals() { const spacing = game.width / (game.bubbleCorals.length + 1); game.bubbleCorals.forEach((coral, index) => { coral.sprite.x = spacing * (index + 1); }); } // Update hitContainer.down for bubbleCoral in createUpgradeText // Inside the if (game.bp >= cost) block for decorations if (category === 'decorations' && key === 'bubbleCoral') { createCoral(); } // Add to game.update // Coral bubble production game.bubbleCorals.forEach(coral => { // 5% chance per second = ~1 in 1200 frames if (Math.random() < 0.05/60 && game.activeBubbles.length < game.MAX_BUBBLES) { const bubble = spawnBubble( coral.sprite.x, coral.sprite.y - coral.sprite.height * 0.5, game.maxBubbleSize * (0.5 + Math.random() * 0.3), 0, false ); if (bubble) { bubble.verticalVelocity = -2 - Math.random() * 3; bubble.driftX = (Math.random() * 2 - 1); coral.lastBubbleTime = LK.ticks; } } });
User prompt
Update as needed with: self.colorMultiplier = 1.0; // Default multiplier self.colorPhase = Math.random() * Math.PI * 2; // Random starting phase // Add color update method to Bubble class self.updateColor = function() { // Check if color upgrades are active if (UPGRADE_CONFIG.colors.blueBubbles.currentLevel > 0) { let color = 0xFFFFFF; let multiplier = 1.0; if (UPGRADE_CONFIG.colors.prismaticBubbles.currentLevel > 0) { // Prismatic - constantly shifting color with variable multiplier self.colorPhase += 0.02; const colorValue = Math.sin(self.colorPhase) * 0.5 + 0.5; // 0 to 1 multiplier = 0.8 + colorValue * 1.2; // 0.8x to 2.0x // Generate rainbow color const r = Math.sin(self.colorPhase) * 127 + 128; const g = Math.sin(self.colorPhase + 2) * 127 + 128; const b = Math.sin(self.colorPhase + 4) * 127 + 128; color = (Math.floor(r) << 16) + (Math.floor(g) << 8) + Math.floor(b); } else if (UPGRADE_CONFIG.colors.rainbowBubbles.currentLevel > 0) { // Rainbow - randomly changes color on activation const colorChoice = Math.floor(Math.random() * 6); switch(colorChoice) { case 0: color = 0xFF0000; multiplier = 1.5; break; // Red case 1: color = 0xFFAA00; multiplier = 1.4; break; // Orange case 2: color = 0xFFFF00; multiplier = 1.3; break; // Yellow case 3: color = 0x00FF00; multiplier = 1.2; break; // Green case 4: color = 0x0000FF; multiplier = 1.1; break; // Blue case 5: color = 0xFF00FF; multiplier = 1.6; break; // Purple } } else if (UPGRADE_CONFIG.colors.pinkBubbles.currentLevel > 0) { color = 0xFF80C0; // Pink multiplier = 1.3; } else if (UPGRADE_CONFIG.colors.greenBubbles.currentLevel > 0) { color = 0x00FF80; // Green multiplier = 1.2; } else { // Blue bubbles color = 0x80C0FF; // Blue multiplier = 1.1; } self.colorTint = color; self.colorMultiplier = multiplier; // Apply tint to the sprite sprite.tint = self.colorTint; } } // Modify Bubble.activate to call updateColor self.activate = function (x, y, size, isPlayerBlown) { // Existing activate code... // Initialize color at activation self.updateColor(); } // Modify Bubble.getBP to include color multiplier self.getBP = function () { let baseValue = Math.max(1, Math.floor(Math.pow(self.size, 1.4) * 0.02)); // Apply Bubble Refinement upgrade const refinementLevel = UPGRADE_CONFIG.player.bubbleRefinement.currentLevel; if (refinementLevel > 0) { baseValue *= (1 + 0.25 * refinementLevel); } // Apply color multiplier baseValue *= self.colorMultiplier; return baseValue; }; // Add updateColor call to Bubble.update for prismatic bubbles // Add near the start of the update method if (UPGRADE_CONFIG.colors.prismaticBubbles.currentLevel > 0) { self.updateColor(); }
User prompt
Update as needed with: // Add to Bubble constructor self.colorTint = 0xFFFFFF; // Default white tint self.colorMultiplier = 1.0; // Default multiplier self.colorPhase = Math.random() * Math.PI * 2; // Random starting phase // Add color update method to Bubble class self.updateColor = function() { // Check if color upgrades are active if (UPGRADE_CONFIG.colors.blueBubbles.currentLevel > 0) { let color = 0xFFFFFF; let multiplier = 1.0; if (UPGRADE_CONFIG.colors.prismaticBubbles.currentLevel > 0) { // Prismatic - constantly shifting color with variable multiplier self.colorPhase += 0.02; const colorValue = Math.sin(self.colorPhase) * 0.5 + 0.5; // 0 to 1 multiplier = 0.8 + colorValue * 1.2; // 0.8x to 2.0x // Generate rainbow color const r = Math.sin(self.colorPhase) * 127 + 128; const g = Math.sin(self.colorPhase + 2) * 127 + 128; const b = Math.sin(self.colorPhase + 4) * 127 + 128; color = (Math.floor(r) << 16) + (Math.floor(g) << 8) + Math.floor(b); } else if (UPGRADE_CONFIG.colors.rainbowBubbles.currentLevel > 0) { // Rainbow - randomly changes color on activation const colorChoice = Math.floor(Math.random() * 6); switch(colorChoice) { case 0: color = 0xFF0000; multiplier = 1.5; break; // Red case 1: color = 0xFFAA00; multiplier = 1.4; break; // Orange case 2: color = 0xFFFF00; multiplier = 1.3; break; // Yellow case 3: color = 0x00FF00; multiplier = 1.2; break; // Green case 4: color = 0x0000FF; multiplier = 1.1; break; // Blue case 5: color = 0xFF00FF; multiplier = 1.6; break; // Purple } } else if (UPGRADE_CONFIG.colors.pinkBubbles.currentLevel > 0) { color = 0xFF80C0; // Pink multiplier = 1.3; } else if (UPGRADE_CONFIG.colors.greenBubbles.currentLevel > 0) { color = 0x00FF80; // Green multiplier = 1.2; } else { // Blue bubbles color = 0x80C0FF; // Blue multiplier = 1.1; } self.colorTint = color; self.colorMultiplier = multiplier; // Apply tint to the sprite sprite.tint = self.colorTint; } } // Modify Bubble.activate to call updateColor self.activate = function (x, y, size, isPlayerBlown) { // Existing activate code... // Initialize color at activation self.updateColor(); } // Modify Bubble.getBP to include color multiplier self.getBP = function () { let baseValue = Math.max(1, Math.floor(Math.pow(self.size, 1.4) * 0.02)); // Apply Bubble Refinement upgrade const refinementLevel = UPGRADE_CONFIG.player.bubbleRefinement.currentLevel; if (refinementLevel > 0) { baseValue *= (1 + 0.25 * refinementLevel); } // Apply color multiplier baseValue *= self.colorMultiplier; return baseValue; }; // Add updateColor call to Bubble.update for prismatic bubbles // Add near the start of the update method if (UPGRADE_CONFIG.colors.prismaticBubbles.currentLevel > 0) { self.updateColor(); }
User prompt
Please fix the bug: 'self.updateColor is not a function. (In 'self.updateColor()', 'self.updateColor' is undefined)' in or related to this line: 'self.updateColor();' Line Number: 75
User prompt
Tint the bubbles blue.
===================================================================
--- original.js
+++ change.js
@@ -961,27 +961,28 @@
}
return 'bubbles'; // Default
}
// Function to create upgrade text
-function createUpgradeText(category, key, index, isLeftColumn) {
+function createUpgradeText(category, key, index, isLeftColumn, tab) {
var upgrade = UPGRADE_CONFIG[category][key];
+ if (!upgrade) {
+ return;
+ } // Skip if upgrade doesn't exist
var xOffset = isLeftColumn ? -550 : 100;
var yPos = startY + index * upgradeSpacing;
- // Create hit container first (so it's behind text)
+ // Create hit container
var hitContainer = new Container();
- // Create a shape for the hit area (can make visible for debugging)
var hitArea = LK.getAsset('blower', {
width: 400,
height: 150,
color: 0xFFFFFF,
- alpha: 0.0 // Set to 0.2 to see hit areas
+ alpha: 0.0
});
hitContainer.addChild(hitArea);
- hitContainer.x = xOffset; // Center on the text position
- hitContainer.y = yPos; // Align with the text
- // Adjust the hitArea position within the container to center properly
- hitArea.x = 0; // Center horizontally
- hitArea.y = -40; // Slightly above text to cover both name and cost
+ hitContainer.x = xOffset;
+ hitContainer.y = yPos;
+ hitArea.x = 0;
+ hitArea.y = -40;
// Create name text
var nameText = new Text2(upgrade.name, {
size: 96,
fill: 0xFFFFFF,
@@ -1001,72 +1002,77 @@
font: "Impact"
});
costText.x = xOffset;
costText.y = yPos + 100;
- // Add click handler to hit container
+ // Special handling for color upgrades with requirements
+ if (category === 'colors' && upgrade.requires) {
+ var required = UPGRADE_CONFIG.colors[upgrade.requires];
+ if (required && required.currentLevel === 0) {
+ costText.setText("LOCKED");
+ costText.setFill(0x888888);
+ }
+ }
+ // Add click handler
hitContainer.down = function () {
var cost = getUpgradeCost(upgrade);
+ // Check if this is a locked color upgrade
+ if (category === 'colors' && upgrade.requires) {
+ var required = UPGRADE_CONFIG.colors[upgrade.requires];
+ if (required && required.currentLevel === 0) {
+ game.showError("Unlock " + required.name + " first!");
+ return true;
+ }
+ }
if (game.bp >= cost) {
- if (category === 'machines') {
- var totalClams = UPGRADE_CONFIG.machines.basicClam.amount + UPGRADE_CONFIG.machines.advancedClam.amount + UPGRADE_CONFIG.machines.premiumClam.amount;
- if (key === 'basicClam' && totalClams < 4) {
+ if (upgrade.amount !== undefined) {
+ // For clams and decorations with amount
+ if (upgrade.amount < (upgrade.maxAmount || 999)) {
upgrade.amount++;
game.bp -= cost;
- } else if (key === 'advancedClam' && UPGRADE_CONFIG.machines.basicClam.amount > UPGRADE_CONFIG.machines.advancedClam.amount) {
- upgrade.amount++;
- game.bp -= cost;
- } else if (key === 'premiumClam' && UPGRADE_CONFIG.machines.advancedClam.amount > UPGRADE_CONFIG.machines.premiumClam.amount) {
- upgrade.amount++;
- game.bp -= cost;
- } else {
- game.showError("Not enough space for more clams!");
- return true;
- }
- bpText.setText(formatBP(game.bp) + " BP");
- // Update cost text based on whether more can be purchased
- if (totalClams >= 4 && key === 'basicClam' || UPGRADE_CONFIG.machines.basicClam.amount <= UPGRADE_CONFIG.machines.advancedClam.amount && key === 'advancedClam' || UPGRADE_CONFIG.machines.advancedClam.amount <= UPGRADE_CONFIG.machines.premiumClam.amount && key === 'premiumClam') {
- costText.setText("SOLD OUT");
- } else {
+ bpText.setText(formatBP(game.bp) + " BP");
costText.setText(getUpgradeCost(upgrade) + " BP");
+ // Update clam visuals if needed
+ if (category === 'machines') {
+ updateClamVisuals();
+ }
+ // Update decoration visuals if implemented
+ if (category === 'decorations') {
+ // TODO: Implement decoration visuals
+ }
}
- updateClamVisuals();
} else if (upgrade.currentLevel < upgrade.maxLevel) {
+ // For regular upgrades with levels
upgrade.currentLevel++;
game.bp -= cost;
- // Add this section to update maxBubbleSize when lung capacity changes
- if (category === 'player' && key === 'lungCapacity') {
- var baseSize = UPGRADE_EFFECTS.lungCapacity.baseValue;
- var increasePercent = UPGRADE_EFFECTS.lungCapacity.incrementPercent;
- var multiplier = 1 + increasePercent / 100 * upgrade.currentLevel;
- game.maxBubbleSize = baseSize * multiplier;
- }
bpText.setText(formatBP(game.bp) + " BP");
- // Update cost text based on whether more levels can be purchased
+ // Update cost text
if (upgrade.currentLevel >= upgrade.maxLevel) {
costText.setText("SOLD OUT");
} else {
costText.setText(getUpgradeCost(upgrade) + " BP");
}
- if (key === 'quickBreath') {
- game.growthRate = UPGRADE_EFFECTS.quickBreath.baseValue * (1 + UPGRADE_EFFECTS.quickBreath.incrementPercent / 100 * upgrade.currentLevel);
+ // Handle specific upgrade effects
+ if (category === 'player') {
+ if (key === 'lungCapacity') {
+ var baseSize = UPGRADE_EFFECTS.lungCapacity.baseValue;
+ var increasePercent = UPGRADE_EFFECTS.lungCapacity.incrementPercent;
+ var multiplier = 1 + increasePercent / 100 * upgrade.currentLevel;
+ game.maxBubbleSize = baseSize * multiplier;
+ } else if (key === 'quickBreath') {
+ game.growthRate = UPGRADE_EFFECTS.quickBreath.baseValue * (1 + UPGRADE_EFFECTS.quickBreath.incrementPercent / 100 * upgrade.currentLevel);
+ }
+ // Other upgrade effects will be implemented later
}
}
} else {
- // Show not enough BP error
game.showError("Not enough BP!");
}
return true;
};
- var tabName = getTabForUpgrade(category, key);
- var targetContainer = tabContainers[tabName];
- // Add fallback in case the container doesn't exist
- if (!targetContainer) {
- console.log("Warning: Tab '" + tabName + "' not found for " + category + "." + key);
- targetContainer = tabContainers[menuTabs[0]]; // Default to first tab
- }
- targetContainer.addChild(hitContainer);
- targetContainer.addChild(nameText);
- targetContainer.addChild(costText);
+ // Add elements to the appropriate tab container
+ tabContainers[tab].addChild(hitContainer);
+ tabContainers[tab].addChild(nameText);
+ tabContainers[tab].addChild(costText);
}
// Replace the existing code for creating upgrade texts with this:
Object.keys(tabContainers).forEach(function (tab) {
// Clear any existing content
A treasure chest with gold coins. Cartoon.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
A golden skull with diamonds for eyes. Cartoon.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
A golden necklace with a ruby pendant. Cartoon.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
A filled in white circle.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
A yellow star. Cartoon.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
a game logo for a game called 'Bubble Blower Tycoon' about a happy purple pufferfish with yellow fins and spines that builds an underwater empire of bubbles. Cartoon. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
an SVG of the word 'Start'. word should be yellow and the font should look like its made out of bubbles. cartoon. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
bubblelow
Sound effect
backgroundmusic
Music
bubblehigh
Sound effect
bubble1
Sound effect
bubble2
Sound effect
bubble3
Sound effect
bubble4
Sound effect
blowing
Sound effect
bubbleshoot
Sound effect
fishtank
Sound effect
menuopen
Sound effect
upgrade
Sound effect
jellyfish
Sound effect
titlemusic
Music
startbutton
Sound effect