User prompt
update with: // Find this line in hitContainer.down function where clam amount is incremented: upgrade.amount++; // Immediately after this line, add: console.log("Clam purchased, new amount:", upgrade.amount); // Then add the check code: var totalClams = UPGRADE_CONFIG.machines.basicClam.amount + UPGRADE_CONFIG.machines.advancedClam.amount + UPGRADE_CONFIG.machines.premiumClam.amount; console.log("Total clams now:", totalClams); // Direct update approach: if (totalClams >= 4 && key === 'basicClam') { console.log("Should set basic clam to SOLD OUT"); costText.setText("SOLD OUT"); costText.fill = 0x888888; // Gray color }
User prompt
update with: // After upgrading a clam and seeing totalClams >= 4: console.log("Forcing tab refresh for clams"); // Clear existing tab container while (tabContainers['clams'].children.length > 0) { tabContainers['clams'].children[0].destroy(); } // Recreate all upgrades for the tab if (tabColumns['clams'] && tabColumns['clams'].left) { tabColumns['clams'].left.forEach(function (upgrade, index) { createUpgradeText(upgrade[0], upgrade[1], index, true, 'clams'); }); } if (tabColumns['clams'] && tabColumns['clams'].right) { tabColumns['clams'].right.forEach(function (upgrade, index) { createUpgradeText(upgrade[0], upgrade[1], index, false, 'clams'); }); }
User prompt
Update with: if (category === 'machines' && upgrade.amount !== undefined) { if (upgrade.amount < (upgrade.maxAmount || 999)) { upgrade.amount++; game.bp -= cost; bpText.setText(formatBP(game.bp) + " BP"); costText.setText(getUpgradeCost(upgrade) + " BP"); // Add this line: refreshUpgradeTab('clams'); // Refresh entire clams tab if (category === 'machines') { updateClamVisuals(); } } }
User prompt
Update with: hitContainer.down = function() { var cost = getUpgradeCost(upgrade); // For machines, check clam limit first if (category === 'machines') { var totalClams = UPGRADE_CONFIG.machines.basicClam.amount + UPGRADE_CONFIG.machines.advancedClam.amount + UPGRADE_CONFIG.machines.premiumClam.amount; if (totalClams >= 4) { if (key === 'basicClam') { costText.setText("SOLD OUT"); costText.fill = 0x888888; return true; } // Only allow upgrades if we're replacing lower tier clams if (key === 'advancedClam' && UPGRADE_CONFIG.machines.basicClam.amount > 0) { // Existing upgrade logic... } else if (key === 'premiumClam' && (UPGRADE_CONFIG.machines.basicClam.amount > 0 || UPGRADE_CONFIG.machines.advancedClam.amount > 0)) { // Existing upgrade logic... } else { game.showError("Maximum of 4 clams reached!"); return true; } } } // Then check if player can afford it if (game.bp >= cost) { // Rest of existing purchase logic... } else { game.showError("Not enough BP!"); } return true; };
User prompt
Update with: function refreshUpgradeTab(tabName) { // Existing refresh code... if (tabName === 'clams') { var totalClams = UPGRADE_CONFIG.machines.basicClam.amount + UPGRADE_CONFIG.machines.advancedClam.amount + UPGRADE_CONFIG.machines.premiumClam.amount; if (totalClams >= 4) { // Find basic clam cost text and update it tabContainers[tabName].children.forEach(function(child) { if (child.text && child.text.includes("BP")) { var nameText = tabContainers[tabName].children.find(function(c) { return c.text === UPGRADE_CONFIG.machines.basicClam.name; }); if (nameText && child.y > nameText.y && child.y < nameText.y + 150) { child.setText("SOLD OUT"); child.fill = 0x888888; } } }); } } }
User prompt
Update with: function getUpgradeCost(upgrade) { if (upgrade.amount !== undefined) { // For clams, consider total clams when calculating cost if (upgrade.name.includes('Clam')) { var totalClams = UPGRADE_CONFIG.machines.basicClam.amount + UPGRADE_CONFIG.machines.advancedClam.amount + UPGRADE_CONFIG.machines.premiumClam.amount; return Math.floor(upgrade.baseCost * Math.pow(upgrade.costScale, totalClams)); } return Math.floor(upgrade.baseCost * Math.pow(upgrade.costScale, upgrade.amount)); } else { return Math.floor(upgrade.baseCost * Math.pow(upgrade.costScale, upgrade.currentLevel)); } }
User prompt
Update as needed: if (category === 'machines') { var totalClams = UPGRADE_CONFIG.machines.basicClam.amount + UPGRADE_CONFIG.machines.advancedClam.amount + UPGRADE_CONFIG.machines.premiumClam.amount; if (totalClams >= 4) { // Basic clam - just show sold out if (key === 'basicClam') { costText.setText("SOLD OUT"); costText.fill = 0x888888; return true; } // Advanced clam upgrade - can replace basic if (key === 'advancedClam' && UPGRADE_CONFIG.machines.basicClam.amount > 0) { if (game.bp >= cost) { UPGRADE_CONFIG.machines.basicClam.amount--; UPGRADE_CONFIG.machines.advancedClam.amount++; game.bp -= cost; bpText.setText(formatBP(game.bp) + " BP"); updateClamVisuals(); refreshUpgradeTab('clams'); } return true; } // Premium clam upgrade - can replace either basic or advanced if (key === 'premiumClam') { // First try to replace basic clam if (UPGRADE_CONFIG.machines.basicClam.amount > 0) { if (game.bp >= cost) { UPGRADE_CONFIG.machines.basicClam.amount--; UPGRADE_CONFIG.machines.premiumClam.amount++; game.bp -= cost; bpText.setText(formatBP(game.bp) + " BP"); updateClamVisuals(); refreshUpgradeTab('clams'); } return true; } // If no basic clams, try to replace advanced else if (UPGRADE_CONFIG.machines.advancedClam.amount > 0) { if (game.bp >= cost) { UPGRADE_CONFIG.machines.advancedClam.amount--; UPGRADE_CONFIG.machines.premiumClam.amount++; game.bp -= cost; bpText.setText(formatBP(game.bp) + " BP"); updateClamVisuals(); refreshUpgradeTab('clams'); } return true; } } game.showError("Maximum of 4 clams reached!"); return true; } // Normal purchase logic for when total clams < 4 if (game.bp >= cost) { upgrade.amount++; game.bp -= cost; bpText.setText(formatBP(game.bp) + " BP"); costText.setText(getUpgradeCost(upgrade) + " BP"); updateClamVisuals(); refreshUpgradeTab('clams'); } else { game.showError("Not enough BP!"); } return true; }
Code edit (1 edits merged)
Please save this source code
User prompt
update as needed with: hitContainer.down = function () { var cost = getUpgradeCost(upgrade); // Special handling for colors that are already purchased if (category === 'colors' && upgrade.currentLevel > 0) { // Toggle this color as active if (UPGRADE_CONFIG.gameSettings.activeColor === key) { // If already active, switch to auto UPGRADE_CONFIG.gameSettings.activeColor = "auto"; game.showMessage("Auto color mode"); } else { // Otherwise activate this color UPGRADE_CONFIG.gameSettings.activeColor = key; game.showMessage(upgrade.name + " activated"); } // Refresh the tab to update the text displays refreshUpgradeTab('colors'); return true; } // Regular upgrade purchase logic 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; // Check if already at max clams if (totalClams >= 4) { if (key === 'basicClam') { updateCostText(category, key, "SOLD OUT", 0x888888); return true; // Add return here } // If trying to upgrade (e.g. basic to advanced) if (key === 'advancedClam' && UPGRADE_CONFIG.machines.basicClam.amount > 0) { // Replace a basic clam with advanced UPGRADE_CONFIG.machines.basicClam.amount--; upgrade.amount++; game.bp -= cost; bpText.setText(formatBP(game.bp) + " BP"); updateClamVisuals(); return true; } else if (key === 'premiumClam' && (UPGRADE_CONFIG.machines.basicClam.amount > 0 || UPGRADE_CONFIG.machines.advancedClam.amount > 0)) { // Replace lower tier clam with premium if (UPGRADE_CONFIG.machines.basicClam.amount > 0) { UPGRADE_CONFIG.machines.basicClam.amount--; } else { UPGRADE_CONFIG.machines.advancedClam.amount--; } upgrade.amount++; game.bp -= cost; bpText.setText(formatBP(game.bp) + " BP"); updateClamVisuals(); return true; } else { game.showError("Maximum of 4 clams reached!"); return true; } } } 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"); updateCostText(category, key, getUpgradeCost(upgrade) + " BP", 0xFFFF00); // Update visuals if (category === 'machines') { updateClamVisuals(); } else if (category === 'decorations') { if (key === 'bubbleCoral') { updateCoralDecorations(); } else if (key === 'sunkenTreasures') { updateTreasureDecorations(); } } } } else if (upgrade.currentLevel < upgrade.maxLevel) { // For regular upgrades with levels upgrade.currentLevel++; game.bp -= cost; bpText.setText(formatBP(game.bp) + " BP"); // If this is a color upgrade, update the UI if (category === 'colors') { refreshUpgradeTab('colors'); return true; } // Update cost text if (upgrade.currentLevel >= upgrade.maxLevel) { updateCostText(category, key, "SOLD OUT", 0x888888); } else { updateCostText(category, key, getUpgradeCost(upgrade) + " BP", 0xFFFF00); } // 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); } } } } else { game.showError("Not enough BP!"); } return true; };
Code edit (1 edits merged)
Please save this source code
User prompt
update with: function updateClamVisuals() { // Clear existing clams while (clamContainer.children.length) { clamContainer.children[0].destroy(); } // Total number of clams to display var totalClams = UPGRADE_CONFIG.machines.basicClam.amount + UPGRADE_CONFIG.machines.advancedClam.amount + UPGRADE_CONFIG.machines.premiumClam.amount; // Create array to hold exactly the right number of clams var clamTypes = new Array(totalClams); // Fill all positions with null initially for (var i = 0; i < clamTypes.length; i++) { clamTypes[i] = null; } // Fill with premium clams first (highest priority) var premiumCount = UPGRADE_CONFIG.machines.premiumClam.amount; for (var i = 0; i < premiumCount; i++) { if (i < clamTypes.length) { clamTypes[i] = 'premiumClam'; } } // Fill with advanced clams next var advancedCount = UPGRADE_CONFIG.machines.advancedClam.amount; for (var i = 0; i < advancedCount; i++) { if (i + premiumCount < clamTypes.length) { clamTypes[i + premiumCount] = 'advancedClam'; } } // Fill remaining slots with basic clams var basicCount = UPGRADE_CONFIG.machines.basicClam.amount; for (var i = 0; i < basicCount; i++) { if (i + premiumCount + advancedCount < clamTypes.length) { clamTypes[i + premiumCount + advancedCount] = 'basicClam'; } } // Place clams game.clamSpawnPoints = []; clamTypes.forEach(function (type, i) { if (!type) return; // Skip null entries var isRight = i % 2 === 1; var baseX = isRight ? rightStart : leftStart; var direction = isRight ? -1 : 1; var position = Math.floor(i / 2); var x = baseX + direction * position * spacing; var sprite = LK.getAsset(type, { anchorX: 0.5, anchorY: 1, x: x, y: y, scaleX: isRight ? -0.5 : 0.5, // Flip right-side clams scaleY: 0.5 }); // Store spawn point for this clam game.clamSpawnPoints.push({ x: x + (isRight ? -75 : 75), // 25% from edge y: y - 50, // Slightly above clam type: type, isRight: isRight }); clamContainer.addChild(sprite); }); console.log("After visual update - Clam types: " + clamTypes.join(", ")); }
User prompt
Please fix the bug: 'ReferenceError: leftStart is not defined' in or related to this line: 'var baseX = isRight ? rightStart : leftStart;' Line Number: 1647
User prompt
update as needed with: function updateClamVisuals() { // Clear existing clams while (clamContainer.children.length) { clamContainer.children[0].destroy(); } // Define positioning variables (these were likely defined elsewhere) var leftStart = game.width * 0.1; var rightStart = game.width * 0.9; var spacing = 250; var y = game.height - 100; // Total number of clams to display var totalClams = UPGRADE_CONFIG.machines.basicClam.amount + UPGRADE_CONFIG.machines.advancedClam.amount + UPGRADE_CONFIG.machines.premiumClam.amount; // Create array to hold exactly the right number of clams var clamTypes = new Array(totalClams); // Fill all positions with null initially for (var i = 0; i < clamTypes.length; i++) { clamTypes[i] = null; } // Fill with premium clams first (highest priority) var premiumCount = UPGRADE_CONFIG.machines.premiumClam.amount; for (var i = 0; i < premiumCount; i++) { if (i < clamTypes.length) { clamTypes[i] = 'premiumClam'; } } // Fill with advanced clams next var advancedCount = UPGRADE_CONFIG.machines.advancedClam.amount; for (var i = 0; i < advancedCount; i++) { if (i + premiumCount < clamTypes.length) { clamTypes[i + premiumCount] = 'advancedClam'; } } // Fill remaining slots with basic clams var basicCount = UPGRADE_CONFIG.machines.basicClam.amount; for (var i = 0; i < basicCount; i++) { if (i + premiumCount + advancedCount < clamTypes.length) { clamTypes[i + premiumCount + advancedCount] = 'basicClam'; } } // Place clams game.clamSpawnPoints = []; clamTypes.forEach(function (type, i) { if (!type) return; // Skip null entries var isRight = i % 2 === 1; var baseX = isRight ? rightStart : leftStart; var direction = isRight ? -1 : 1; var position = Math.floor(i / 2); var x = baseX + direction * position * spacing; var sprite = LK.getAsset(type, { anchorX: 0.5, anchorY: 1, x: x, y: y, scaleX: isRight ? -0.5 : 0.5, // Flip right-side clams scaleY: 0.5 }); // Store spawn point for this clam game.clamSpawnPoints.push({ x: x + (isRight ? -75 : 75), // 25% from edge y: y - 50, // Slightly above clam type: type, isRight: isRight }); clamContainer.addChild(sprite); }); console.log("After visual update - Clam types: " + clamTypes.join(", ")); }
User prompt
update with: // Advanced clam - replace exactly one basic clam if (key === 'advancedClam') { if (UPGRADE_CONFIG.machines.basicClam.amount > 0) { // Replace one basic clam UPGRADE_CONFIG.machines.basicClam.amount--; upgrade.amount++; game.bp -= cost; // Update BP text bpText.setText(formatBP(game.bp) + " BP"); // Force a complete refresh of the clams tab refreshUpgradeTab('clams'); // Update visual representation of clams updateClamVisuals(); return true; } else { game.showError("No basic clams to upgrade!"); return true; } }
Code edit (2 edits merged)
Please save this source code
User prompt
Update with: // When creating tab text initially, set the color based on whether it's the current tab var tabText = new Text2(tab.charAt(0).toUpperCase() + tab.slice(1), { size: 80, fill: tab === currentTab ? 0xFFFF00 : 0xFFFFFF, // Yellow if active, white otherwise stroke: 0x000000, strokeThickness: 3, font: "Impact" }); // Store reference to the text object tabButtons[tab].textRef = tabText; // Then in the tab.down function, update to also change text color: tabButton.down = function () { if (tab !== currentTab) { // Update tab appearance Object.keys(tabButtons).forEach(function (t) { if (tabButtons[t]) { tabButtons[t].alpha = t === tab ? 1.0 : 0.7; // Change text color if (tabButtons[t].textRef) { tabButtons[t].textRef.fill = t === tab ? 0xFFFF00 : 0xFFFFFF; } } }); // Hide current tab content, show new tab content if (tabContainers[currentTab]) { tabContainers[currentTab].visible = false; } if (tabContainers[tab]) { tabContainers[tab].visible = true; } // Update current tab currentTab = tab; } return true; };
Code edit (1 edits merged)
Please save this source code
User prompt
Update with: var tabText = new Text2(tab.charAt(0).toUpperCase() + tab.slice(1), { size: 80, fill: tab === currentTab ? 0xFFFF00 : 0xFFFFFF, // Set initial color based on current tab stroke: 0x000000, strokeThickness: 3, font: "Impact" }); tabText.anchor = { x: 0.5, y: 0.5 }; tabText.x = tabButton.x; tabText.y = tabHeight / 2; // Store reference to text tabTextRefs[tab] = tabText;
User prompt
Update with: tabButton.down = function () { if (tab !== currentTab) { // Update tab appearance Object.keys(tabButtons).forEach(function (t) { if (tabButtons[t]) { tabButtons[t].alpha = t === tab ? 1.0 : 0.7; } }); // Update text colors Object.keys(tabTextRefs).forEach(function (t) { tabTextRefs[t].fill = t === tab ? 0xFFFF00 : 0xFFFFFF; }); // Hide current tab content, show new tab content if (tabContainers[currentTab]) { tabContainers[currentTab].visible = false; } if (tabContainers[tab]) { tabContainers[tab].visible = true; } // Update current tab currentTab = tab; } return true; };
User prompt
Update with: var activeTabIndicator = LK.getAsset('blower', { width: tabWidth, height: 10, // Small bar at bottom of tab color: 0xFFFF00, // Yellow indicator alpha: 1.0 }); // Position at the bottom of the current tab activeTabIndicator.x = tabButtons[currentTab].x - tabWidth/2; activeTabIndicator.y = tabHeight - 5; // Add to tab container tabsContainer.addChild(activeTabIndicator);
User prompt
Please fix the bug: 'undefined is not an object (evaluating 'tabButtons[currentTab].x')' in or related to this line: 'activeTabIndicator.x = tabButtons[currentTab].x - tabWidth / 2;' Line Number: 1026
User prompt
Update as needed with: // Add this code after the forEach closing bracket but before adding the tabsContainer to menuContainer // Create active tab indicator var activeTabIndicator = LK.getAsset('blower', { width: tabWidth, height: 10, // Small bar at bottom of tab color: 0xFFFF00, // Yellow indicator alpha: 1.0 }); // Position at the bottom of the current tab activeTabIndicator.x = tabButtons[currentTab].x - tabWidth/2; activeTabIndicator.y = tabHeight - 5; // Add to tab container tabsContainer.addChild(activeTabIndicator); // THEN FIND AND REPLACE ALL THE tabButton.down FUNCTIONS // Inside the menuTabs.forEach loop, find the tabButton.down function and replace it with this: tabButton.down = function () { if (tab !== currentTab) { // Update tab appearance Object.keys(tabButtons).forEach(function (t) { if (tabButtons[t]) { tabButtons[t].alpha = t === tab ? 1.0 : 0.7; } }); // Move the indicator to the new tab activeTabIndicator.x = tabButtons[tab].x - tabWidth/2; // Hide current tab content, show new tab content if (tabContainers[currentTab]) { tabContainers[currentTab].visible = false; } if (tabContainers[tab]) { tabContainers[tab].visible = true; } // Update current tab currentTab = tab; } return true; };
User prompt
Update with: tabButton.down = function () { if (tab !== currentTab) { // Update tab appearance Object.keys(tabButtons).forEach(function (t) { if (tabButtons[t]) { tabButtons[t].alpha = t === tab ? 1.0 : 0.7; } }); // Move the indicator to the new tab instead of creating a new one activeTabIndicator.x = tabButton.x - tabWidth/2; // Hide current tab content, show new tab content if (tabContainers[currentTab]) { tabContainers[currentTab].visible = false; } if (tabContainers[tab]) { tabContainers[tab].visible = true; } // Update current tab currentTab = tab; } return true; };
User prompt
Update with: // AFTER CREATING ACTIVE TAB INDICATOR, STORE IT IN GAME OBJECT FOR REFERENCE // Store indicator in game object to access it globally game.activeTabIndicator = activeTabIndicator; // THEN REPLACE ALL tabButton.down FUNCTIONS WITH THIS tabButton.down = function () { if (tab !== currentTab) { // Update tab appearance Object.keys(tabButtons).forEach(function (t) { if (tabButtons[t]) { tabButtons[t].alpha = t === tab ? 1.0 : 0.7; } }); // Remove old indicator from display if (game.activeTabIndicator) { tabsContainer.removeChild(game.activeTabIndicator); } // Create new indicator for current tab var newIndicator = LK.getAsset('blower', { width: tabWidth, height: 10, color: 0xFFFF00, alpha: 1.0 }); // Position at the bottom of this tab newIndicator.x = tabButton.x - tabWidth/2; newIndicator.y = tabHeight - 5; // Add to container and store reference tabsContainer.addChild(newIndicator); game.activeTabIndicator = newIndicator; // Hide current tab content, show new tab content if (tabContainers[currentTab]) { tabContainers[currentTab].visible = false; } if (tabContainers[tab]) { tabContainers[tab].visible = true; } // Update current tab currentTab = tab; } return true; };
User prompt
Update just this: game.tabIndicators = []; game.tabIndicators.push(activeTabIndicator);
===================================================================
--- original.js
+++ change.js
@@ -1215,103 +1215,63 @@
return true;
}
}
if (game.bp >= cost) {
- // Handle clam purchasing/replacement
if (category === 'machines') {
var totalClams = UPGRADE_CONFIG.machines.basicClam.amount + UPGRADE_CONFIG.machines.advancedClam.amount + UPGRADE_CONFIG.machines.premiumClam.amount;
- // Check if at max clams
+ // Check if already at max clams
if (totalClams >= 4) {
- // Basic clams are sold out when at max
if (key === 'basicClam') {
updateCostText(category, key, "SOLD OUT", 0x888888);
- return true;
+ return true; // Add return here
}
- // Advanced clam - replace exactly one basic clam
- if (key === 'advancedClam') {
+ // If trying to upgrade (e.g. basic to advanced)
+ if (key === 'advancedClam' && UPGRADE_CONFIG.machines.basicClam.amount > 0) {
+ // Replace a basic clam with advanced
+ UPGRADE_CONFIG.machines.basicClam.amount--;
+ upgrade.amount++;
+ game.bp -= cost;
+ bpText.setText(formatBP(game.bp) + " BP");
+ updateClamVisuals();
+ return true;
+ } else if (key === 'premiumClam' && (UPGRADE_CONFIG.machines.basicClam.amount > 0 || UPGRADE_CONFIG.machines.advancedClam.amount > 0)) {
+ // Replace lower tier clam with premium
if (UPGRADE_CONFIG.machines.basicClam.amount > 0) {
- // Replace one basic clam
UPGRADE_CONFIG.machines.basicClam.amount--;
- upgrade.amount++;
- game.bp -= cost;
- // Update UI
- bpText.setText(formatBP(game.bp) + " BP");
- updateCostText(category, key, getUpgradeCost(upgrade) + " BP", 0xFFFF00);
- updateClamVisuals();
- // Force refresh cost text for basic clams
- if (UPGRADE_CONFIG.machines.basicClam.amount === 0) {
- updateCostText('machines', 'basicClam', "SOLD OUT", 0x888888);
- } else {
- updateCostText('machines', 'basicClam', getUpgradeCost(UPGRADE_CONFIG.machines.basicClam) + " BP", 0xFFFF00);
- }
- return true;
} else {
- game.showError("No basic clams to upgrade!");
- return true;
- }
- }
- // Premium clam - replace one lower tier clam
- else if (key === 'premiumClam') {
- if (UPGRADE_CONFIG.machines.basicClam.amount > 0) {
- UPGRADE_CONFIG.machines.basicClam.amount--;
- upgrade.amount++;
- } else if (UPGRADE_CONFIG.machines.advancedClam.amount > 0) {
UPGRADE_CONFIG.machines.advancedClam.amount--;
- upgrade.amount++;
- } else {
- game.showError("No clams to upgrade!");
- return true;
}
- // Update UI
+ upgrade.amount++;
game.bp -= cost;
bpText.setText(formatBP(game.bp) + " BP");
- updateCostText(category, key, getUpgradeCost(upgrade) + " BP", 0xFFFF00);
updateClamVisuals();
- // Force refresh cost text for both clam types
- if (UPGRADE_CONFIG.machines.basicClam.amount === 0) {
- updateCostText('machines', 'basicClam', "SOLD OUT", 0x888888);
- } else {
- updateCostText('machines', 'basicClam', getUpgradeCost(UPGRADE_CONFIG.machines.basicClam) + " BP", 0xFFFF00);
- }
- if (UPGRADE_CONFIG.machines.advancedClam.amount === 0) {
- updateCostText('machines', 'advancedClam', "SOLD OUT", 0x888888);
- } else {
- updateCostText('machines', 'advancedClam', getUpgradeCost(UPGRADE_CONFIG.machines.advancedClam) + " BP", 0xFFFF00);
- }
return true;
} else {
game.showError("Maximum of 4 clams reached!");
return true;
}
}
- // Not at max clams, proceed with normal purchase
- upgrade.amount++;
- game.bp -= cost;
- bpText.setText(formatBP(game.bp) + " BP");
- updateCostText(category, key, getUpgradeCost(upgrade) + " BP", 0xFFFF00);
- updateClamVisuals();
- return true;
}
- // Handle regular amount-based upgrades (decorations)
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");
updateCostText(category, key, getUpgradeCost(upgrade) + " BP", 0xFFFF00);
- // Update visuals for decorations
- if (category === 'decorations') {
+ // Update visuals
+ if (category === 'machines') {
+ updateClamVisuals();
+ } else if (category === 'decorations') {
if (key === 'bubbleCoral') {
updateCoralDecorations();
} else if (key === 'sunkenTreasures') {
updateTreasureDecorations();
}
}
}
- return true;
- }
- // Handle level-based upgrades
- else if (upgrade.currentLevel < upgrade.maxLevel) {
+ } else if (upgrade.currentLevel < upgrade.maxLevel) {
+ // For regular upgrades with levels
upgrade.currentLevel++;
game.bp -= cost;
bpText.setText(formatBP(game.bp) + " BP");
// If this is a color upgrade, update the UI
@@ -1618,36 +1578,47 @@
}
}
// Function to update clam visuals
function updateClamVisuals() {
+ // Clear existing clams
while (clamContainer.children.length) {
clamContainer.children[0].destroy();
}
- var leftStart = game.width * 0.1; // Moved further left from 0.15
- var rightStart = game.width * 0.9; // Moved further right from 0.85
- var spacing = 250; // Increased from 150
- var y = game.height - 100;
- // We'll store type of each clam position (0-3)
- var clamTypes = [];
- // Fill with basic clams first
- for (var i = 0; i < UPGRADE_CONFIG.machines.basicClam.amount; i++) {
- clamTypes.push('basicClam');
+ // Total number of clams to display
+ var totalClams = UPGRADE_CONFIG.machines.basicClam.amount + UPGRADE_CONFIG.machines.advancedClam.amount + UPGRADE_CONFIG.machines.premiumClam.amount;
+ // Create array to hold exactly the right number of clams
+ var clamTypes = new Array(totalClams);
+ // Fill all positions with null initially
+ for (var i = 0; i < clamTypes.length; i++) {
+ clamTypes[i] = null;
}
- // Replace some with advanced
- for (var i = 0; i < UPGRADE_CONFIG.machines.advancedClam.amount; i++) {
- if (clamTypes[i]) {
- clamTypes[i] = 'advancedClam';
+ // Fill with premium clams first (highest priority)
+ var premiumCount = UPGRADE_CONFIG.machines.premiumClam.amount;
+ for (var i = 0; i < premiumCount; i++) {
+ if (i < clamTypes.length) {
+ clamTypes[i] = 'premiumClam';
}
}
- // Replace some with premium
- for (var i = 0; i < UPGRADE_CONFIG.machines.premiumClam.amount; i++) {
- if (clamTypes[i]) {
- clamTypes[i] = 'premiumClam';
+ // Fill with advanced clams next
+ var advancedCount = UPGRADE_CONFIG.machines.advancedClam.amount;
+ for (var i = 0; i < advancedCount; i++) {
+ if (i + premiumCount < clamTypes.length) {
+ clamTypes[i + premiumCount] = 'advancedClam';
}
}
+ // Fill remaining slots with basic clams
+ var basicCount = UPGRADE_CONFIG.machines.basicClam.amount;
+ for (var i = 0; i < basicCount; i++) {
+ if (i + premiumCount + advancedCount < clamTypes.length) {
+ clamTypes[i + premiumCount + advancedCount] = 'basicClam';
+ }
+ }
// Place clams
game.clamSpawnPoints = [];
clamTypes.forEach(function (type, i) {
+ if (!type) {
+ return;
+ } // Skip null entries
var isRight = i % 2 === 1;
var baseX = isRight ? rightStart : leftStart;
var direction = isRight ? -1 : 1;
var position = Math.floor(i / 2);
@@ -1671,8 +1642,9 @@
isRight: isRight
});
clamContainer.addChild(sprite);
});
+ console.log("After visual update - Clam types: " + clamTypes.join(", "));
}
// Function to update clams (spawn bubbles)
function updateClams() {
if (!game.clamSpawnPoints) {
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