User prompt
if an object is above y=0, start the gameovertimer (3 seconds) flash the screen red every second, if the timer is over check again if an object is above y=0 then go game over, if there is none then continiue the game like normal
User prompt
remove the ball spawning cooldown
User prompt
add score when balls merge
User prompt
also add points for every new merged ball not only the new spawned balls
User prompt
if an object is above y=0 instead of going game over instantly, start the game over timer (3 seconds) flash the screen red every second, if the timer is over check again if an object is above y=0 then go game over, if there is none then continiue the game like normal
User prompt
when an object gets above y=0 go game over
User prompt
Migrate to the latest version of LK
User prompt
Replace getBallColor with a custom function
User prompt
replace newBall.getAssetColor by a custom function
User prompt
make the background color a darker version of the last spawned ball
User prompt
make the background a darker version of the last dropped ball
User prompt
make a multiplier when balls merge
User prompt
make a multiplier
User prompt
showmultiplier in the top right
User prompt
make a multiplier
User prompt
add a ball merging multiplier
User prompt
modefy the code so that merging balls gives +1 score
User prompt
modefy the code so that merging balls gives +1 score
User prompt
if balls merge add one to the score, keep the normal score
User prompt
change the score so each merge should be the normal score +1
User prompt
halve the size of each ball
User prompt
make it impossible for balls to clip into eachother
User prompt
what you changed is good, but make the bounce on collissiong with other balls less
User prompt
make the balls bounce less
User prompt
what you changed is good, but make the bounce on collide less
===================================================================
--- original.js
+++ change.js
@@ -2,18 +2,15 @@
* Classes
****/
var Multiplier = Container.expand(function () {
var self = Container.call(this);
- var multiplierText = new Text2('1x', {
- size: 150,
- fill: "#ffffff"
- });
- self.addChild(multiplierText);
self.value = 1;
- self.updateMultiplier = function (value) {
- self.value = value;
- multiplierText.setText(self.value + 'x');
+ self.increaseMultiplier = function () {
+ self.value += 1;
};
+ self.resetMultiplier = function () {
+ self.value = 1;
+ };
});
// Class to display the next ball type in the top left corner
var NextBallDisplay = Container.expand(function (type) {
var self = Container.call(this);
@@ -110,10 +107,11 @@
anchorX: 0.5,
anchorY: 0.5
});
self.type = nextType;
- // Increase the score when balls merge
- multiplier.updateMultiplier(multiplier.value + 1);
+ // Increase the score and multiplier when balls merge
+ LK.setScore(LK.getScore() + 1);
+ multiplier.increaseMultiplier();
};
});
/****
@@ -159,10 +157,8 @@
return Number(type);
}
var score = new Score();
LK.gui.top.addChild(score);
-var multiplierDisplay = new Multiplier();
-LK.gui.topRight.addChild(multiplierDisplay);
var balls = [];
// Function to check for collisions and upgrade balls
function checkCollisions() {
for (var i = 0; i < balls.length; i++) {
@@ -209,8 +205,10 @@
canThrowBall = true;
// Calculate the next ball type for the upcoming throw
nextBallType = calculateNextBallType(ballCount);
nextBallDisplay.updateNextBallType(nextBallType); // Update the display with the new next ball type
+ // Reset the multiplier when a new ball is thrown
+ multiplier.resetMultiplier();
}, 1000);
}
});
// Main game update loop