User prompt
I don’t see the red bubbles
User prompt
Make red bubbles that appear every 1 minute and you have to pop them before they get to the top or you will lose
User prompt
Make bubbles float up faster
User prompt
Make the bubbles more cyan
User prompt
Make the bubbles different shades of blue
User prompt
Make the bubbles all blue
User prompt
Make the bubble popped counter black and bigger
User prompt
Make less bubbles float up at a time
User prompt
Make the bubbles float up faster
Code edit (1 edits merged)
Please save this source code
User prompt
Bubble Zen
Initial prompt
Make a game where bubbles come up from the bottom of the screen and you have to pop them before they go offscreen. Make the game very relaxing and make it feel like the player has all control. If they miss one then nothing happens. It just infinitely goes on so you can pop the bubbles floating up for as long as you want.
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var Bubble = Container.expand(function () {
var self = Container.call(this);
// Set the color of the bubble to different shades of cyan
var colors = [0x00FFFF, 0x00E5EE, 0x00CED1, 0x00B2D2, 0x008B8B];
var color = colors[Math.floor(Math.random() * colors.length)];
// Create and attach the bubble graphic
var bubbleGraphic = self.attachAsset('bubble', {
anchorX: 0.5,
anchorY: 0.5,
tint: color
});
// Set random size (scale)
var scale = 0.5 + Math.random() * 1;
bubbleGraphic.scale.set(scale, scale);
// Set bubble properties
self.speed = 2 + Math.random() * 3; // Increase the speed range
self.active = true;
self.alpha = 0; // Start transparent
// Handle bubble tap/click
self.down = function (x, y, obj) {
if (self.active) {
self.popBubble();
}
};
// Pop the bubble
self.popBubble = function () {
// Prevent multiple pops
self.active = false;
// Play pop sound
LK.getSound('pop').play();
// Increment score
LK.setScore(LK.getScore() + 1);
// Create pop effect
var popEffect = LK.getAsset('bubblePop', {
anchorX: 0.5,
anchorY: 0.5,
x: bubbleGraphic.x,
y: bubbleGraphic.y,
alpha: 0.7,
tint: bubbleGraphic.tint
});
self.addChild(popEffect);
// Animate pop effect
tween(popEffect, {
alpha: 0,
scaleX: scale * 1.5,
scaleY: scale * 1.5
}, {
duration: 300,
onFinish: function onFinish() {
popEffect.destroy();
self.destroy();
}
});
// Hide original bubble immediately
bubbleGraphic.alpha = 0;
};
// Update bubble position
self.update = function () {
if (self.active) {
self.y -= self.speed;
// Fade in when first appearing
if (self.alpha < 1) {
self.alpha += 0.05;
}
// If bubble goes off screen, remove it
if (self.y < -200) {
self.destroy();
}
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB
});
/****
* Game Code
****/
// Set up game variables
var bubbles = [];
var lastBubbleTime = 0;
var bubbleInterval = 500; // ms between bubble spawns
var maxBubbles = 10; // Maximum number of bubbles on screen
var gradientColors = [0x87CEEB, 0x1E90FF]; // Sky blue gradient
// Set up score display
var scoreTxt = new Text2('0', {
size: 100,
fill: 0x000000
});
scoreTxt.anchor.set(0.5, 0);
scoreTxt.alpha = 0.7; // Make it slightly transparent for zen feel
LK.gui.top.addChild(scoreTxt);
// Create a "Bubbles Popped" label
var labelTxt = new Text2('Bubbles Popped', {
size: 40,
fill: 0xFFFFFF
});
labelTxt.anchor.set(0.5, 1);
labelTxt.alpha = 0.7;
labelTxt.y = -10; // Position it above the score
LK.gui.top.addChild(labelTxt);
// Play ambient music
LK.playMusic('ambientMusic', {
fade: {
start: 0,
end: 0.5,
duration: 2000
}
});
// Create a new bubble
function createBubble() {
// Don't create more bubbles if we're at the maximum
if (bubbles.length >= maxBubbles) {
return;
}
var bubble = new Bubble();
// Position bubble randomly along the bottom of the screen
bubble.x = Math.random() * 2048;
bubble.y = 2732 + 100; // Start below the screen
// Add to game and tracking array
game.addChild(bubble);
bubbles.push(bubble);
}
// Main game update loop
game.update = function () {
// Update time tracking for bubble creation
var currentTime = Date.now();
// Create new bubbles at the defined interval
if (currentTime - lastBubbleTime > bubbleInterval) {
createBubble();
lastBubbleTime = currentTime;
}
// Clean up destroyed bubbles from the array
for (var i = bubbles.length - 1; i >= 0; i--) {
if (!bubbles[i].parent) {
bubbles.splice(i, 1);
}
}
// Update score display
scoreTxt.setText(LK.getScore());
};
// Handle tap/click anywhere on the game (for bubbles that might be missed by direct targeting)
game.down = function (x, y, obj) {
// This is handled by each bubble individually
};
// Create initial bubbles
for (var i = 0; i < 5; i++) {
LK.setTimeout(function () {
createBubble();
}, i * 300);
} ===================================================================
--- original.js
+++ change.js
@@ -21,9 +21,9 @@
// Set random size (scale)
var scale = 0.5 + Math.random() * 1;
bubbleGraphic.scale.set(scale, scale);
// Set bubble properties
- self.speed = 1 + Math.random() * 2; // Random float speed
+ self.speed = 2 + Math.random() * 3; // Increase the speed range
self.active = true;
self.alpha = 0; // Start transparent
// Handle bubble tap/click
self.down = function (x, y, obj) {