Code edit (1 edits merged)
Please save this source code
Code edit (2 edits merged)
Please save this source code
User prompt
popupBucket, while fading out, make the bucketAsset rotate
Code edit (4 edits merged)
Please save this source code
User prompt
call popupBucket on score
Code edit (1 edits merged)
Please save this source code
User prompt
in popupMultiplier, add an offset to the asset position so that it doesn't go out of screen
Code edit (5 edits merged)
Please save this source code
User prompt
in popupMultiplier, when grow anim ends fade the asset and destroy it
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
in popupMultiplier, don't use scale, use width and height
Code edit (1 edits merged)
Please save this source code
User prompt
call popupMultiplier(value, x, y) at each bounce
Code edit (2 edits merged)
Please save this source code
User prompt
in popupMultiplier, popup the x2 asset at the position x,y. start at with,heigth 1x1 and make it grow until 1024x1024
User prompt
in popupMultiplier, check if value is in possibleValues, if not set it to 999;
Code edit (5 edits merged)
Please save this source code
User prompt
flash the ball at each bounce
User prompt
flash the screen at each bounce
Code edit (7 edits merged)
Please save this source code
User prompt
move the hoop after a shoot even if not scored
Code edit (1 edits merged)
Please save this source code
Code edit (9 edits merged)
Please save this source code
User prompt
don't accept other touch while ball is moving
===================================================================
--- original.js
+++ change.js
@@ -344,8 +344,9 @@
console.log("handleScore...");
isHandlingScore = true;
score += bounceMultiplier; // Add bounce counter to score
scoreTxt.setText(score.toString());
+ popupBucket(true);
//ball.reset();
ballPassedAboveHoop = false; // Reset the condition after scoring
ballPassedInsideHoop = false;
// Create and add confetti effect to the game
@@ -390,11 +391,11 @@
if (!possibleValues.includes(value)) {
value = 999;
}
// Create and configure the x2 asset
- var popupOffset = 256;
+ var popupOffset = 384;
var popupSpeed = 60;
- var multiplierAsset = LK.getAsset('x2', {
+ var multiplierAsset = LK.getAsset('x' + value, {
anchorX: 0.5,
anchorY: 0.5,
x: Math.min(Math.max(x, popupOffset), game.width - popupOffset),
y: Math.min(Math.max(y, popupOffset), game.height - popupOffset),
@@ -419,8 +420,38 @@
}, 4); // Run every 16ms (~60FPS)
}
}, 1); // Run every 16ms (~60FPS)
}
+function popupBucket(isCombo) {
+ console.log("popupBucket", isCombo);
+ var popupSpeed = 60;
+ var bucketAsset = LK.getAsset('bucket', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: game.width / 2,
+ y: game.height / 2,
+ width: 1,
+ height: 1
+ });
+ game.addChild(bucketAsset);
+ // Animate the growth of the x2 asset to 1024x1024
+ var growInterval = LK.setInterval(function () {
+ bucketAsset.width += popupSpeed;
+ bucketAsset.height += popupSpeed;
+ // Check if the asset has grown to or beyond 1024x1024
+ if (bucketAsset.width >= 2048 || bucketAsset.height >= 2048) {
+ LK.clearInterval(growInterval); // Stop the growth animation
+ // Start fade out animation
+ var fadeOutInterval = LK.setInterval(function () {
+ bucketAsset.alpha -= 0.05; // Reduce alpha to fade out
+ if (bucketAsset.alpha <= 0) {
+ LK.clearInterval(fadeOutInterval); // Stop the fade out animation
+ bucketAsset.destroy(); // Destroy the asset after fading out
+ }
+ }, 4); // Run every 16ms (~60FPS)
+ }
+ }, 1); // Run every 16ms (~60FPS)
+}
/* ********************************************************************************* */
/* ********************************** MAIN LOOP ************************************ */
/* ********************************************************************************* */
LK.on('tick', function () {