User prompt
In score to 8,000 to 10,000 to up it lagging the game, it's not smooth,its delaying, make sure it will handle until the player done playing or quit the game. From the start to end make sure it handle it all the animations, explosion,the use of special flower,etc. fix all issues, bugs, errors,etc in the game. Fix to the start up of the game something wrong. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
See for more errors, issues, bugs etc then fix it ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Please fix the bug: 'TypeError: Cannot use 'in' operator to search for 'scaleX' in null' in or related to this line: 'tween(swipeStartFlower, {' Line Number: 1368 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'toGlobal')' in or related to this line: 'var gamePos = game.toLocal(obj.parent.toGlobal(obj.position));' Line Number: 1274
User prompt
Define properly the effects of the special flower like glimmer and rainbow, fix all existing errors, issues, bugs, etc in the code. Make the game smooth,run smoothly,no delay,etc. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Fix the touch, swiping in flowers, I swipe a flower but different flowers been swipe. Fix it all make it smooth. Make sure swipe using touch, swipe the correct one. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
After explosion of the match flower it's stuck again the flower do not fall. Also fix the swipe action for matching flowers or even swiping the flowers into the match flower. Make it smooth. Fix all errors,find all errors, change the code if it's inconsistent and make the game smooth,run the game smoothly,no delay,no anything, handle all the animations, explosion,etc and make the storage handle it,so it will not crash,or even lag, delay,etc. ↪💡 Consider importing and using the following plugins: @upit/tween.v1, @upit/storage.v1
User prompt
Fix the smooth transition,animations,etc. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Fix the code from the top to the bottom, to the start to end of code. ↪💡 Consider importing and using the following plugins: @upit/tween.v1, @upit/storage.v1
User prompt
Find all errors, issues,bugs,etc
User prompt
It stop again when it's having high score and it's having many explode flowers. Fix that one. Make it, it can handle everything. From to many flower explosion to more time playing this game. Fix every errors,etc. then make it smooth. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Make the game smooth in playing, no error,no issues,etc. fix it all. Then make it consistent the games code. Smooth in everything. No delay. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Sure put all of that you said. ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Make the game last as long the player is playing or until he quits, then make the game known it's user high score and display it along side his score while playing. ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Fix it the code. Make the game smooth. Make it consistent. Fix it. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Fix the part where in the five flowers to make the rainbow,it take time and it did not show up. Fix it. Everything that have an issues in the code,bugs, errors,etc. fix it. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
The sliding the flower to different direction make it smooth and consistent. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Fix all errors, issues,bugs,etc in the code of the game. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Fix all of them then ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
The very effect of the special flower, like the shimmer and rainbow effect do not match what effect I said. The shimmer if used or swiped at a flower it will explode alongside the other four flower, then rainbow can be used when swipe at a flower then that same flower in the game will explode at the same time. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Fix the background asset and sound asset
User prompt
Fix them all,the issues,bugs,error,etc. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Fix code, utilities code,fix some bugs, errors. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
When 4 flowers been match it will create a flower that have shimmer effect on that flower then when used it will explode. When 5 flowers been match it will create a flower with rainbow effect that if swipe in a flower it will make that type of flower and then explode. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Fix it then. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var Flower = Container.expand(function (type) {
var self = Container.call(this);
self.flowerType = type;
self.gridX = 0;
self.gridY = 0;
var flowerGraphics = self.attachAsset(type, {
anchorX: 0.5,
anchorY: 0.5
});
// Add subtle glow effect
flowerGraphics.alpha = 0.9;
self.down = function (x, y, obj) {
if (!isSwapping && !isMatching) {
game.selectFlower(self);
}
};
self.animateMatch = function (callback) {
var particlesCompleted = 0;
var totalParticles = 16;
var flowerAnimationDone = false;
var callbackCalled = false;
function checkAllComplete() {
if (particlesCompleted === totalParticles && flowerAnimationDone && callback && !callbackCalled) {
callbackCalled = true;
callback();
}
}
// Create spectacular particle explosion effect
for (var i = 0; i < totalParticles; i++) {
var particle = self.attachAsset('particle', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.5 + Math.random() * 1.0,
scaleY: 1.5 + Math.random() * 1.0,
alpha: 1.0
});
var angle = i / totalParticles * Math.PI * 2 + Math.random() * 0.8;
var distance = 120 + Math.random() * 100;
var targetX = Math.cos(angle) * distance;
var targetY = Math.sin(angle) * distance;
// Add initial burst motion
particle.x = Math.cos(angle) * 20;
particle.y = Math.sin(angle) * 20;
tween(particle, {
x: targetX,
y: targetY,
scaleX: 0.1,
scaleY: 0.1,
alpha: 0,
rotation: Math.random() * Math.PI * 6
}, {
duration: 600 + Math.random() * 400,
easing: tween.easeOut,
onFinish: function onFinish() {
particle.destroy();
particlesCompleted++;
checkAllComplete();
}
});
}
// Add flower scaling and fade animation
tween(flowerGraphics, {
scaleX: 1.5,
scaleY: 1.5,
alpha: 0,
rotation: Math.random() * Math.PI * 0.5
}, {
duration: 400,
easing: tween.easeOut,
onFinish: function onFinish() {
self.visible = false;
flowerAnimationDone = true;
checkAllComplete();
}
});
};
self.animateFall = function (targetY, callback) {
// Calculate fall distance for dynamic duration
var fallDistance = Math.abs(targetY - self.y);
var baseDuration = 200;
var dynamicDuration = Math.min(baseDuration + fallDistance / 400 * 100, 400);
tween(self, {
y: targetY
}, {
duration: dynamicDuration,
easing: tween.easeOut,
onFinish: callback
});
};
return self;
});
var ShimmerFlower = Flower.expand(function (type) {
var self = Flower.call(this, type);
self.isShimmer = true;
// Add shimmer particles around the flower
self.shimmerParticles = [];
for (var i = 0; i < 6; i++) {
var shimmer = self.attachAsset('shimmerEffect', {
anchorX: 0.5,
anchorY: 0.5,
alpha: 0.8
});
self.shimmerParticles.push(shimmer);
}
// Animate shimmer effect continuously
self.animateShimmer = function () {
for (var i = 0; i < self.shimmerParticles.length; i++) {
var particle = self.shimmerParticles[i];
var angle = i / self.shimmerParticles.length * Math.PI * 2;
var radius = 60 + Math.sin(LK.ticks * 0.08 + i) * 10;
particle.x = Math.cos(angle + LK.ticks * 0.06) * radius;
particle.y = Math.sin(angle + LK.ticks * 0.06) * radius;
particle.alpha = 0.6 + Math.sin(LK.ticks * 0.12 + i) * 0.3;
particle.scaleX = 0.8 + Math.sin(LK.ticks * 0.1 + i) * 0.2;
particle.scaleY = 0.8 + Math.sin(LK.ticks * 0.1 + i) * 0.2;
}
};
self.update = function () {
self.animateShimmer();
};
self.activateShimmerEffect = function () {
// Activate shimmer power-up - explode self and 4 adjacent flowers
var flowersToExplode = [];
// Add self to explosion list
flowersToExplode.push({
x: self.gridX,
y: self.gridY
});
// Add adjacent flowers (up, down, left, right)
var adjacentPositions = [{
x: self.gridX,
y: self.gridY - 1
},
// up
{
x: self.gridX,
y: self.gridY + 1
},
// down
{
x: self.gridX - 1,
y: self.gridY
},
// left
{
x: self.gridX + 1,
y: self.gridY
} // right
];
for (var i = 0; i < adjacentPositions.length; i++) {
var pos = adjacentPositions[i];
if (pos.x >= 0 && pos.x < grid.gridSize && pos.y >= 0 && pos.y < grid.gridSize && grid.flowers[pos.y] && grid.flowers[pos.y][pos.x] && grid.flowers[pos.y][pos.x] !== self) {
flowersToExplode.push(pos);
}
}
// Explode all flowers in the list
for (var i = 0; i < flowersToExplode.length; i++) {
var pos = flowersToExplode[i];
var flower = grid.flowers[pos.y][pos.x];
if (flower) {
flower.animateMatch();
grid.flowers[pos.y][pos.x] = null;
}
}
self.explode();
var newScore = LK.getScore() + flowersToExplode.length * 20;
LK.setScore(newScore);
scoreTxt.setText('Score: ' + newScore);
// Check and update high score
if (newScore > highScore) {
highScore = newScore;
storage.highScore = highScore;
highScoreTxt.setText('High Score: ' + highScore);
}
LK.setTimeout(function () {
grid.dropFlowers(function () {
game.checkForMatches();
});
}, 600);
};
self.explode = function () {
// Create massive explosion effect
for (var i = 0; i < 24; i++) {
var particle = self.attachAsset('particle', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 2.0 + Math.random() * 1.5,
scaleY: 2.0 + Math.random() * 1.5,
alpha: 1.0
});
var angle = i / 24 * Math.PI * 2 + Math.random() * 0.8;
var distance = 200 + Math.random() * 150;
var targetX = Math.cos(angle) * distance;
var targetY = Math.sin(angle) * distance;
tween(particle, {
x: targetX,
y: targetY,
scaleX: 0.1,
scaleY: 0.1,
alpha: 0,
rotation: Math.random() * Math.PI * 8
}, {
duration: 800 + Math.random() * 400,
easing: tween.easeOut,
onFinish: function onFinish() {
particle.destroy();
}
});
}
};
return self;
});
var RainbowFlower = Flower.expand(function (type) {
var self = Flower.call(this, type);
self.isRainbow = true;
// Add rainbow particles around the flower
self.rainbowParticles = [];
for (var i = 0; i < 6; i++) {
var rainbow = self.attachAsset('rainbowEffect', {
anchorX: 0.5,
anchorY: 0.5,
alpha: 0.7
});
self.rainbowParticles.push(rainbow);
}
// Animate rainbow effect continuously
self.animateRainbow = function () {
for (var i = 0; i < self.rainbowParticles.length; i++) {
var particle = self.rainbowParticles[i];
var angle = i / self.rainbowParticles.length * Math.PI * 2;
var radius = 75 + Math.sin(LK.ticks * 0.06 + i * 0.5) * 15;
particle.x = Math.cos(angle + LK.ticks * 0.05) * radius;
particle.y = Math.sin(angle + LK.ticks * 0.05) * radius;
particle.scaleX = 0.9 + Math.sin(LK.ticks * 0.08 + i * 0.7) * 0.2;
particle.scaleY = 0.9 + Math.sin(LK.ticks * 0.08 + i * 0.7) * 0.2;
particle.alpha = 0.7 + Math.sin(LK.ticks * 0.1 + i) * 0.2;
}
};
self.update = function () {
self.animateRainbow();
};
self.activateRainbowEffect = function (targetType) {
// Activate rainbow power-up on target flower type
var clearedCount = self.explodeAndClear(targetType);
self.visible = false;
grid.flowers[self.gridY][self.gridX] = null;
var newScore = LK.getScore() + clearedCount * 20;
LK.setScore(newScore);
scoreTxt.setText('Score: ' + newScore);
// Check and update high score
if (newScore > highScore) {
highScore = newScore;
storage.highScore = highScore;
highScoreTxt.setText('High Score: ' + highScore);
}
LK.setTimeout(function () {
grid.dropFlowers(function () {
game.checkForMatches();
});
}, 600);
};
self.explodeAndClear = function (targetType) {
// Find all flowers of target type and clear them
var clearedFlowers = [];
for (var y = 0; y < grid.gridSize; y++) {
for (var x = 0; x < grid.gridSize; x++) {
var flower = grid.flowers[y][x];
if (flower && flower.flowerType === targetType && !flower.isShimmer && !flower.isRainbow && flower !== self) {
clearedFlowers.push({
x: x,
y: y
});
}
}
}
// Animate explosion for each cleared flower simultaneously
for (var i = 0; i < clearedFlowers.length; i++) {
var pos = clearedFlowers[i];
// Validate array bounds and flower existence
if (pos.y >= 0 && pos.y < grid.gridSize && pos.x >= 0 && pos.x < grid.gridSize && grid.flowers[pos.y] && grid.flowers[pos.y][pos.x]) {
var flower = grid.flowers[pos.y][pos.x];
flower.animateMatch();
grid.flowers[pos.y][pos.x] = null;
}
}
return clearedFlowers.length;
};
return self;
});
var Grid = Container.expand(function () {
var self = Container.call(this);
self.gridSize = 8;
self.cellSize = 200;
self.flowers = [];
self.flowerTypes = ['rose', 'tulip', 'daisy', 'sunflower', 'lily'];
// Initialize 2D array
for (var i = 0; i < self.gridSize; i++) {
self.flowers[i] = [];
for (var j = 0; j < self.gridSize; j++) {
self.flowers[i][j] = null;
}
}
self.createFlower = function (gridX, gridY, flowerType, special) {
var type = flowerType || self.flowerTypes[Math.floor(Math.random() * self.flowerTypes.length)];
var flower;
if (special === 'shimmer') {
flower = new ShimmerFlower(type);
} else if (special === 'rainbow') {
flower = new RainbowFlower(type);
} else {
flower = new Flower(type);
}
flower.gridX = gridX;
flower.gridY = gridY;
flower.x = gridX * self.cellSize + self.cellSize / 2;
flower.y = gridY * self.cellSize + self.cellSize / 2;
self.flowers[gridY][gridX] = flower;
self.addChild(flower);
return flower;
};
self.initializeGrid = function () {
for (var y = 0; y < self.gridSize; y++) {
for (var x = 0; x < self.gridSize; x++) {
self.createFlower(x, y);
}
}
};
self.swapFlowers = function (flower1, flower2, callback) {
var tempX = flower1.gridX;
var tempY = flower1.gridY;
// Update grid positions
flower1.gridX = flower2.gridX;
flower1.gridY = flower2.gridY;
flower2.gridX = tempX;
flower2.gridY = tempY;
// Update array
self.flowers[flower1.gridY][flower1.gridX] = flower1;
self.flowers[flower2.gridY][flower2.gridX] = flower2;
// Animate swap with smooth, consistent movement
var targetX1 = flower1.gridX * self.cellSize + self.cellSize / 2;
var targetY1 = flower1.gridY * self.cellSize + self.cellSize / 2;
var targetX2 = flower2.gridX * self.cellSize + self.cellSize / 2;
var targetY2 = flower2.gridY * self.cellSize + self.cellSize / 2;
var completed = 0;
function onComplete() {
completed++;
if (completed === 2 && callback) {
callback();
}
}
// Stop any existing tweens on flowers to prevent conflicts
tween.stop(flower1);
tween.stop(flower2);
// Reset flowers to base scale before swap
flower1.scaleX = 1.0;
flower1.scaleY = 1.0;
flower2.scaleX = 1.0;
flower2.scaleY = 1.0;
// Add subtle scale animation during swap for visual feedback
tween(flower1, {
scaleX: 0.9,
scaleY: 0.9
}, {
duration: 100,
easing: tween.easeInOut
});
tween(flower2, {
scaleX: 0.9,
scaleY: 0.9
}, {
duration: 100,
easing: tween.easeInOut
});
// Main swap animation with smooth easing
tween(flower1, {
x: targetX1,
y: targetY1
}, {
duration: 250,
easing: tween.easeInOut,
onFinish: function onFinish() {
// Restore scale after swap
tween(flower1, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 150,
easing: tween.easeOut
});
onComplete();
}
});
tween(flower2, {
x: targetX2,
y: targetY2
}, {
duration: 250,
easing: tween.easeInOut,
onFinish: function onFinish() {
// Restore scale after swap
tween(flower2, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 150,
easing: tween.easeOut
});
onComplete();
}
});
};
self.findMatches = function () {
var matches = [];
var matchGroups = [];
// Check horizontal matches
for (var y = 0; y < self.gridSize; y++) {
var count = 1;
var currentType = self.flowers[y] && self.flowers[y][0] ? self.flowers[y][0].flowerType : null;
for (var x = 1; x < self.gridSize; x++) {
var flower = self.flowers[y] && self.flowers[y][x] ? self.flowers[y][x] : null;
if (flower && flower.flowerType === currentType) {
count++;
} else {
if (count >= 3 && currentType) {
var group = {
type: currentType,
count: count,
positions: []
};
for (var i = x - count; i < x; i++) {
var pos = {
x: i,
y: y
};
matches.push(pos);
group.positions.push(pos);
}
matchGroups.push(group);
}
count = 1;
currentType = flower ? flower.flowerType : null;
}
}
if (count >= 3 && currentType) {
var group = {
type: currentType,
count: count,
positions: []
};
for (var i = self.gridSize - count; i < self.gridSize; i++) {
var pos = {
x: i,
y: y
};
matches.push(pos);
group.positions.push(pos);
}
matchGroups.push(group);
}
}
// Check vertical matches
for (var x = 0; x < self.gridSize; x++) {
var count = 1;
var currentType = self.flowers[0] && self.flowers[0][x] ? self.flowers[0][x].flowerType : null;
for (var y = 1; y < self.gridSize; y++) {
var flower = self.flowers[y] && self.flowers[y][x] ? self.flowers[y][x] : null;
if (flower && flower.flowerType === currentType) {
count++;
} else {
if (count >= 3 && currentType) {
var group = {
type: currentType,
count: count,
positions: []
};
for (var i = y - count; i < y; i++) {
var pos = {
x: x,
y: i
};
matches.push(pos);
group.positions.push(pos);
}
matchGroups.push(group);
}
count = 1;
currentType = flower ? flower.flowerType : null;
}
}
if (count >= 3 && currentType) {
var group = {
type: currentType,
count: count,
positions: []
};
for (var i = self.gridSize - count; i < self.gridSize; i++) {
var pos = {
x: x,
y: i
};
matches.push(pos);
group.positions.push(pos);
}
matchGroups.push(group);
}
}
return {
matches: matches,
groups: matchGroups
};
};
self.removeMatches = function (matchResult, callback) {
if (matchResult.matches.length === 0) {
if (callback) callback();
return;
}
var matches = matchResult.matches;
var groups = matchResult.groups;
var completed = 0;
var total = matches.length;
var powerUpsCreated = [];
// Check for power-up creation opportunities
for (var g = 0; g < groups.length; g++) {
var group = groups[g];
if (group.count >= 5) {
// Create rainbow flower at center position
var centerPos = group.positions[Math.floor(group.positions.length / 2)];
powerUpsCreated.push({
pos: centerPos,
type: group.type,
special: 'rainbow'
});
} else if (group.count >= 4) {
// Create shimmer flower at center position
var centerPos = group.positions[Math.floor(group.positions.length / 2)];
powerUpsCreated.push({
pos: centerPos,
type: group.type,
special: 'shimmer'
});
}
}
var completionLock = false;
var actualAnimations = 0;
function onAnimationComplete() {
completed++;
if (completed === actualAnimations && !completionLock) {
completionLock = true;
// Create power-up flowers after matches are cleared
for (var p = 0; p < powerUpsCreated.length; p++) {
var powerUp = powerUpsCreated[p];
// Validate position is within bounds and empty
if (powerUp.pos.y >= 0 && powerUp.pos.y < self.gridSize && powerUp.pos.x >= 0 && powerUp.pos.x < self.gridSize && !self.flowers[powerUp.pos.y][powerUp.pos.x]) {
var newPowerUpFlower = self.createFlower(powerUp.pos.x, powerUp.pos.y, powerUp.type, powerUp.special);
// Add visual feedback for power-up creation
newPowerUpFlower.scaleX = 0.3;
newPowerUpFlower.scaleY = 0.3;
newPowerUpFlower.alpha = 0.8;
tween(newPowerUpFlower, {
scaleX: 1.3,
scaleY: 1.3,
alpha: 1.0
}, {
duration: 300,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(newPowerUpFlower, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 150,
easing: tween.easeOut
});
}
});
}
}
if (callback) callback();
}
}
// Count actual flowers that will animate
for (var i = 0; i < matches.length; i++) {
var match = matches[i];
var flower = self.flowers[match.y][match.x];
if (flower) {
actualAnimations++;
}
}
// If no flowers to animate but we have power-ups to create, handle immediately
if (actualAnimations === 0 && powerUpsCreated.length > 0) {
for (var p = 0; p < powerUpsCreated.length; p++) {
var powerUp = powerUpsCreated[p];
if (powerUp.pos.y >= 0 && powerUp.pos.y < self.gridSize && powerUp.pos.x >= 0 && powerUp.pos.x < self.gridSize && !self.flowers[powerUp.pos.y][powerUp.pos.x]) {
var newPowerUpFlower = self.createFlower(powerUp.pos.x, powerUp.pos.y, powerUp.type, powerUp.special);
newPowerUpFlower.scaleX = 0.1;
newPowerUpFlower.scaleY = 0.1;
tween(newPowerUpFlower, {
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 400,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(newPowerUpFlower, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 200,
easing: tween.easeOut
});
}
});
}
}
if (callback) callback();
return;
}
for (var i = 0; i < matches.length; i++) {
var match = matches[i];
var flower = self.flowers[match.y][match.x];
if (flower) {
self.flowers[match.y][match.x] = null;
// Start animation with proper callback timing
flower.animateMatch(onAnimationComplete);
}
}
};
self.dropFlowers = function (callback) {
var animations = 0;
for (var x = 0; x < self.gridSize; x++) {
var writeIndex = self.gridSize - 1;
// Move existing flowers down
for (var y = self.gridSize - 1; y >= 0; y--) {
if (self.flowers[y] && self.flowers[y][x] && writeIndex >= 0) {
if (y !== writeIndex) {
if (!self.flowers[writeIndex]) self.flowers[writeIndex] = [];
self.flowers[writeIndex][x] = self.flowers[y][x];
self.flowers[y][x] = null;
var flower = self.flowers[writeIndex][x];
flower.gridY = writeIndex;
var targetY = writeIndex * self.cellSize + self.cellSize / 2;
animations++;
(function (f, ty) {
f.animateFall(ty, function () {
animations--;
if (animations === 0 && callback) {
callback();
}
});
})(flower, targetY);
}
writeIndex--;
}
}
// Create new flowers to fill empty spaces
for (var y = 0; y <= writeIndex; y++) {
var newFlower = self.createFlower(x, y);
newFlower.y = -self.cellSize;
var targetY = y * self.cellSize + self.cellSize / 2;
animations++;
(function (f, ty) {
f.animateFall(ty, function () {
animations--;
if (animations === 0 && callback) {
callback();
}
});
})(newFlower, targetY);
}
}
if (animations === 0 && callback) {
callback();
}
};
self.isAdjacent = function (flower1, flower2) {
var dx = Math.abs(flower1.gridX - flower2.gridX);
var dy = Math.abs(flower1.gridY - flower2.gridY);
return dx === 1 && dy === 0 || dx === 0 && dy === 1;
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x98fb98
});
/****
* Game Code
****/
// Create beautiful flower garden background
var gardenBg = game.attachAsset('gardenBackground', {
anchorX: 0,
anchorY: 0,
x: 0,
y: 0
});
var grid = new Grid();
var selectedFlower = null;
var isSwapping = false;
var isMatching = false;
// Position grid in center of screen
grid.x = (2048 - grid.gridSize * grid.cellSize) / 2;
grid.y = (2732 - grid.gridSize * grid.cellSize) / 2 + 200;
game.addChild(grid);
// Score display
var scoreTxt = new Text2('Score: 0', {
size: 120,
fill: 0x2D5016
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// High score display
var highScoreTxt = new Text2('High Score: 0', {
size: 80,
fill: 0x1a3d0b
});
highScoreTxt.anchor.set(0.5, 0);
highScoreTxt.y = 140;
LK.gui.top.addChild(highScoreTxt);
// Initialize high score from storage
var highScore = storage.highScore || 0;
highScoreTxt.setText('High Score: ' + highScore);
// Initialize grid
grid.initializeGrid();
game.selectFlower = function (flower) {
// Prevent selection during animations
if (isSwapping || isMatching) {
return;
}
if (selectedFlower === null) {
// First selection with smooth scale animation
selectedFlower = flower;
// Stop any existing tweens to prevent conflicts
tween.stop(flower);
tween(flower, {
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 200,
easing: tween.easeOut
});
// Add subtle bounce effect
tween(flower, {
rotation: 0.08
}, {
duration: 150,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(flower, {
rotation: -0.08
}, {
duration: 150,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(flower, {
rotation: 0
}, {
duration: 150,
easing: tween.easeInOut
});
}
});
}
});
} else if (selectedFlower === flower) {
// Deselect same flower with smooth transition
tween(flower, {
scaleX: 1,
scaleY: 1,
rotation: 0
}, {
duration: 200,
easing: tween.easeOut
});
selectedFlower = null;
} else if (grid.isAdjacent(selectedFlower, flower)) {
// Valid swap
isSwapping = true;
var firstFlower = selectedFlower;
tween(firstFlower, {
scaleX: 1,
scaleY: 1
}, {
duration: 150,
easing: tween.easeOut
});
LK.getSound('swap').play();
// Check for special flower activation during swap
if (firstFlower.isShimmer) {
// Shimmer flower swapped - activate shimmer effect
selectedFlower = null;
firstFlower.activateShimmerEffect();
isSwapping = false;
} else if (flower.isShimmer) {
// Target flower is shimmer - activate shimmer effect
selectedFlower = null;
flower.activateShimmerEffect();
isSwapping = false;
} else if (firstFlower.isRainbow && flower.flowerType && !flower.isRainbow && !flower.isShimmer) {
// Rainbow flower swapped with regular flower - activate rainbow effect
selectedFlower = null;
firstFlower.activateRainbowEffect(flower.flowerType);
isSwapping = false;
} else if (flower.isRainbow && firstFlower.flowerType && !firstFlower.isRainbow && !firstFlower.isShimmer) {
// Target flower is rainbow - activate rainbow effect
selectedFlower = null;
flower.activateRainbowEffect(firstFlower.flowerType);
isSwapping = false;
} else {
// Regular swap
grid.swapFlowers(firstFlower, flower, function () {
selectedFlower = null;
isSwapping = false;
game.checkForMatches();
});
}
} else {
// Invalid swap - select new flower with smooth transition
tween(selectedFlower, {
scaleX: 1,
scaleY: 1,
rotation: 0
}, {
duration: 200,
easing: tween.easeOut
});
selectedFlower = flower;
tween(flower, {
scaleX: 1.15,
scaleY: 1.15
}, {
duration: 200,
easing: tween.easeOut
});
// Add subtle bounce effect for new selection
tween(flower, {
rotation: 0.1
}, {
duration: 100,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(flower, {
rotation: -0.1
}, {
duration: 100,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(flower, {
rotation: 0
}, {
duration: 100,
easing: tween.easeInOut
});
}
});
}
});
}
};
game.checkForMatches = function () {
var matchResult = grid.findMatches();
if (matchResult.matches.length > 0) {
isMatching = true;
LK.getSound('match').play();
// Update score using LK score system only
var newScore = LK.getScore() + matchResult.matches.length * 10;
LK.setScore(newScore);
scoreTxt.setText('Score: ' + newScore);
// Check and update high score - ensure persistence
if (newScore > highScore) {
highScore = newScore;
storage.highScore = highScore;
highScoreTxt.setText('High Score: ' + highScore);
}
grid.removeMatches(matchResult, function () {
grid.dropFlowers(function () {
isMatching = false;
// Check for cascading matches after drop animations complete
// Game continues indefinitely - no game over conditions
LK.setTimeout(function () {
game.checkForMatches();
}, 800);
});
});
}
};
// Initial match check after grid creation
LK.setTimeout(function () {
game.checkForMatches();
}, 800);
game.update = function () {
// Game runs automatically through event-driven mechanics
}; ===================================================================
--- original.js
+++ change.js
@@ -184,9 +184,9 @@
LK.setTimeout(function () {
grid.dropFlowers(function () {
game.checkForMatches();
});
- }, 800);
+ }, 600);
};
self.explode = function () {
// Create massive explosion effect
for (var i = 0; i < 24; i++) {
@@ -265,9 +265,9 @@
LK.setTimeout(function () {
grid.dropFlowers(function () {
game.checkForMatches();
});
- }, 800);
+ }, 600);
};
self.explodeAndClear = function (targetType) {
// Find all flowers of target type and clear them
var clearedFlowers = [];
@@ -877,9 +877,9 @@
// Update score using LK score system only
var newScore = LK.getScore() + matchResult.matches.length * 10;
LK.setScore(newScore);
scoreTxt.setText('Score: ' + newScore);
- // Check and update high score
+ // Check and update high score - ensure persistence
if (newScore > highScore) {
highScore = newScore;
storage.highScore = highScore;
highScoreTxt.setText('High Score: ' + highScore);
@@ -887,9 +887,9 @@
grid.removeMatches(matchResult, function () {
grid.dropFlowers(function () {
isMatching = false;
// Check for cascading matches after drop animations complete
- // Optimized timeout for better responsiveness while ensuring animations complete
+ // Game continues indefinitely - no game over conditions
LK.setTimeout(function () {
game.checkForMatches();
}, 800);
});
Tulip. The flower is facing at the center. Make it vibrant. In-Game asset. 2d. High contrast. No shadows
Rose. Front. Make it vibrant. In-Game asset. 2d. High contrast. No shadows
Daisy. Front. Make it vibrant.. In-Game asset. 2d. High contrast. No shadows
Sunflower. Front. Make it vibrant.. In-Game asset. 2d. High contrast. No shadows
Lily. Front. Make it vibrant.. In-Game asset. 2d. High contrast. No shadows
Grass background.. In-Game asset. 2d. High contrast. No shadows
Flowery particle. Vibrant.. In-Game asset. 2d. High contrast. No shadows
Shimmer effect. Vibrant.. In-Game asset. 2d. High contrast. No shadows
Rainbow effect. Vibrant.. In-Game asset. 2d. High contrast. No shadows
Blossom match with rose,lily,sunflower,tulips,and daisy. Vibrant.. In-Game asset. 2d. High contrast. No shadows