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
@@ -70,8 +70,9 @@
}
// Reset ball when in bottom and its speed is very low
if (ball.y > game.height * 0.6 && Math.abs(self.speedX) < 5 && Math.abs(self.speedY) < 5) {
self.reset();
+ moveHoop();
}
};
self.reset = function () {
ballPassedAboveHoop = false;
@@ -354,9 +355,19 @@
confetti.y = 0;
LK.on('tick', function () {
confetti.animate(); // Animate confetti
});
- // Initiate gradual movement of the hoop to a new random position within the game boundaries after every shoot
+ moveHoop();
+ /*
+ LK.setTimeout(function () {
+ isHandlingScore = false;
+ resetCollisionHandling();
+ },250);
+ */
+}
+function moveHoop() {
+ //console.log("moveHoop...");
+ // Initiate gradual movement of the hoop to a new random position within the game boundaries
var targetX = Math.random() * (game.width - hoop.width) + hoop.width / 2;
var targetY = Math.max(Math.random() * (game.height / 2) + 100, 780); // Ensure hoop's Y position does not go below 780
var moveHoopInterval = LK.setInterval(function () {
hoop.x += (targetX - hoop.x) * 0.05; // Move 5% of the distance per tick
@@ -364,32 +375,13 @@
// Check if the hoop is close enough to the target position to stop
if (Math.abs(hoop.x - targetX) < 1 && Math.abs(hoop.y - targetY) < 1) {
hoop.setPosition(targetX, targetY); // Ensure hoop is exactly at target position
LK.clearInterval(moveHoopInterval); // Stop the interval
- console.log("Hoop moved to new position after shoot...");
+ console.log("Ok can handle score...");
isHandlingScore = false;
resetCollisionHandling();
}
}, 16); // Run every 16ms (~60FPS)
- // Move the hoop after every shoot, regardless of scoring
- game.on('up', function (obj) {
- if (startPosition && !ball.isMoving) {
- var endPosition = obj.event.getLocalPosition(game);
- var speedX = Math.max(Math.min((endPosition.x - startPosition.x) * 0.1, maxSpeed), -maxSpeed);
- var speedY = Math.max(Math.min((endPosition.y - startPosition.y) * 0.1, maxSpeed), -maxSpeed);
- console.log("============================= SHOOT ===========================");
- ball.launch(speedX, speedY);
- startPosition = null;
- // Trigger hoop movement after a shoot
- handleScore();
- }
- });
- /*
- LK.setTimeout(function () {
- isHandlingScore = false;
- resetCollisionHandling();
- },250);
- */
}
/* ********************************************************************************* */
/* ********************************** MAIN LOOP ************************************ */
/* ********************************************************************************* */