User prompt
Update as necessary: self.update = function() { self.gameTime = LK.ticks / 60; // Handle bud timers and blooming for (var i = 0; i < self.garden.rows; i++) { for (var j = 0; j < self.garden.cols; j++) { var gridItem = self.garden.grid[i][j]; if (gridItem && gridItem.isBud) { var budId = i + ',' + j; if (self.budTimers[budId] !== undefined) { // Only update if timer exists self.budTimers[budId]--; if (self.budTimers[budId] <= 0) { var flowerColors = ['red', 'blue', 'yellow']; var randomColor = flowerColors[Math.floor(Math.random() * flowerColors.length)]; var newFlower = new BasicFlower(randomColor); newFlower.x = gridItem.x; newFlower.y = gridItem.y; newFlower.isFlower = true; newFlower.hasActivePollen = false; // All auto-blooms after first start without pollen self.garden.removeChild(gridItem); self.garden.grid[i][j] = newFlower; self.garden.addChild(newFlower); newFlower.bloom(); delete self.budTimers[budId]; } } } } } };
User prompt
Update as necessary: self.usePollen = function(bud) { var pollenUsed = 7; if (self.currentPollen > 0 && self.pollenTypes.length > 0) { // If we have less than pollenUsed, use remaining pollen if (self.currentPollen < pollenUsed) { pollenUsed = self.currentPollen; } // Reduce pollen instead of zeroing it self.currentPollen -= pollenUsed; // Update pollen types properly var pType = self.pollenTypes[0]; pType.amount -= pollenUsed; // Only clear type if it's empty if (pType.amount <= 0) { self.pollenTypes.shift(); } // Only end trail if we're actually out of pollen if (self.currentPollen <= 0 || self.pollenTypes.length === 0) { self.pollenTrail.active = false; self.pollenTrail.points = []; } return pType.color; } return null; };
User prompt
Update as necessary with: self.usePollen = function(bud) { var pollenUsed = 7; if (self.currentPollen > 0 && self.pollenTypes.length > 0) { // If we have less than pollenUsed, use all remaining pollen if (self.currentPollen < pollenUsed) { pollenUsed = self.currentPollen; } // Keep track of color before clearing var color = self.pollenTypes[0].color; self.currentPollen = 0; self.pollenTypes = []; // Only end trail AFTER successful pollination self.pollenTrail.active = false; self.pollenTrail.points = []; return color; } return null; }; ``` 2. In bee's movement/update: ```javascript self.update = function() { if (self.isMoving) { // Smooth movement towards target self.x += (self.targetX - self.x) * self.moveSpeed; self.y += (self.targetY - self.y) * self.moveSpeed; // Update trail when carrying pollen if (self.currentPollen > 0) { // Make sure trail starts if not already active if (!self.pollenTrail.active) { self.pollenTrail.startTrail(self.x, self.y, garden); } self.pollenTrail.updateTrail(self.x, self.y); } // Check collision after moving self.checkFlowerCollision(); } };
User prompt
Update as necessary with: self.usePollen = function(bud) { var pollenUsed = 7; // If we have less than standard amount but more than 0, use remaining pollen if (self.currentPollen > 0 && self.pollenTypes.length > 0) { // If we have less than pollenUsed, use all remaining pollen if (self.currentPollen < pollenUsed) { pollenUsed = self.currentPollen; } self.currentPollen = 0; // Empty the bee // Update pollen types array var pType = self.pollenTypes[0]; pType.amount = 0; // Empty this type self.pollenTypes = []; // Clear all types // End trail since we're out of pollen self.pollenTrail.active = false; self.pollenTrail.points = []; return pType.color; } return null; };
User prompt
Update as necessary with: self.usePollen = function(bud) { var pollenUsed = 7; if (self.currentPollen >= pollenUsed && self.pollenTypes.length > 0) { self.currentPollen -= pollenUsed; // Update pollen types array var pType = self.pollenTypes[0]; pType.amount -= pollenUsed; // If this type is depleted, remove it if (pType.amount <= 0) { self.pollenTypes.shift(); // If we have no more pollen types, ensure currentPollen is 0 if (self.pollenTypes.length === 0) { self.currentPollen = 0; } } // Only end trail if truly out of all pollen if (self.pollenTypes.length === 0) { self.pollenTrail.active = false; self.pollenTrail.points = []; } return pType.color; } return null; }; self.collectPollen = function(flower) { if (self.currentPollen < self.maxPollen && flower.hasActivePollen && !flower.pollenCollected) { var collectAmount = 25; // Add to pollen types first var existingType = self.pollenTypes.find(function(p) { return p.color === flower.color; }); if (existingType) { existingType.amount += collectAmount; } else { self.pollenTypes.push({ color: flower.color, amount: collectAmount }); } // Set currentPollen to match total of all types self.currentPollen = self.pollenTypes.reduce(function(total, type) { return total + type.amount; }, 0); flower.pollenCollected = true; flower.hasActivePollen = false; flower.removeFairyParticles(); } };
User prompt
Update as necessary with: if (gridItem && gridItem.isBud && self.currentPollen > 0) { // Add immediate state check and lock if (gridItem.isBeingPollinated) return; // Skip if already being converted gridItem.isBeingPollinated = true; var pollenColor = self.usePollen(gridItem); if (pollenColor) { // Ensure the bud hasn't auto-bloomed if (garden.grid[gridY][gridX] === gridItem) { var newFlower = new BasicFlower(pollenColor); newFlower.x = gridItem.x; newFlower.y = gridItem.y; newFlower.isFlower = true; garden.removeChild(gridItem); garden.grid[gridY][gridX] = newFlower; garden.addChild(newFlower); newFlower.bloom(); } } }
User prompt
Make changes as necessary with: if (gridItem.isBud && self.currentPollen > 0) { var pollenColor = self.usePollen(gridItem); if (pollenColor) { var newFlower = new BasicFlower(pollenColor); newFlower.x = gridItem.x; newFlower.y = gridItem.y; newFlower.isFlower = true; // Remove the immediate hasActivePollen set // Let bloom() handle the pollen activation garden.removeChild(gridItem); garden.grid[gridY][gridX] = newFlower; garden.addChild(newFlower); newFlower.bloom(); } }
User prompt
Update as necessary using: self.checkFlowerCollision = function() { // Convert bee position to garden's local space var localPos = garden.toLocal({x: self.x, y: self.y}, game); // Calculate grid position var gridX = Math.floor(localPos.x / garden.cellSize); var gridY = Math.floor(localPos.y / garden.cellSize); console.log('Grid Position:', gridX, gridY); // Debug // Check if position is within grid bounds if (gridX >= 0 && gridX < garden.cols && gridY >= 0 && gridY < garden.rows) { var gridItem = garden.grid[gridY][gridX]; if (gridItem) { console.log('Grid Item:', gridItem.isBud, self.currentPollen); // Debug if (gridItem.isFlower && gridItem.hasActivePollen) { // Collect pollen from flower self.collectPollen(gridItem); } else if (gridItem.isBud && self.currentPollen > 0) { console.log('Attempting pollination'); // Debug // Try to pollinate bud var pollenColor = self.usePollen(gridItem); if (pollenColor) { console.log('Pollination successful'); // Debug // Convert bud to flower var newFlower = new BasicFlower(pollenColor); newFlower.x = gridItem.x; newFlower.y = gridItem.y; newFlower.isFlower = true; garden.removeChild(gridItem); garden.grid[gridY][gridX] = newFlower; garden.addChild(newFlower); newFlower.bloom(); } } } } };
User prompt
Update as necessary using: // In Bee class self.collectPollen = function(flower) { // ... existing collection code ... console.log('Current Pollen:', self.currentPollen); // Temporary debug console.log('Pollen Types:', self.pollenTypes); // Temporary debug }; self.usePollen = function(bud) { // Add debug logs console.log('Trying to use pollen. Amount:', self.currentPollen); console.log('Pollen types:', self.pollenTypes); var pollenUsed = 7; if (self.currentPollen >= pollenUsed && self.pollenTypes.length > 0) { // ... rest of usePollen code ... console.log('After using pollen:', self.currentPollen); // Debug return pType.color; } return null; };
User prompt
Please fix the bug: 'TypeError: setTimeout is not a function. (In 'setTimeout(function () { __$(18); self.hasActivePollen = true; // Create fairy particles after delay __$(19); for (var i = 0; i < self.FAIRY_COUNT; i++) { __$(20); var fairy = new PollenParticle().init('fairy'); __$(21); fairy.scale.set(0.3 + Math.random() * 0.2); __$(22); fairy.x += (Math.random() - 0.5) * 60; __$(23); fairy.y += (Math.random() - 0.5) * 60; __$(24); fairy.rotation = Math.random() * Math.PI * 2; __$(25); fairy.rotationSpeed = (Math.random() - 0.5) * 0.2; __$(26); self.addChild(fairy); __$(27); self.fairyParticles.push(fairy); } }, 1000)', 'setTimeout' is undefined)' in or related to this line: 'setTimeout(function () {' Line Number: 65
User prompt
Update as necessary using this: var BasicFlower = Container.expand(function(color) { var self = Container.call(this); self.color = color || 'red'; self.hasActivePollen = false; self.pollenCollected = false; self.fairyParticles = []; self.FAIRY_COUNT = 3; self.bloom = function() { self.scale.set(0.3, 0.3); // First tween for bloom animation tween(self.scale, {x: 1, y: 1}, { duration: 1000, onFinish: function() { // After bloom animation, delay before activating pollen setTimeout(function() { self.hasActivePollen = true; // Create fairy particles after delay for (var i = 0; i < self.FAIRY_COUNT; i++) { var fairy = new PollenParticle().init('fairy'); fairy.scale.set(0.3 + Math.random() * 0.2); fairy.x += (Math.random() - 0.5) * 60; fairy.y += (Math.random() - 0.5) * 60; fairy.rotation = Math.random() * Math.PI * 2; fairy.rotationSpeed = (Math.random() - 0.5) * 0.2; self.addChild(fairy); self.fairyParticles.push(fairy); } }, 1000); // 1 second delay after bloom before pollen activates } }); // Create initial burst particles self.createPollenBurst(self.x, self.y); }; // Rest of the BasicFlower code... });
User prompt
Update using: } else if (gridItem.isBud && self.currentPollen > 0) { var pollenColor = self.usePollen(gridItem); if (pollenColor) { // Convert bud to flower with the correct color var newFlower = new BasicFlower(pollenColor); newFlower.x = gridItem.x; newFlower.y = gridItem.y; newFlower.isFlower = true; newFlower.hasActivePollen = true; // Make sure pollen is active garden.removeChild(gridItem); garden.grid[gridY][gridX] = newFlower; garden.addChild(newFlower); newFlower.bloom(); // This should now create fairy particles properly } }
User prompt
Update as necessary: self.collectPollen = function(flower) { if (self.currentPollen < self.maxPollen && flower.hasActivePollen && !flower.pollenCollected) { var collectAmount = 25; self.currentPollen += collectAmount; // Track pollen type var existingType = self.pollenTypes.find(p => p.color === flower.color); if (existingType) { existingType.amount += collectAmount; } else { self.pollenTypes.push({ color: flower.color, amount: collectAmount }); } // Ensure we don't exceed max if (self.currentPollen > self.maxPollen) { self.currentPollen = self.maxPollen; } // Mark that we've collected from this flower and remove particles flower.pollenCollected = true; flower.hasActivePollen = false; // Make sure to set this false flower.removeFairyParticles(); // Start trail if not already active if (!self.pollenTrail.active) { self.pollenTrail.startTrail(self.x, self.y, garden); } } }; self.usePollen = function(bud) { var pollenUsed = 7; if (self.currentPollen >= pollenUsed && self.pollenTypes.length > 0) { // Make sure we have pollen types self.currentPollen -= pollenUsed; // Update pollen types array var pType = self.pollenTypes[0]; pType.amount -= pollenUsed; if (pType.amount <= 0) { self.pollenTypes.shift(); } // Handle trail if (self.currentPollen <= 0 || self.pollenTypes.length === 0) { self.pollenTrail.active = false; self.pollenTrail.points = []; } return pType.color; } return null; };
User prompt
Make updates a necessary using: 1. For the fairy particles, we'll modify BasicFlower: ```javascript var BasicFlower = Container.expand(function(color) { var self = Container.call(this); // Store flower color and initialize pollen status self.color = color || 'red'; self.hasActivePollen = false; self.pollenCollected = false; self.fairyParticles = []; self.FAIRY_COUNT = 3; // Rest of the BasicFlower setup... self.bloom = function() { // Scale animation self.scale.set(0.3, 0.3); tween(self.scale, {x: 1, y: 1}, {duration: 1000}); // Create burst particles self.createPollenBurst(self.x, self.y); // Initialize with active pollen self.hasActivePollen = true; self.pollenCollected = false; // Create fairy particles for (var i = 0; i < self.FAIRY_COUNT; i++) { var fairy = new PollenParticle().init('fairy'); fairy.scale.set(0.3 + Math.random() * 0.2); fairy.x += (Math.random() - 0.5) * 60; fairy.y += (Math.random() - 0.5) * 60; fairy.rotation = Math.random() * Math.PI * 2; fairy.rotationSpeed = (Math.random() - 0.5) * 0.2; self.addChild(fairy); self.fairyParticles.push(fairy); } }; self.removeFairyParticles = function() { self.fairyParticles.forEach(function(fairy) { self.removeChild(fairy); }); self.fairyParticles = []; }; });
User prompt
Remove fairy particles when pollen is collected.
User prompt
Update code using this: 2. Then modify the Bee's collectPollen to use this: ```javascript self.collectPollen = function(flower) { if (self.currentPollen < self.maxPollen && flower.hasActivePollen && !flower.pollenCollected) { var collectAmount = 25; self.currentPollen += collectAmount; // Track pollen type var existingType = self.pollenTypes.find(p => p.color === flower.color); if (existingType) { existingType.amount += collectAmount; } else { self.pollenTypes.push({ color: flower.color, amount: collectAmount }); } // Ensure we don't exceed max if (self.currentPollen > self.maxPollen) { self.currentPollen = self.maxPollen; } // Mark that we've collected from this flower flower.pollenCollected = true; // Start trail if not already active if (!self.pollenTrail.active) { self.pollenTrail.startTrail(self.x, self.y, garden); } } };
User prompt
Please fix the bug: 'TypeError: flower.usePollen is not a function. (In 'flower.usePollen()', 'flower.usePollen' is undefined)' in or related to this line: 'flower.usePollen();' Line Number: 142
User prompt
Update as necessary using this: 1. First, in BasicFlower, remove the usePollen method I added and just track if we've collected from it: ```javascript var BasicFlower = Container.expand(function(color) { var self = Container.call(this); // Store flower color and initialize pollen status self.color = color || 'red'; self.hasActivePollen = false; self.pollenCollected = false; // New flag to track if we've collected from it // Rest of the BasicFlower setup... self.bloom = function() { // Scale animation self.scale.set(0.3, 0.3); tween(self.scale, {x: 1, y: 1}, {duration: 1000}); // Create burst particles self.createPollenBurst(self.x, self.y); // Initialize with active pollen self.hasActivePollen = true; self.pollenCollected = false; // Create fairy particles like before... }; });
User prompt
Update as necessary using: // In Bee class, modify collectPollen: self.collectPollen = function(flower) { if (self.currentPollen < self.maxPollen && flower.hasActivePollen) { // Amount to collect (we can tune this) var collectAmount = 25; // Add to current total self.currentPollen += collectAmount; // Track pollen type var existingType = self.pollenTypes.find(p => p.color === flower.color); if (existingType) { existingType.amount += collectAmount; } else { self.pollenTypes.push({ color: flower.color, amount: collectAmount }); } // Ensure we don't exceed max if (self.currentPollen > self.maxPollen) { self.currentPollen = self.maxPollen; } // Mark the flower's pollen as used flower.usePollen(); // Start trail if not already active if (!self.pollenTrail.active) { self.pollenTrail.startTrail(self.x, self.y, garden); } } }; // And modify usePollen: self.usePollen = function(bud) { var pollenUsed = 7; if (self.currentPollen >= pollenUsed) { self.currentPollen -= pollenUsed; // Update pollen types array first if (self.pollenTypes.length > 0) { var pType = self.pollenTypes[0]; pType.amount -= pollenUsed; if (pType.amount <= 0) { self.pollenTypes.shift(); } } // If no more pollen, stop trail if (self.currentPollen <= 0 || self.pollenTypes.length === 0) { self.pollenTrail.active = false; self.pollenTrail.points = []; return null; } return self.pollenTypes[0].color; // Return the color we're using } return null; };
User prompt
Update as necessary using: // In BasicFlower, at the start: self.bloom = function() { // Scale animation self.scale.set(0.3, 0.3); tween(self.scale, {x: 1, y: 1}, {duration: 1000}); // Create burst particles self.createPollenBurst(self.x, self.y); // Initialize with active pollen self.hasActivePollen = true; // Make sure this is set // Create fairy particles for (var i = 0; i < self.FAIRY_COUNT; i++) { var fairy = new PollenParticle().init('fairy'); fairy.scale.set(0.3 + Math.random() * 0.2); // Reduced size for fairy particles fairy.x += (Math.random() - 0.5) * 60; // Further spread out fairy.y += (Math.random() - 0.5) * 60; // Further spread out fairy.rotation = Math.random() * Math.PI * 2; // Add random rotation fairy.rotationSpeed = (Math.random() - 0.5) * 0.2; // Add random rotation speed self.addChild(fairy); self.fairyParticles.push(fairy); } }; // Add method to remove pollen: self.usePollen = function() { if (!self.hasActivePollen) { return; } self.hasActivePollen = false; // Remove fairy particles self.fairyParticles.forEach(function(fairy) { self.removeChild(fairy); }); self.fairyParticles = []; };
User prompt
Please fix the bug: 'ReferenceError: Can't find variable: pType' in or related to this line: 'return pType.color; // Return the color we used' Line Number: 267
User prompt
Make changes as necesssry with: // In Bee's collectPollen method, add debug log: self.collectPollen = function(flower) { if (self.currentPollen < self.maxPollen && flower.hasActivePollen) { var collectAmount = 25; // Enough for ~3-4 pollinations self.currentPollen += collectAmount; // Track pollen type var existingType = self.pollenTypes.find(p => p.color === flower.color); if (existingType) { existingType.amount += collectAmount; } else { self.pollenTypes.push({ color: flower.color, amount: collectAmount }); } if (self.currentPollen > self.maxPollen) { self.currentPollen = self.maxPollen; } // Start trail if not already active if (!self.pollenTrail.active) { self.pollenTrail.startTrail(self.x, self.y, garden); } } }; // In usePollen method: self.usePollen = function(bud) { var pollenUsed = 7; // Using about 1/4 of collected amount per pollination if (self.currentPollen >= pollenUsed) { self.currentPollen -= pollenUsed; // Create burst effect at bud location var burstParticle = new PollenParticle().init('burst'); burstParticle.x = bud.x; burstParticle.y = bud.y; game.addChild(burstParticle); // Update pollen types array if (self.pollenTypes.length > 0) { // Get first available pollen type var pType = self.pollenTypes[0]; pType.amount -= pollenUsed; if (pType.amount <= 0) { self.pollenTypes.shift(); } return pType.color; // Return the color we used } // If no more pollen, stop trail if (self.currentPollen <= 0) { self.pollenTrail.active = false; self.pollenTrail.points = []; } return null; } return null; }; // Then in checkFlowerCollision, use the returned color: } else if (gridItem.isBud && self.currentPollen > 0) { // Try to pollinate bud var pollenColor = self.usePollen(gridItem); if (pollenColor) { // Convert bud to flower with the correct color var newFlower = new BasicFlower(pollenColor); newFlower.x = gridItem.x; newFlower.y = gridItem.y; newFlower.isFlower = true; newFlower.hasActivePollen = true; // New blooms should have active pollen garden.removeChild(gridItem); garden.grid[gridY][gridX] = newFlower; garden.addChild(newFlower); newFlower.bloom(); } }
User prompt
Update as necessary using: // In Bee's checkFlowerCollision method: self.checkFlowerCollision = function() { // Convert bee position to garden's local space var localPos = garden.toLocal({x: self.x, y: self.y}, game); // Calculate grid position var gridX = Math.floor(localPos.x / garden.cellSize); var gridY = Math.floor(localPos.y / garden.cellSize); // Check if position is within grid bounds if (gridX >= 0 && gridX < garden.cols && gridY >= 0 && gridY < garden.rows) { var gridItem = garden.grid[gridY][gridX]; if (gridItem) { if (gridItem.isFlower && gridItem.hasActivePollen) { // Collect pollen from flower self.collectPollen(gridItem); } else if (gridItem.isBud && self.currentPollen > 0) { // Try to pollinate bud if (self.usePollen(gridItem)) { // Convert bud to flower var newFlower = new BasicFlower('red'); // For now just red newFlower.x = gridItem.x; newFlower.y = gridItem.y; newFlower.isFlower = true; garden.removeChild(gridItem); garden.grid[gridY][gridX] = newFlower; garden.addChild(newFlower); newFlower.bloom(); } } } } };
User prompt
Update as necessary using: 1. First, let's remove that center flower. This is happening in the Garden's init function: ```javascript // In Garden init, remove this part: // if (i === centerRow && j === centerCol) { // ... center flower creation ... // } // Instead, just create buds for all positions: self.init = function() { // Center the grid self.x = (2048 - self.cols * self.cellSize) / 2; self.y = (2732 - self.rows * self.cellSize) / 2 + 2732 * 0.12 - 400; // Initialize grid and fill with buds for (var i = 0; i < self.rows; i++) { self.grid[i] = []; for (var j = 0; j < self.cols; j++) { var bud = new Bud(); bud.x = j * self.cellSize + self.cellSize / 2; bud.y = i * self.cellSize + self.cellSize / 2; bud.isBud = true; bud.isFlower = false; self.grid[i][j] = bud; self.addChild(bud); } } };
User prompt
2. Then let's adjust the pollen collection amount in the Bee class: ```javascript // In Bee's collectPollen method: var collectAmount = 25; // Enough for ~3-4 pollinations // In Bee's usePollen method: var pollenUsed = 7; // Using about 1/4 of collected amount per pollination
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var BasicFlower = Container.expand(function (color) { var self = Container.call(this); // Store flower color self.color = color || 'red'; // Default to red if no color specified // Map color to asset name var assetMap = { 'red': 'RedFlower', 'blue': 'BlueFlower', 'yellow': 'YellowFlower' }; // Use correct asset based on color var flowerGraphics = self.attachAsset(assetMap[self.color], { anchorX: 0.5, anchorY: 0.5 }); self.hasActivePollen = false; self.fairyParticles = []; self.FAIRY_COUNT = 3; self.update = function () { var scaleFactor = 1 + Math.sin(LK.ticks * 0.1) * 0.05; flowerGraphics.scale.x = scaleFactor; flowerGraphics.scale.y = scaleFactor; flowerGraphics.rotation = Math.sin(LK.ticks * 0.1) * 0.05; }; self.bloom = function () { // Scale animation self.scale.set(0.3, 0.3); tween(self.scale, { x: 1, y: 1 }, { duration: 1000, onFinish: function onFinish() { // After bloom animation, delay before activating pollen LK.setTimeout(function () { self.hasActivePollen = true; // Create fairy particles after delay for (var i = 0; i < self.FAIRY_COUNT; i++) { var fairy = new PollenParticle().init('fairy'); fairy.scale.set(0.3 + Math.random() * 0.2); fairy.x += (Math.random() - 0.5) * 60; fairy.y += (Math.random() - 0.5) * 60; fairy.rotation = Math.random() * Math.PI * 2; fairy.rotationSpeed = (Math.random() - 0.5) * 0.2; self.addChild(fairy); self.fairyParticles.push(fairy); } }, 1000); // 1 second delay after bloom before pollen activates } }); // Create initial burst particles self.createPollenBurst(self.x, self.y); self.removeFairyParticles = function () { self.fairyParticles.forEach(function (fairy) { self.removeChild(fairy); }); self.fairyParticles = []; }; }; self.createPollenBurst = function (x, y) { for (var i = 0; i < 12; i++) { var particle = new PollenParticle().init('burst'); var angle = i / 12 * Math.PI * 2; particle.x = x; particle.y = y; particle.vx = Math.cos(angle) * 3; particle.vy = Math.sin(angle) * 3; if (self.parent) { self.parent.addChild(particle); } } }; // Initialize pollen status self.pollenCollected = false; // New flag to track if we've collected from it }); var Bee = Container.expand(function () { var self = Container.call(this); // Create bee sprite var beeSprite = self.attachAsset('Bee', { anchorX: 0.5, anchorY: 0.5 }); // Movement properties self.targetX = self.x; self.targetY = self.y; self.moveSpeed = 0.1; // Adjust this for faster/slower following self.isMoving = false; // New pollen properties self.maxPollen = 100; // Maximum pollen capacity self.currentPollen = 0; // Current amount being carried self.pollenTypes = []; // Array to track different pollen colors // Format: [{color: 'red', amount: 30}, ...] // Add trail property self.pollenTrail = new PollenTrail(); game.addChild(self.pollenTrail); // Add to game so it renders behind bee // Pollen collection method self.collectPollen = function (flower) { if (self.currentPollen < self.maxPollen && flower.hasActivePollen && !flower.pollenCollected) { var collectAmount = 25; // Add to pollen types first var existingType = self.pollenTypes.find(function (p) { return p.color === flower.color; }); if (existingType) { existingType.amount += collectAmount; } else { self.pollenTypes.push({ color: flower.color, amount: collectAmount }); } // Set currentPollen to match total of all types self.currentPollen = self.pollenTypes.reduce(function (total, type) { return total + type.amount; }, 0); flower.pollenCollected = true; flower.hasActivePollen = false; flower.removeFairyParticles(); } }; self.checkFlowerCollision = function () { // Convert bee position to garden's local space var localPos = garden.toLocal({ x: self.x, y: self.y }, game); // Calculate grid position var gridX = Math.floor(localPos.x / garden.cellSize); var gridY = Math.floor(localPos.y / garden.cellSize); console.log('Grid Position:', gridX, gridY); // Debug // Check if position is within grid bounds if (gridX >= 0 && gridX < garden.cols && gridY >= 0 && gridY < garden.rows) { var gridItem = garden.grid[gridY][gridX]; if (gridItem) { console.log('Grid Item:', gridItem.isBud, self.currentPollen); // Debug if (gridItem.isFlower && gridItem.hasActivePollen) { // Collect pollen from flower self.collectPollen(gridItem); } else if (gridItem && gridItem.isBud && self.currentPollen > 0) { // Add immediate state check and lock if (gridItem.isBeingPollinated) { return; } // Skip if already being converted gridItem.isBeingPollinated = true; console.log('Attempting pollination'); // Debug var pollenColor = self.usePollen(gridItem); if (pollenColor) { // Ensure the bud hasn't auto-bloomed if (garden.grid[gridY][gridX] === gridItem) { console.log('Pollination successful'); // Debug // Convert bud to flower with the correct color var newFlower = new BasicFlower(pollenColor); newFlower.x = gridItem.x; newFlower.y = gridItem.y; newFlower.isFlower = true; garden.removeChild(gridItem); garden.grid[gridY][gridX] = newFlower; garden.addChild(newFlower); newFlower.bloom(); } } } } } }; self.update = function () { if (self.isMoving) { // Smooth movement towards target self.x += (self.targetX - self.x) * self.moveSpeed; self.y += (self.targetY - self.y) * self.moveSpeed; // Calculate rotation based on movement direction var dx = self.targetX - self.x; var dy = self.targetY - self.y; var angle = Math.atan2(dy, dx); self.rotation = angle + Math.PI / 2; // Update trail when carrying pollen if (self.currentPollen > 0) { self.pollenTrail.updateTrail(self.x, self.y); } // Add collision check self.checkFlowerCollision(); } }; // Pollen usage method self.usePollen = function (bud) { // Add debug logs console.log('Trying to use pollen. Amount:', self.currentPollen); console.log('Pollen types:', self.pollenTypes); var pollenUsed = 7; if (self.currentPollen >= pollenUsed && self.pollenTypes.length > 0) { self.currentPollen -= pollenUsed; // Create burst effect at bud location var burstParticle = new PollenParticle().init('burst'); burstParticle.x = bud.x; burstParticle.y = bud.y; game.addChild(burstParticle); // Update pollen types array var pType = self.pollenTypes[0]; pType.amount -= pollenUsed; // If this type is depleted, remove it if (pType.amount <= 0) { self.pollenTypes.shift(); // If we have no more pollen types, ensure currentPollen is 0 if (self.pollenTypes.length === 0) { self.currentPollen = 0; } } // Only end trail if truly out of all pollen if (self.pollenTypes.length === 0) { self.pollenTrail.active = false; self.pollenTrail.points = []; } console.log('After using pollen:', self.currentPollen); // Debug return pType.color; } return null; }; return self; }); // Bud class var Bud = Container.expand(function () { var self = Container.call(this); var budGraphics = self.attachAsset('Bud', { anchorX: 0.5, anchorY: 0.5 }); // Timer properties self.bloomTimer = 5 * 60; // 5 seconds (assuming 60fps) self.isBud = true; self.isFlower = false; // Update now handles timer and auto-bloom self.update = function () { // Basic animation self.rotation = Math.sin(LK.ticks * 0.05) * 0.1; // Update timer if (self.bloomTimer > 0) { self.bloomTimer--; // Optional: Add visual feedback of timer // Could use scale or tint to show timer progress var timerProgress = self.bloomTimer / (5 * 60); self.scale.set(0.8 + timerProgress * 0.2); } else { // Time to auto-bloom self.autoBloom(); } }; self.autoBloom = function () { if (!self.isBud) { return; } // Prevent double-blooming // Get grid position var localPos = garden.toLocal({ x: self.x, y: self.y }, game); var gridX = Math.floor(localPos.x / garden.cellSize); var gridY = Math.floor(localPos.y / garden.cellSize); // Create random color flower var flowerColors = ['red', 'blue', 'yellow']; var randomColor = flowerColors[Math.floor(Math.random() * flowerColors.length)]; var newFlower = new BasicFlower(randomColor); newFlower.x = self.x; newFlower.y = self.y; newFlower.isFlower = true; newFlower.hasActivePollen = false; // Auto-bloomed flowers start dead // Update grid if (garden.grid[gridY] && garden.grid[gridY][gridX] === self) { garden.removeChild(self); garden.grid[gridY][gridX] = newFlower; garden.addChild(newFlower); newFlower.bloom(); } self.isBud = false; }; return self; }); // Add BudSpawner to handle progressive difficulty var BudSpawner = Container.expand(function () { var self = Container.call(this); self.garden = null; self.gameTime = 0; self.init = function (garden) { self.garden = garden; self.gameTime = 0; self.budTimers = {}; self.firstBloom = false; // Track if we've done the first bloom // Initialize timer for first bloom only (1-2 seconds) var randomRow = Math.floor(Math.random() * self.garden.rows); var randomCol = Math.floor(Math.random() * self.garden.cols); self.budTimers[randomRow + ',' + randomCol] = 90; // ~1.5 seconds at 60fps // Initialize much longer timers for other buds for (var i = 0; i < self.garden.rows; i++) { for (var j = 0; j < self.garden.cols; j++) { if (i !== randomRow || j !== randomCol) { self.budTimers[i + ',' + j] = (10 + Math.random() * 10) * 60; // 10-20 seconds } } } }; self.findEmptySpot = function () { var validSpots = []; // Match flower removal coordinate system [gridY][gridX] for (var gridY = 0; gridY < self.garden.rows; gridY++) { for (var gridX = 0; gridX < self.garden.cols; gridX++) { if (!self.garden.grid[gridY][gridX]) { validSpots.push({ x: gridX, y: gridY }); } } } if (validSpots.length > 0) { return validSpots[Math.floor(Math.random() * validSpots.length)]; } return null; }; self.getSpawnRate = function () { // Keep original timing logic return 16; // Spawn every frame for immediate filling }; self.update = function () { self.gameTime = LK.ticks / 60; // Handle bud timers and blooming for (var i = 0; i < self.garden.rows; i++) { for (var j = 0; j < self.garden.cols; j++) { var gridItem = self.garden.grid[i][j]; if (gridItem && gridItem.isBud) { var budId = i + ',' + j; // Initialize timer if needed if (!self.budTimers[budId]) { self.budTimers[budId] = 5 * 60; // 5 seconds at 60fps } // Update timer self.budTimers[budId]--; // Update bud scale for visual feedback if (self.budTimers[budId] < 60) { var finalProgress = self.budTimers[budId] / 60; gridItem.scale.set(1 + 0.2 * (1 - finalProgress)); } // Time to bloom if (self.budTimers[budId] <= 0) { var flowerColors = ['red', 'blue', 'yellow']; var randomColor = flowerColors[Math.floor(Math.random() * flowerColors.length)]; var newFlower = new BasicFlower(randomColor); newFlower.x = gridItem.x; newFlower.y = gridItem.y; newFlower.isFlower = true; // First bloom (or player-pollinated blooms) get active pollen newFlower.hasActivePollen = !self.firstBloom; self.garden.removeChild(gridItem); self.garden.grid[i][j] = newFlower; self.garden.addChild(newFlower); newFlower.bloom(); if (!self.firstBloom) { self.firstBloom = true; } delete self.budTimers[budId]; } } } } // Handle spawning new buds var spot = self.findEmptySpot(); if (spot) { var bud = new Bud(); bud.x = spot.y * self.garden.cellSize + self.garden.cellSize / 2; bud.y = spot.x * self.garden.cellSize + self.garden.cellSize / 2; bud.isBud = true; bud.isFlower = false; bud.scale.set(0, 0); tween(bud.scale, { x: 1, y: 1 }, { duration: 1000 }); self.garden.grid[spot.x][spot.y] = bud; self.garden.addChild(bud); // Initialize timer for new bud self.budTimers[spot.x + ',' + spot.y] = (15 + Math.random() * 15) * 60; // 15-30 seconds } }; }); // Simplified FlowerManager - mainly for flower conversion and management var FlowerManager = Container.expand(function () { var self = Container.call(this); // Convert a bud to a flower self.convertBudToFlower = function (bud, garden) { var gridPos = { x: Math.floor((bud.y - garden.y) / garden.cellSize), y: Math.floor((bud.x - garden.x) / garden.cellSize) }; var newFlower = new BasicFlower(); newFlower.x = bud.x; newFlower.y = bud.y; newFlower.isFlower = true; garden.removeChild(bud); garden.grid[gridPos.x][gridPos.y] = newFlower; garden.addChild(newFlower); // When a flower blooms: createPollenBurst(newFlower.x, newFlower.y); return newFlower; }; // Empty touch handler as we're using the new trail system self.handleTouch = function () {}; }); //<Assets used in the game will automatically appear here> // Garden class to manage the grid of soil var Garden = Container.expand(function () { var self = Container.call(this); // Add new helper method for safe grid updates self.updateGridPosition = function (row, col, item) { if (row >= 0 && row < self.rows && col >= 0 && col < self.cols) { // First clear any existing item var existingItem = self.grid[row][col]; if (existingItem && existingItem.parent) { existingItem.parent.removeChild(existingItem); } // Then set new item self.grid[row][col] = item; return true; } return false; }; self.grid = []; self.rows = 8; self.cols = 8; self.cellSize = 225; self.init = function () { // Center the grid on screen self.x = (2048 - self.cols * self.cellSize) / 2; self.y = (2732 - self.rows * self.cellSize) / 2 + 2732 * 0.12 - 400; // Initialize grid and fill with buds for (var i = 0; i < self.rows; i++) { self.grid[i] = []; for (var j = 0; j < self.cols; j++) { var bud = new Bud(); bud.x = j * self.cellSize + self.cellSize / 2; bud.y = i * self.cellSize + self.cellSize / 2; bud.isBud = true; bud.isFlower = false; self.grid[i][j] = bud; self.addChild(bud); } } }; // Helper method to convert grid position to world position self.gridToWorld = function (gridX, gridY) { return { x: self.x + gridX * self.cellSize + self.cellSize / 2, y: self.y + gridY * self.cellSize + self.cellSize / 2 }; }; // Helper method to convert world position to grid position self.worldToGrid = function (worldX, worldY) { var localX = worldX - self.x; var localY = worldY - self.y; return { x: Math.floor(localX / self.cellSize), y: Math.floor(localY / self.cellSize) }; }; }); // GardenBackground class var GardenBackground = Container.expand(function () { var self = Container.call(this); var gardenBackground = LK.getAsset('GardenBackground', { anchorX: 0.5, anchorY: 0.5, scaleX: 1.02, scaleY: 1.02, x: 2048 / 2, y: 2732 / 2 }); self.addChild(gardenBackground); }); var Hive = Container.expand(function () { var self = Container.call(this); // Create hive sprite var hiveSprite = self.attachAsset('Hive', { anchorX: 0.5, anchorY: 0.5 }); return self; }); // PollenParticle class var PollenParticle = Container.expand(function () { var self = Container.call(this); // Particle properties self.velocity = { x: 0, y: 0 }; self.lifespan = 1; // Goes from 1 to 0 self.decayRate = 0.02; // How fast the particle fades self.type = 'trail'; // Can be 'trail' or 'burst' // Create the visual element var pollenGraphics = self.attachAsset('PollenSparkle', { anchorX: 0.5, anchorY: 0.5 }); // Initialize with random properties for more organic feel self.init = function (type) { self.type = type || 'trail'; // Set initial scale based on type if (self.type === 'trail') { self.scale.set(0.7 + Math.random() * 0.3); // Larger for trail self.decayRate = 0.03; // Faster decay for trail // Slight random velocity for trail movement self.velocity = { x: (Math.random() - 0.5) * 2, y: (Math.random() - 0.5) * 2 }; } else if (self.type === 'burst') { self.scale.set(0.5 + Math.random() * 0.3); // Smaller initial size for bursts self.decayRate = 0.01; // Slower decay for longer travel // Radial burst velocity var angle = Math.random() * Math.PI * 2; var speed = 3 + Math.random() * 5; // Increased speed for further travel self.velocity = { x: Math.cos(angle) * speed, y: Math.sin(angle) * speed }; } else if (self.type === 'fairy') { self.lifespan = undefined; // Don't fade out self.startAngle = Math.random() * Math.PI * 2; // Random start position self.orbitRadius = 20 + Math.random() * 40; // Increase orbit radius variation self.orbitSpeed = 0.005 + Math.random() * 0.03; // Increase orbit speed variation self.update = function () { var time = LK.ticks * self.orbitSpeed; // Orbit motion self.x = Math.cos(time + self.startAngle) * self.orbitRadius; self.y = Math.sin(time + self.startAngle) * self.orbitRadius; // Add bobbing self.y += Math.sin(time * 2 + self.startAngle) * 10; }; } // Random rotation speed self.rotationSpeed = (Math.random() - 0.5) * 0.2; // Random starting rotation self.rotation = Math.random() * Math.PI * 2; // Add random rotation speed for dynamic movement self.rotationSpeed = (Math.random() - 0.5) * 0.2; // Full opacity to start self.alpha = 1; return self; }; self.update = function () { // Update position based on velocity self.x += self.velocity.x; self.y += self.velocity.y; // Add rotation self.rotation += self.rotationSpeed; // Slow down velocity over time self.velocity.x *= 0.95; self.velocity.y *= 0.95; // Update lifespan and alpha self.lifespan -= self.decayRate; self.alpha = self.lifespan; // Scale slightly varies with life var scalePulse = 1 + Math.sin(LK.ticks * 0.2) * 0.1; pollenGraphics.scale.set(scalePulse * self.scale.x); // Remove when lifecycle complete if (self.lifespan <= 0) { self.destroy(); } }; }); // First, let's add a PollenTrail class to handle the dragging mechanic var PollenTrail = Container.expand(function () { var self = Container.call(this); self.points = []; self.active = false; self.currentGarden = null; // Store reference to garden self.MAX_SPEED = 15; // Adjust this value for proper feel self.startTrail = function (x, y, garden) { self.active = true; self.points = [{ x: x, y: y, time: Date.now() }]; self.startTime = Date.now(); self.trailStartTime = Date.now(); // Record start time self.currentGarden = garden; // Store garden reference self.lastPoint = { x: x, y: y }; }; self.updateTrail = function (x, y) { if (!self.active) { return; } // Enforce maximum speed var dx = x - self.lastPoint.x; var dy = y - self.lastPoint.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance > self.MAX_SPEED) { var ratio = self.MAX_SPEED / distance; x = self.lastPoint.x + dx * ratio; y = self.lastPoint.y + dy * ratio; } self.points.push({ x: x, y: y, time: Date.now() }); self.lastPoint = { x: x, y: y }; // Create particle effect along trail var particle = new PollenParticle().init('trail'); particle.x = x; particle.y = y; game.addChild(particle); }; // Add the burst effect function self.createPollenBurst = function (x, y) { for (var i = 0; i < 12; i++) { var particle = new PollenParticle().init('burst'); var angle = i / 12 * Math.PI * 2; var distance = 30; particle.x = x + Math.cos(angle) * distance; particle.y = y + Math.sin(angle) * distance; // Give particles outward velocity particle.vx = Math.cos(angle) * 3; particle.vy = Math.sin(angle) * 3; game.addChild(particle); } }; self.endTrail = function () { if (!self.active) { return; } var affectedBuds = []; var checkedPositions = {}; self.points.forEach(function (point) { var localPos = self.currentGarden.toLocal({ x: point.x, y: point.y }, game); var gridX = Math.floor(localPos.x / self.currentGarden.cellSize); var gridY = Math.floor(localPos.y / self.currentGarden.cellSize); var posKey = gridX + ',' + gridY; if (!checkedPositions[posKey] && gridX >= 0 && gridX < self.currentGarden.cols && gridY >= 0 && gridY < self.currentGarden.rows) { checkedPositions[posKey] = true; var gridItem = self.currentGarden.grid[gridY][gridX]; // Verify it's a valid bud if (gridItem && gridItem.isBud === true && gridItem.isFlower === false) { affectedBuds.push({ bud: gridItem, gridX: gridX, gridY: gridY }); } } }); if (affectedBuds.length >= 2) { affectedBuds.forEach(function (budInfo) { // IMPORTANT: Clear the grid position first self.currentGarden.grid[budInfo.gridY][budInfo.gridX] = null; // Remove the bud from display list self.currentGarden.removeChild(budInfo.bud); // Create new flower var newFlower = new BasicFlower(); newFlower.x = budInfo.bud.x; newFlower.y = budInfo.bud.y; newFlower.isFlower = true; // Update grid position and add to display list self.currentGarden.grid[budInfo.gridY][budInfo.gridX] = newFlower; self.currentGarden.addChild(newFlower); // Start bloom animation newFlower.bloom(); }); } self.active = false; self.points = []; }; self.update = function () { // Just update particles, no time checks // Update all children particles for (var i = self.children.length - 1; i >= 0; i--) { var particle = self.children[i]; if (particle && particle.update) { particle.update(); } } }; }); // Add ScoreManager to handle chain reactions and scoring var ScoreManager = Container.expand(function () { var self = Container.call(this); self.currentScore = 0; self.currentChain = 0; self.chainMultiplier = 1; self.addToChain = function () { self.currentChain++; self.chainMultiplier = Math.min(1 + self.currentChain * 0.5, 5); // Cap at 5x self.addScore(100 * self.chainMultiplier); }; self.resetChain = function () { self.currentChain = 0; self.chainMultiplier = 1; }; self.addScore = function (points) { self.currentScore += Math.floor(points); // Update score display if (game.scoreDisplay) { game.scoreDisplay.text = self.currentScore.toString(); } }; }); // Level display class var LevelDisplay = Text2.expand(function () { var self = Text2.call(this, 'Level 1', { size: 150, fill: 0xFFFFFF }); }); // Score display class var ScoreDisplay = Text2.expand(function () { var self = Text2.call(this, '0', { size: 150, fill: 0xFFFFFF }); }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 //Init game with black background }); /**** * Game Code ****/ // Declare and initialize flowerManager in global scope var flowerManager = new FlowerManager(); var titleScreen = new Container(); var background = LK.getAsset('titlebackground', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2 }); titleScreen.addChild(background); var logo = LK.getAsset('logo', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2 }); titleScreen.addChild(logo); var playButton = LK.getAsset('playButton', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2 + 200 }); titleScreen.addChild(playButton); var tutorialButton = LK.getAsset('tutorialButton', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2 + 400 }); titleScreen.addChild(tutorialButton); game.addChild(titleScreen); playButton.down = function (x, y, obj) { game.removeChild(titleScreen); var gardenBackground = new GardenBackground(); game.addChild(gardenBackground); garden = new Garden(); garden.init(); game.addChild(garden); var flowerManager = new FlowerManager(); game.flowerManager = flowerManager; var pollenTrail = new PollenTrail(); game.addChild(pollenTrail); // Ensure pollen particles are rendered on top by adding them last game.setChildIndex(pollenTrail, game.children.length - 1); // Initialize bud spawner garden.budSpawner = new BudSpawner(); garden.budSpawner.init(garden); game.addChild(garden.budSpawner); // Touch handlers game.down = function (x, y, obj) { bee.isMoving = true; bee.targetX = x; bee.targetY = y; }; game.move = function (x, y, obj) { if (bee.isMoving) { bee.targetX = x; bee.targetY = y - 200; } }; game.up = function (x, y, obj) { bee.isMoving = false; }; // Create and position hive var hive = new Hive(); hive.x = 2048 / 2; // Center horizontally hive.y = 2732 * 0.97 - 200; // Move hive down by 2% of the screen height // Create bee and position above hive var bee = new Bee(); bee.x = hive.x; // Start above hive bee.y = hive.y - 150; // Add objects to game game.addChild(hive); game.addChild(bee); // Initialize score display var scoreDisplay = new ScoreDisplay(); scoreDisplay.anchor.set(0.5, 0); LK.gui.top.addChild(scoreDisplay); game.scoreDisplay = scoreDisplay; // Add the main update loop game.update = function () { // Update spawning system if (game.budSpawner) { game.budSpawner.update(); } // Update trail system if (pollenTrail) { pollenTrail.update(); } // Update garden elements if (garden) { // Update all flowers and buds in the grid for (var i = 0; i < garden.rows; i++) { for (var j = 0; j < garden.cols; j++) { var gridItem = garden.grid[i][j]; if (gridItem && gridItem.update) { gridItem.update(); } } } } // Update all children that have update methods for (var i = 0; i < game.children.length; i++) { var child = game.children[i]; if (child && child.update) { child.update(); } } // Update all particles if (game.particlesToUpdate) { for (var i = game.particlesToUpdate.length - 1; i >= 0; i--) { var particle = game.particlesToUpdate[i]; if (particle && particle.update) { particle.update(); } } } // Update bee if (bee && bee.update) { bee.update(); } }; }; tutorialButton.down = function (x, y, obj) { // Open tutorial }; // Removed duplicate playPollenPatternAnimation method
===================================================================
--- original.js
+++ change.js
@@ -103,13 +103,10 @@
game.addChild(self.pollenTrail); // Add to game so it renders behind bee
// Pollen collection method
self.collectPollen = function (flower) {
if (self.currentPollen < self.maxPollen && flower.hasActivePollen && !flower.pollenCollected) {
- // Amount to collect (we can tune this)
- var collectAmount = 25; // Enough for ~3-4 pollinations
- // Add to current total
- self.currentPollen += collectAmount;
- // Track pollen type
+ var collectAmount = 25;
+ // Add to pollen types first
var existingType = self.pollenTypes.find(function (p) {
return p.color === flower.color;
});
if (existingType) {
@@ -119,23 +116,15 @@
color: flower.color,
amount: collectAmount
});
}
- // Ensure we don't exceed max
- if (self.currentPollen > self.maxPollen) {
- self.currentPollen = self.maxPollen;
- }
- console.log('Current Pollen:', self.currentPollen); // Temporary debug
- console.log('Pollen Types:', self.pollenTypes); // Temporary debug
- console.log('Collected pollen:', self.pollenTypes); // Debug log for pollen collection
- // Mark that we've collected from this flower and remove particles
+ // Set currentPollen to match total of all types
+ self.currentPollen = self.pollenTypes.reduce(function (total, type) {
+ return total + type.amount;
+ }, 0);
flower.pollenCollected = true;
- flower.hasActivePollen = false; // Make sure to set this false
+ flower.hasActivePollen = false;
flower.removeFairyParticles();
- // Start trail if not already active
- if (!self.pollenTrail.active) {
- self.pollenTrail.startTrail(self.x, self.y, garden);
- }
}
};
self.checkFlowerCollision = function () {
// Convert bee position to garden's local space
@@ -204,9 +193,9 @@
self.usePollen = function (bud) {
// Add debug logs
console.log('Trying to use pollen. Amount:', self.currentPollen);
console.log('Pollen types:', self.pollenTypes);
- var pollenUsed = 7; // Using about 1/4 of collected amount per pollination
+ var pollenUsed = 7;
if (self.currentPollen >= pollenUsed && self.pollenTypes.length > 0) {
self.currentPollen -= pollenUsed;
// Create burst effect at bud location
var burstParticle = new PollenParticle().init('burst');
@@ -215,13 +204,18 @@
game.addChild(burstParticle);
// Update pollen types array
var pType = self.pollenTypes[0];
pType.amount -= pollenUsed;
+ // If this type is depleted, remove it
if (pType.amount <= 0) {
self.pollenTypes.shift();
+ // If we have no more pollen types, ensure currentPollen is 0
+ if (self.pollenTypes.length === 0) {
+ self.currentPollen = 0;
+ }
}
- // Handle trail
- if (self.currentPollen <= 0 || self.pollenTypes.length === 0) {
+ // Only end trail if truly out of all pollen
+ if (self.pollenTypes.length === 0) {
self.pollenTrail.active = false;
self.pollenTrail.points = [];
}
console.log('After using pollen:', self.currentPollen); // Debug
A background image for a puzzle video game depicting the season of summer. Cartoon. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A background image for a puzzle video game depicting the season of fall. Cartoon. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A background image for a puzzle video game depicting the season of winter. Cartoon. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Multiple stylized texts with phrases that include “Hurry!” “Time’s up!” Cartoon style.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Create a SVG text design in bold cartoon style: "SPRING" in chunky rounded letters with floral accents and vines. Use spring pastels.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Create an SVG text design for "SUMMER" in bold cartoon style with chunky rounded letters. Add sun rays and small flower details in warm, vibrant colors.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Create an SVG text design for "FALL" in bold cartoon style with chunky rounded letters. Add small falling leaves and acorn accents in warm autumn colors.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Create an SVG text design for "WINTER" in bold cartoon style with chunky rounded letters. Add small snowflake accents and icy details in cool, frosty blues and white.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Create a SVG text design in bold cartoon style: “Bloom the garden" in chunky rounded letters with floral accents and vines. Use spring pastels.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Create an SVG text design for "Match the blooms" in bold cartoon style with chunky rounded letters. Add sun rays and small flower details in warm, vibrant colors.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Create an SVG text design for "Match to clear leaves" in bold cartoon style with chunky rounded letters. Add small falling leaves and acorn accents in warm autumn colors.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Create an SVG text design for "DANCE TO STAY WARM" in bold cartoon style with chunky rounded letters. Add small snowflake accents and icy details in cool, frosty blues and white.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Create a SVG text design in bold cartoon style: "SEASON COMPLETE!" in chunky rounded letters with stars around it . Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.