Code edit (1 edits merged)
Please save this source code
User prompt
add a weight to each ball with the bigger being hevier
User prompt
remove the threshold that you added
Code edit (1 edits merged)
Please save this source code
User prompt
add a clause that enables or disables the delay on spawning balls
User prompt
remove the delay from spawning balls
User prompt
Add a threshold to balls movement to avoid micro movements
User prompt
when the ball upgrades the score gets bumped up for a frame and then goes back down, why is this. please provide a solution?
User prompt
when the ball upgrades the score gets bumped up for a frame and then goes back down, why is this. please provide a solution
User prompt
use the function that detect an upgrade to add score when it takes palce
User prompt
detect when an upgrade of balls takes place
Code edit (1 edits merged)
Please save this source code
User prompt
in the upgrade function also add point when upgrading
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'reduce')' in or related to this line: 'self.value = balls.reduce(function (score, ball) {' Line Number: 114
User prompt
reward the player for when they get balls to merge
User prompt
when 2 balls merge add their point value to the score
User prompt
add a detection for balls merging
User prompt
spawn balls on every mouse click
User prompt
remove the ball spawning cooldown so i can throw balls faster
User prompt
i cant see the countdown
User prompt
let he spawn balls every mouse click
User prompt
remove the ball spawning cooldown so i can throw balls faster
User prompt
remove the ball spawning cooldown so i can throw balls faster
User prompt
also add a count down in the middle of the screen with the gameovertimer
User prompt
remove the ball spawning cooldown so i can throw balls faster
===================================================================
--- original.js
+++ change.js
@@ -46,21 +46,18 @@
// Already at largest size, no upgrade
return;
}
// Replace current asset with the next upgrade
- console.log("Ball upgraded from type ".concat(self.type, " to type ").concat(nextType));
self.removeChild(ballGraphics);
assetId = 'ball' + nextType;
ballGraphics = self.attachAsset(assetId, {
anchorX: 0.5,
anchorY: 0.5
});
self.type = nextType;
- // Increase the score by the point value of the merged ball
- var pointValue = Math.pow(2, parseInt(self.type) - 1);
- LK.setScore(LK.getScore() + pointValue);
- // Update score text
- score.updateScore();
+ // Increase the score when balls merge
+ var rewardPoints = Math.pow(2, parseInt(self.type));
+ LK.setScore(LK.getScore() + rewardPoints);
};
});
// Class to display the next ball type in the top left corner
var NextBallDisplay = Container.expand(function (type) {
@@ -150,19 +147,19 @@
return Number(type);
}
var score = new Score();
LK.gui.top.addChild(score);
+score.updateScore();
var balls = [];
// Function to check for collisions and upgrade balls
function checkCollisions() {
for (var i = 0; i < balls.length; i++) {
for (var j = i + 1; j < balls.length; j++) {
if (balls[i].intersects(balls[j]) && balls[i].type === balls[j].type) {
- console.log("Balls of type ".concat(balls[i].type, " merged at (").concat(balls[i].x, ", ").concat(balls[i].y, ")"));
balls[i].upgrade();
balls[j].destroy();
balls.splice(j, 1);
- // Update score text
+ // Update score display
score.updateScore();
// Adjust index to continue checking without skipping a ball
j--;
}