User prompt
update with: // Handle decoration upgrades else if (category === 'decorations') { if (upgrade.amount >= upgrade.maxAmount) { costText.setText("SOLD OUT"); costText.fill = 0x888888; } else { costText.setText(getUpgradeCost(upgrade) + " BP"); costText.fill = 0xFFFF00; } }
Code edit (2 edits merged)
Please save this source code
User prompt
add this: // Add near the top of the game initialization game.faceTrackingEnabled = false;
User prompt
update with: // Find the pufferMask update function and replace it with this: self.update = function () { // Only use face tracking when enabled if (game.faceTrackingEnabled) { // Adjust scale based on face size if (facekit.leftEye && facekit.rightEye && facekit.mouthCenter) { var eyeDistance = Math.abs(facekit.rightEye.x - facekit.leftEye.x); var newScale = eyeDistance / 500; // Update rolling average scaleHistory[scaleIndex] = newScale; scaleIndex = (scaleIndex + 1) % scaleHistory.length; // Calculate average scale var avgScale = scaleHistory.reduce(function (a, b) { return a + b; }, 0) / scaleHistory.length; // More gentle smoothing sprite.scaleX = sprite.scaleX * 0.85 + avgScale * 0.15; sprite.scaleY = sprite.scaleY * 0.85 + avgScale * 0.15; } // Follow nose position for main face tracking if (facekit.noseTip) { targetX = facekit.noseTip.x; targetY = facekit.noseTip.y; // Initialize previous positions if not set if (prevX === null) { prevX = targetX; prevY = targetY; } // Weighted average between previous and target position var newX = prevX * (1 - smoothingFactor) + targetX * smoothingFactor; var newY = prevY * (1 - smoothingFactor) + targetY * smoothingFactor; self.x = newX; self.y = newY; // Update previous positions prevX = newX; prevY = newY; } if (facekit.leftEye && facekit.rightEye) { targetTilt = calculateFaceTilt() * tiltScaleFactor; // Scale down the tilt // Reduce max rotation to Β±15 degrees targetTilt = Math.max(-15, Math.min(15, targetTilt)); self.rotation += (targetTilt - self.rotation) * tiltSmoothingFactor; } } };
User prompt
update with: game.startGame = function () { // Remove title screen if (game.titleContainer) { game.titleContainer.destroy(); game.titleContainer = null; } // Exit title mode game.titleMode = false; // Initialize BP display bpText.visible = true; // Initialize pufferfish for animation (not visible yet) playerMask.visible = true; playerMask.scaleX = 0.2; playerMask.scaleY = 0.2; playerMask.alpha = 0.8; playerMask.x = game.width / 2; playerMask.y = game.height + 100; // Start animation sequence tween(playerMask, { x: game.width / 2, y: game.height / 2, scaleX: 0.8, scaleY: 0.8, alpha: 1 }, { duration: 1500, easing: tween.easeOutBack, onFinish: function() { // Enable face tracking after animation game.faceTrackingEnabled = true; // Make menu visible menuContainer.visible = true; // Update clam visuals updateClamVisuals(); updateTreasureDecorations(); // Start background music LK.playMusic('backgroundmusic', { fade: { start: 0, end: 0.5, duration: 2000 } }); } }); }; βͺπ‘ Consider importing and using the following plugins: @upit/tween.v1
Code edit (4 edits merged)
Please save this source code
User prompt
update with: if (game.tutorial && game.tutorial.stage === 2 && popped) { game.tutorial.poppedBubble = true; LK.setTimeout(function() { showTutorialPopup(3); }, 30); // Short delay to ensure pop animation completes return true; }
Code edit (2 edits merged)
Please save this source code
User prompt
reduce value of bubbles by 100 times
Code edit (3 edits merged)
Please save this source code
User prompt
update with: f (menuOpen) { game.setChildIndex(menuContainer, game.children.length - 1); // If we're in tutorial, make sure tutorial popup is above menu if (game.tutorialContainer) { LK.setTimeout(function() { game.setChildIndex(game.tutorialContainer, game.children.length - 1); }, 1); // Use tiny delay to run after current frame completes } }
Code edit (1 edits merged)
Please save this source code
User prompt
update with: // Find the tabButton.down function in your code (in the part where tabs are created) // It should look something like 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 if (tabsContainer.currentIndicator) { tabsContainer.removeChild(tabsContainer.currentIndicator); tabsContainer.currentIndicator.destroy(); } // Create new indicator 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 track it tabsContainer.addChild(newIndicator); tabsContainer.currentIndicator = 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; // ADD THIS NEW CODE: // Check if this is the clams tab during tutorial if (game.tutorial && game.tutorial.stage === 5 && tab === 'clams') { LK.setTimeout(function() { showTutorialPopup(6); if (game.tutorialContainer) { game.setChildIndex(game.tutorialContainer, game.children.length - 1); } }, 1); } } return true; };
Code edit (5 edits merged)
Please save this source code
Code edit (4 edits merged)
Please save this source code
User prompt
import storage plugin βͺπ‘ Consider importing and using the following plugins: @upit/storage.v1
Code edit (3 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Error: Invalid value. Only literals or 1-level deep objects/arrays containing literals are allowed.' in or related to this line: 'storage.gameData = gameData;' Line Number: 669
User prompt
Please fix the bug: 'TypeError: JSON is undefined' in or related to this line: 'storage.gameData = JSON.parse(JSON.stringify(gameData));' Line Number: 669
Code edit (1 edits merged)
Please save this source code
User prompt
update as needed with: function calculateOfflineProgress(timeDiff) { // Calculate basic BP as before... // Apply a stronger offline penalty (25% of normal production) totalBP *= 0.25; // Apply a hard cap totalBP = Math.min(totalBP, 8000); // Or apply diminishing returns var hoursMult = Math.min(1, 1 / Math.sqrt(secondsAway / 3600)); totalBP *= hoursMult; // Round to integer totalBP = Math.floor(totalBP); // Add the BP... }
Code edit (2 edits merged)
Please save this source code
User prompt
update with: function saveGame() { storage.bp = game.bp; try { // Store upgrades as JSON string storage.upgrades = JSON.stringify(UPGRADE_CONFIG); console.log("Saved upgrades: " + storage.upgrades); // Add debug output } catch (e) { console.log("Error saving upgrades: ", e); } storage.lastPlayTime = Date.now(); storage.tutorialComplete = game.tutorial.stage >= 7; }
User prompt
update with: // In loadGame function if (storage.upgrades) { try { var loadedUpgrades = JSON.parse(storage.upgrades); console.log("Loaded upgrades: ", loadedUpgrades); // Debug output // Merge the loaded config with default config for (var category in loadedUpgrades) { if (UPGRADE_CONFIG[category]) { for (var key in loadedUpgrades[category]) { if (UPGRADE_CONFIG[category][key]) { // For objects like machines if (typeof loadedUpgrades[category][key] === 'object' && loadedUpgrades[category][key] !== null) { for (var prop in loadedUpgrades[category][key]) { UPGRADE_CONFIG[category][key][prop] = loadedUpgrades[category][key][prop]; } } else { // For simple values UPGRADE_CONFIG[category][key] = loadedUpgrades[category][key]; } } } } } } catch (e) { console.log("Error loading upgrades: ", e); } }
User prompt
update as needed with: game.startGame = function () { // Remove title screen if (game.titleContainer) { game.titleContainer.destroy(); game.titleContainer = null; } // Start background music LK.playMusic('backgroundmusic', { fade: { start: 0, end: 0.5, duration: 2000 } }); // Exit title mode game.titleMode = false; // Load saved game data FIRST loadGame(); // Initialize BP display bpText.visible = true; // Initialize pufferfish for animation (not visible yet) playerMask.visible = true; // ... rest of the function ... // Only show tutorial if not completed if (!storage.tutorialComplete) { LK.setTimeout(function () { showTutorialPopup(1); }, 60); } }
===================================================================
--- original.js
+++ change.js
@@ -592,8 +592,105 @@
/****
* Game Code
****/
// Import storage plugin for data persistence
+var gameData = storage.gameData || {
+ bp: 0,
+ upgrades: UPGRADE_CONFIG,
+ lastPlayTime: Date.now(),
+ tutorialComplete: false,
+ version: 1
+};
+function loadGame() {
+ // If we have saved data, apply it
+ if (storage.gameData) {
+ gameData = storage.gameData;
+ game.bp = gameData.bp;
+ UPGRADE_CONFIG = gameData.upgrades;
+ // Update UI elements
+ bpText.setText(formatBP(game.bp) + " BP");
+ // Skip tutorial if completed
+ if (gameData.tutorialComplete) {
+ game.tutorial.stage = 8; // Set to a stage past the tutorial
+ }
+ // Update all visuals based on loaded data
+ updateClamVisuals();
+ updateTreasureDecorations();
+ updateAllUpgradeTexts();
+ // Calculate offline progress if away for more than 1 minute
+ var currentTime = Date.now();
+ var timeDiff = currentTime - gameData.lastPlayTime;
+ if (timeDiff > 60000) {
+ calculateOfflineProgress(timeDiff);
+ }
+ }
+}
+// Save function - call periodically
+function saveGame() {
+ // Update gameData with current values
+ gameData.bp = game.bp;
+ gameData.upgrades = UPGRADE_CONFIG;
+ gameData.lastPlayTime = Date.now();
+ gameData.tutorialComplete = game.tutorial.stage >= 7;
+ // Store in local storage
+ storage.gameData = gameData;
+}
+// Calculate offline progress
+function calculateOfflineProgress(timeDiff) {
+ // Convert time diff to seconds
+ var secondsAway = Math.floor(timeDiff / 1000);
+ // Calculate how many bubbles each clam would produce
+ var totalBP = 0;
+ // Calculate for each clam type
+ ['basicClam', 'advancedClam', 'premiumClam'].forEach(function (clamType) {
+ var config = UPGRADE_CONFIG.machines[clamType];
+ var clamCount = config.amount;
+ if (clamCount > 0) {
+ // Calculate production time with speed upgrade
+ var baseTime = config.production;
+ var speedMultiplier = Math.pow(1 - UPGRADE_EFFECTS.autoBubbleSpeed.decrementPercent / 100, UPGRADE_CONFIG.machine.autoBubbleSpeed.currentLevel);
+ var adjustedTime = Math.max(1, baseTime * speedMultiplier);
+ // Calculate bubbles per second
+ var bubblesPerSecond = clamCount / adjustedTime;
+ // Get base value of bubbles
+ var bubbleValue = Math.pow(config.bubbleSize, 1.4) * 0.02;
+ // Apply quality upgrades
+ if (UPGRADE_CONFIG.machine.bubbleQuality.currentLevel > 0) {
+ bubbleValue *= 1 + 0.4 * UPGRADE_CONFIG.machine.bubbleQuality.currentLevel;
+ }
+ // Apply refinement upgrade
+ var refinementLevel = UPGRADE_CONFIG.player.bubbleRefinement.currentLevel;
+ if (refinementLevel > 0) {
+ bubbleValue *= 1 + 0.25 * refinementLevel;
+ }
+ // Apply color multiplier
+ var activeColorKey = getActiveColorKey();
+ var colorMultiplier = 1.0;
+ if (activeColorKey && UPGRADE_CONFIG.colors[activeColorKey]) {
+ colorMultiplier = UPGRADE_CONFIG.colors[activeColorKey].multiplier || 1.0;
+ }
+ bubbleValue *= colorMultiplier;
+ // Calculate total BP this clam type would produce
+ totalBP += bubblesPerSecond * bubbleValue * secondsAway;
+ }
+ });
+ // Cap at a reasonable maximum
+ var maxOfflineBP = 12 * 60 * 60; // Max 12 hours of production
+ var secondsCapped = Math.min(secondsAway, maxOfflineBP);
+ if (secondsAway > maxOfflineBP) {
+ totalBP = totalBP / secondsAway * secondsCapped;
+ }
+ // Apply offline production penalty (80% of normal production)
+ totalBP *= 0.8;
+ // Round to integer
+ totalBP = Math.floor(totalBP);
+ // Add the BP and show a message
+ if (totalBP > 0) {
+ game.bp += totalBP;
+ bpText.setText(formatBP(game.bp) + " BP");
+ game.showMessage("You earned " + formatBP(totalBP) + " BP while away!");
+ }
+}
game.faceTrackingEnabled = false;
var UPGRADE_CONFIG = {
gameSettings: {
activeColor: "auto" // Default to automatic progression (highest unlocked)
@@ -2002,8 +2099,9 @@
updateClamVisuals();
updateTreasureDecorations();
}
});
+ loadGame();
};
game.tutorial = {
stage: 0,
// 0=none, 1=welcome, 2=blow bubble, 3=pop bubble, 4=first clam, 5=open menu, 6=clams tab, 7=buy clam, 8=final
@@ -2163,8 +2261,11 @@
if (bubble.update) {
bubble.update();
}
});
+ if (LK.ticks % 1800 === 0) {
+ saveGame();
+ }
};
// Handle touch/mouse events for the game
game.down = function (x, y, obj) {
if (game.titleMode) {
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