User prompt
Much bigger please βͺπ‘ Consider importing and using the following plugins: @upit/tween.v1
User prompt
A bigger Explosion βͺπ‘ Consider importing and using the following plugins: @upit/tween.v1
User prompt
Make a Partikel Explosion when a bubble Pops βͺπ‘ Consider importing and using the following plugins: @upit/tween.v1
Code edit (2 edits merged)
Please save this source code
User prompt
Make the Partikels bigger βͺπ‘ Consider importing and using the following plugins: @upit/tween.v1
User prompt
Mach die Partikel im Hintergrund weg und die der goldenen bubble groΜΓer βͺπ‘ Consider importing and using the following plugins: @upit/tween.v1
User prompt
Add an asset For the Partikels βͺπ‘ Consider importing and using the following plugins: @upit/tween.v1
User prompt
Add so much more Partikels βͺπ‘ Consider importing and using the following plugins: @upit/tween.v1
User prompt
Add more Partikels βͺπ‘ Consider importing and using the following plugins: @upit/tween.v1
User prompt
Add partikels when a bubble Pops βͺπ‘ Consider importing and using the following plugins: @upit/tween.v1
User prompt
Make the Animations better and add more βͺπ‘ Consider importing and using the following plugins: @upit/tween.v1
User prompt
Add small bubble to the Background
User prompt
Add a BG asset
User prompt
Spawn ein paar mehr Bubbles
Code edit (1 edits merged)
Please save this source code
User prompt
Mach es unendlich und Spawn nur halb so viele Bubbles
User prompt
Mach den Text wie vorher und mach die kleinen Bubbles groΜΓer
User prompt
Mach alles groΜΓer
Code edit (1 edits merged)
Please save this source code
User prompt
Bubble Pop Satisfaction
Initial prompt
Make a satisfying game
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var Bubble = Container.expand(function () {
var self = Container.call(this);
self.bubbleType = 'normal';
self.speed = 2;
self.size = 1;
self.popped = false;
var bubbleGraphics = self.attachAsset('bubble', {
anchorX: 0.5,
anchorY: 0.5
});
self.setType = function (type, size) {
self.bubbleType = type;
self.size = size || 1;
if (type === 'golden') {
self.removeChildren();
bubbleGraphics = self.attachAsset('goldenBubble', {
anchorX: 0.5,
anchorY: 0.5
});
bubbleGraphics.tint = 0xFFD700;
// Add pulsing animation for golden bubbles
self.pulseAnimation = function () {
if (!self.popped) {
tween(self, {
scaleX: self.size * 2.2,
scaleY: self.size * 2.2
}, {
duration: 800,
easing: tween.easeInOut,
onFinish: function onFinish() {
if (!self.popped) {
tween(self, {
scaleX: self.size * 2.0,
scaleY: self.size * 2.0
}, {
duration: 800,
easing: tween.easeInOut,
onFinish: self.pulseAnimation
});
}
}
});
}
};
} else if (size < 1) {
self.removeChildren();
bubbleGraphics = self.attachAsset('smallBubble', {
anchorX: 0.5,
anchorY: 0.5
});
var colors = [0xFF6B6B, 0x4ECDC4, 0x45B7D1, 0xFDAA4C, 0xA8E6CF];
bubbleGraphics.tint = colors[Math.floor(Math.random() * colors.length)];
} else {
var colors = [0xFF6B6B, 0x4ECDC4, 0x45B7D1, 0xFDAA4C, 0xA8E6CF];
bubbleGraphics.tint = colors[Math.floor(Math.random() * colors.length)];
}
self.scaleX = self.scaleY = self.size * 2.0;
// Start pulsing animation for golden bubbles
if (type === 'golden') {
LK.setTimeout(self.pulseAnimation, 100);
}
};
self.pop = function () {
if (self.popped) {
return [];
}
self.popped = true;
var newBubbles = [];
if (self.bubbleType === 'golden') {
LK.getSound('goldPop').play();
} else {
LK.getSound('pop').play();
}
tween(self, {
scaleX: self.size * 2.4,
scaleY: self.size * 2.4,
alpha: 0
}, {
duration: 300,
easing: tween.easeOut
});
if (self.size >= 1 && self.bubbleType !== 'golden') {
var numBubbles = 2 + Math.floor(Math.random() * 2);
for (var i = 0; i < numBubbles; i++) {
var angle = Math.PI * 2 / numBubbles * i;
newBubbles.push({
x: self.x + Math.cos(angle) * 80,
y: self.y + Math.sin(angle) * 80,
size: 0.5,
delay: i * 100
});
}
}
return newBubbles;
};
self.update = function () {
if (!self.popped) {
self.y -= self.speed;
self.x += Math.sin(LK.ticks * 0.02 + self.y * 0.01) * 1.5;
}
};
self.down = function (x, y, obj) {
if (!self.popped) {
game.popBubble(self);
}
};
return self;
});
var Particle = Container.expand(function () {
var self = Container.call(this);
self.speed = 3 + Math.random() * 4;
self.angle = Math.random() * Math.PI * 2;
self.life = 1.0;
self.decay = 0.02 + Math.random() * 0.02;
var particleGraphics = self.attachAsset('smallBubble', {
anchorX: 0.5,
anchorY: 0.5
});
// Random size and color
self.scaleX = self.scaleY = 0.3 + Math.random() * 0.4;
var colors = [0xFF6B6B, 0x4ECDC4, 0x45B7D1, 0xFDAA4C, 0xA8E6CF, 0xFFD700];
particleGraphics.tint = colors[Math.floor(Math.random() * colors.length)];
self.update = function () {
// Move particle
self.x += Math.cos(self.angle) * self.speed;
self.y += Math.sin(self.angle) * self.speed;
// Apply gravity
self.angle += 0.05;
self.speed *= 0.98;
// Fade out
self.life -= self.decay;
self.alpha = self.life;
self.scaleX = self.scaleY = self.life * (0.3 + Math.random() * 0.4);
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x1A237E
});
/****
* Game Code
****/
game.setBackgroundColor(0x0D47A1);
// Add background image
var background = game.attachAsset('background', {
anchorX: 0,
anchorY: 0,
x: 0,
y: 0
});
// Add decorative small bubbles to background
var backgroundBubbles = [];
for (var i = 0; i < 15; i++) {
var bgBubble = background.attachAsset('smallBubble', {
anchorX: 0.5,
anchorY: 0.5
});
bgBubble.x = Math.random() * 2048;
bgBubble.y = Math.random() * 2732;
bgBubble.alpha = 0.3;
bgBubble.scaleX = bgBubble.scaleY = 0.5 + Math.random() * 0.5;
var colors = [0xFF6B6B, 0x4ECDC4, 0x45B7D1, 0xFDAA4C, 0xA8E6CF];
bgBubble.tint = colors[Math.floor(Math.random() * colors.length)];
bgBubble.baseY = bgBubble.y;
bgBubble.floatSpeed = 0.5 + Math.random() * 1;
bgBubble.floatRange = 20 + Math.random() * 30;
backgroundBubbles.push(bgBubble);
}
var bubbles = [];
var particles = [];
var missedBubbles = 0;
var speedMultiplier = 1;
var lastSpeedIncrease = 0;
var comboCount = 0;
var lastPopTime = 0;
var scoreTxt = new Text2('0', {
size: 150,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
var missedTxt = new Text2('Missed: 0/10', {
size: 100,
fill: 0xFF6B6B
});
missedTxt.anchor.set(1, 0);
missedTxt.x = -20;
LK.gui.topRight.addChild(missedTxt);
var comboTxt = new Text2('', {
size: 120,
fill: 0xFFD700
});
comboTxt.anchor.set(0.5, 0.5);
LK.gui.center.addChild(comboTxt);
game.popBubble = function (bubble) {
var currentTime = Date.now();
if (currentTime - lastPopTime < 1000) {
comboCount++;
if (comboCount > 2) {
LK.getSound('combo').play();
comboTxt.setText('Combo x' + comboCount + '!');
comboTxt.alpha = 1;
tween(comboTxt, {
alpha: 0
}, {
duration: 1000,
easing: tween.easeOut
});
}
} else {
comboCount = 1;
}
lastPopTime = currentTime;
// Create particles when bubble pops
var particleCount = bubble.bubbleType === 'golden' ? 12 : bubble.size >= 1 ? 8 : 5;
spawnParticles(bubble.x, bubble.y, particleCount, bubble.bubbleType);
var points = 10;
if (bubble.bubbleType === 'golden') {
points = 100;
clearAllBubbles();
} else {
points *= comboCount;
if (bubble.size < 1) {
points = Math.floor(points * 0.5);
}
}
LK.setScore(LK.getScore() + points);
scoreTxt.setText(LK.getScore());
// Game is now infinite - no win condition
var newBubbleData = bubble.pop();
for (var i = 0; i < newBubbleData.length; i++) {
var data = newBubbleData[i];
var newBubble = new Bubble();
newBubble.setType('normal', data.size);
newBubble.x = data.x;
newBubble.y = data.y;
newBubble.speed = speedMultiplier * 2;
// Add bouncy spawn animation with delay
newBubble.scaleX = newBubble.scaleY = 0;
LK.setTimeout(function (bubble) {
return function () {
tween(bubble, {
scaleX: bubble.size * 2.0,
scaleY: bubble.size * 2.0
}, {
duration: 400,
easing: tween.bounceOut
});
};
}(newBubble), data.delay || 0);
bubbles.push(newBubble);
game.addChild(newBubble);
}
};
function clearAllBubbles() {
// Add screen shake effect
var originalX = game.x;
var originalY = game.y;
var shakeIntensity = 10;
var shakeDuration = 500;
var shakeCount = 0;
var maxShakes = 20;
var shakeInterval = LK.setInterval(function () {
if (shakeCount < maxShakes) {
game.x = originalX + (Math.random() - 0.5) * shakeIntensity;
game.y = originalY + (Math.random() - 0.5) * shakeIntensity;
shakeCount++;
} else {
game.x = originalX;
game.y = originalY;
LK.clearInterval(shakeInterval);
}
}, shakeDuration / maxShakes);
for (var i = bubbles.length - 1; i >= 0; i--) {
var bubble = bubbles[i];
if (!bubble.popped) {
bubble.pop();
LK.setScore(LK.getScore() + 5);
}
}
scoreTxt.setText(LK.getScore());
}
function spawnParticles(x, y, count, bubbleType) {
for (var i = 0; i < count; i++) {
var particle = new Particle();
particle.x = x + (Math.random() - 0.5) * 40;
particle.y = y + (Math.random() - 0.5) * 40;
// Golden bubbles create more spectacular particles
if (bubbleType === 'golden') {
particle.speed *= 1.5;
particle.scaleX = particle.scaleY = 0.5 + Math.random() * 0.5;
var goldenColors = [0xFFD700, 0xFFA500, 0xFFFF00];
particle.children[0].tint = goldenColors[Math.floor(Math.random() * goldenColors.length)];
}
// Add spawn animation
particle.alpha = 0;
tween(particle, {
alpha: 1
}, {
duration: 100,
easing: tween.easeOut
});
particles.push(particle);
game.addChild(particle);
}
}
function spawnBubble() {
var bubble = new Bubble();
if (Math.random() < 0.05) {
bubble.setType('golden');
} else {
bubble.setType('normal');
}
bubble.x = 200 + Math.random() * (2048 - 400);
bubble.y = 2732 + 100;
bubble.speed = speedMultiplier * (2 + Math.random() * 2);
// Add spawn animation
bubble.scaleX = bubble.scaleY = 0;
tween(bubble, {
scaleX: bubble.size * 2.0,
scaleY: bubble.size * 2.0
}, {
duration: 500,
easing: tween.elasticOut
});
bubbles.push(bubble);
game.addChild(bubble);
}
game.update = function () {
// Animate background bubbles with smooth tween
for (var j = 0; j < backgroundBubbles.length; j++) {
var bgBubble = backgroundBubbles[j];
bgBubble.y = bgBubble.baseY + Math.sin(LK.ticks * 0.01 * bgBubble.floatSpeed) * bgBubble.floatRange;
// Add subtle rotation animation
if (!bgBubble.rotationTween) {
bgBubble.rotationTween = true;
tween(bgBubble, {
rotation: Math.PI * 2
}, {
duration: 10000 + Math.random() * 5000,
easing: tween.linear,
onFinish: function onFinish() {
bgBubble.rotation = 0;
bgBubble.rotationTween = false;
}
});
}
}
if (LK.ticks - lastSpeedIncrease > 1800) {
speedMultiplier += 0.2;
lastSpeedIncrease = LK.ticks;
}
if (LK.ticks % Math.floor(80 / speedMultiplier) === 0) {
spawnBubble();
}
for (var i = bubbles.length - 1; i >= 0; i--) {
var bubble = bubbles[i];
if (bubble.lastY === undefined) {
bubble.lastY = bubble.y;
}
if (bubble.lastY > -100 && bubble.y <= -100 && !bubble.popped) {
missedBubbles++;
missedTxt.setText('Missed: ' + missedBubbles + '/10');
if (missedBubbles >= 10) {
LK.showGameOver();
}
bubble.destroy();
bubbles.splice(i, 1);
continue;
}
if (bubble.popped && bubble.alpha <= 0) {
bubble.destroy();
bubbles.splice(i, 1);
continue;
}
bubble.lastY = bubble.y;
}
// Update and cleanup particles
for (var p = particles.length - 1; p >= 0; p--) {
var particle = particles[p];
if (particle.life <= 0 || particle.alpha <= 0) {
particle.destroy();
particles.splice(p, 1);
continue;
}
}
};
LK.playMusic('bgmusic'); ===================================================================
--- original.js
+++ change.js
@@ -113,8 +113,36 @@
}
};
return self;
});
+var Particle = Container.expand(function () {
+ var self = Container.call(this);
+ self.speed = 3 + Math.random() * 4;
+ self.angle = Math.random() * Math.PI * 2;
+ self.life = 1.0;
+ self.decay = 0.02 + Math.random() * 0.02;
+ var particleGraphics = self.attachAsset('smallBubble', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ // Random size and color
+ self.scaleX = self.scaleY = 0.3 + Math.random() * 0.4;
+ var colors = [0xFF6B6B, 0x4ECDC4, 0x45B7D1, 0xFDAA4C, 0xA8E6CF, 0xFFD700];
+ particleGraphics.tint = colors[Math.floor(Math.random() * colors.length)];
+ self.update = function () {
+ // Move particle
+ self.x += Math.cos(self.angle) * self.speed;
+ self.y += Math.sin(self.angle) * self.speed;
+ // Apply gravity
+ self.angle += 0.05;
+ self.speed *= 0.98;
+ // Fade out
+ self.life -= self.decay;
+ self.alpha = self.life;
+ self.scaleX = self.scaleY = self.life * (0.3 + Math.random() * 0.4);
+ };
+ return self;
+});
/****
* Initialize Game
****/
@@ -151,8 +179,9 @@
bgBubble.floatRange = 20 + Math.random() * 30;
backgroundBubbles.push(bgBubble);
}
var bubbles = [];
+var particles = [];
var missedBubbles = 0;
var speedMultiplier = 1;
var lastSpeedIncrease = 0;
var comboCount = 0;
@@ -194,8 +223,11 @@
} else {
comboCount = 1;
}
lastPopTime = currentTime;
+ // Create particles when bubble pops
+ var particleCount = bubble.bubbleType === 'golden' ? 12 : bubble.size >= 1 ? 8 : 5;
+ spawnParticles(bubble.x, bubble.y, particleCount, bubble.bubbleType);
var points = 10;
if (bubble.bubbleType === 'golden') {
points = 100;
clearAllBubbles();
@@ -260,8 +292,32 @@
}
}
scoreTxt.setText(LK.getScore());
}
+function spawnParticles(x, y, count, bubbleType) {
+ for (var i = 0; i < count; i++) {
+ var particle = new Particle();
+ particle.x = x + (Math.random() - 0.5) * 40;
+ particle.y = y + (Math.random() - 0.5) * 40;
+ // Golden bubbles create more spectacular particles
+ if (bubbleType === 'golden') {
+ particle.speed *= 1.5;
+ particle.scaleX = particle.scaleY = 0.5 + Math.random() * 0.5;
+ var goldenColors = [0xFFD700, 0xFFA500, 0xFFFF00];
+ particle.children[0].tint = goldenColors[Math.floor(Math.random() * goldenColors.length)];
+ }
+ // Add spawn animation
+ particle.alpha = 0;
+ tween(particle, {
+ alpha: 1
+ }, {
+ duration: 100,
+ easing: tween.easeOut
+ });
+ particles.push(particle);
+ game.addChild(particle);
+ }
+}
function spawnBubble() {
var bubble = new Bubble();
if (Math.random() < 0.05) {
bubble.setType('golden');
@@ -331,6 +387,15 @@
continue;
}
bubble.lastY = bubble.y;
}
+ // Update and cleanup particles
+ for (var p = particles.length - 1; p >= 0; p--) {
+ var particle = particles[p];
+ if (particle.life <= 0 || particle.alpha <= 0) {
+ particle.destroy();
+ particles.splice(p, 1);
+ continue;
+ }
+ }
};
LK.playMusic('bgmusic');
\ No newline at end of file