User prompt
Arkaplan müziği ekleyelim
User prompt
Skor yazısındaki harfleri hepsini büyük harf yap
User prompt
Skorun yazı tipi Puerto olsun
User prompt
Daha kalın olsun
User prompt
Daha kalın görünsün
User prompt
Skor yazısının fontunu farklı yap
User prompt
Kaybolan gemler anında yok olmak yerine arkasında efetk bırakır ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Eşleştirme yok ise patlama olmasın ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Oyunun mantığını eşleştirme olarak yap 3 varlık yanyana olduğu zaman 4,5 varlık yanyana olduğu zaman patlasınlar ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Kaybolan gemler anında yok olmak yerine arkasında efetk bırakır ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Haraket imkanı kalmas ise gemlerin yerlerini otomatik değişsin rastgele olsun ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Gemler havada kalmasın ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Gemler çerçevenin önünden düşsün
User prompt
Gemler boardbgnin içinden düşsün
User prompt
Bir çerçeve ekle
User prompt
Yukarindan aşağıya düşen gemler arkaplanın arkasından düşsün
User prompt
Completely delete the jewel bomb asset too
User prompt
Bomba kalmaya devam etmesin ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Bomba patladığı Zaman ortadan yok olsun ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Bomba her hangi gemle yer değiştirse patlar ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Bomba 1 kere haraket ettirmek yeterli patlaması için ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Bomba haraket ettirince 5x5 yer patlatsin ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Bomba yalnızca gemler 5 adet yanyana geldiği zaman ortaya çıksın ama oyuncu onu haraket ettirmesse patlamasin ettirdiği zaman işlev görsün ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Bombalar sadece gemler 5 tane yanyana veya dikey şekilde olursa 3 sırada bomba görünsün ama oyuncu bombayı haraket ettirmeden patlamasin ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Bomba patladığı Zaman dikey ve yata şekilde 5x5 gemleri yok etsin ↪💡 Consider importing and using the following plugins: @upit/tween.v1
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var Gem = Container.expand(function (gemType, gridX, gridY) {
var self = Container.call(this);
self.gemType = gemType;
self.gridX = gridX;
self.gridY = gridY;
self.isAnimating = false;
var gemAssets = ['gemRed', 'gemBlue', 'gemGreen', 'gemYellow', 'gemPurple', 'gemOrange'];
var gemGraphics = self.attachAsset(gemAssets[gemType], {
anchorX: 0.5,
anchorY: 0.5
});
self.setGridPosition = function (x, y) {
self.gridX = x;
self.gridY = y;
};
self.animateToPosition = function (targetX, targetY, duration, onComplete) {
if (!duration) duration = 200;
self.isAnimating = true;
tween(self, {
x: targetX,
y: targetY
}, {
duration: duration,
easing: tween.easeOut,
onFinish: function onFinish() {
self.isAnimating = false;
if (onComplete) onComplete();
}
});
};
self.destroy = function () {
if (self.parent) {
self.parent.removeChild(self);
}
};
return self;
});
var Particle = Container.expand(function (x, y, color) {
var self = Container.call(this);
var particleGraphics = self.attachAsset('particle', {
anchorX: 0.5,
anchorY: 0.5
});
// Set particle color
particleGraphics.tint = color;
// Set initial position
self.x = x;
self.y = y;
// Random velocity - increased for more dramatic effect
self.velocityX = (Math.random() - 0.5) * 500;
self.velocityY = (Math.random() - 0.5) * 500;
self.gravity = 800;
self.life = 1.5;
self.fadeSpeed = 1.0;
self.scale = 1.0;
self.scaleSpeed = 0.5;
// Add initial scale animation
tween(self, {
scaleX: 1.5,
scaleY: 1.5
}, {
duration: 200,
easing: tween.easeOut
});
self.update = function () {
// Update position based on velocity
self.x += self.velocityX * (1 / 60);
self.y += self.velocityY * (1 / 60);
// Apply gravity
self.velocityY += self.gravity * (1 / 60);
// Fade out over time
self.life -= self.fadeSpeed * (1 / 60);
self.alpha = Math.max(0, self.life);
// Scale down over time for dramatic effect
self.scale -= self.scaleSpeed * (1 / 60);
if (self.scale > 0) {
self.scaleX = self.scale;
self.scaleY = self.scale;
}
// Remove when fully faded
if (self.life <= 0) {
self.destroy();
}
};
self.destroy = function () {
if (self.parent) {
self.parent.removeChild(self);
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x2C1810
});
/****
* Game Code
****/
var GRID_SIZE = 8;
var CELL_SIZE = 240;
var BOARD_OFFSET_X = (2048 - GRID_SIZE * CELL_SIZE) / 2;
var BOARD_OFFSET_Y = 400;
var gameBoard = [];
var selectedGem = null;
var draggedGem = null;
var dragStartPos = null;
var isDragging = false;
var isSwapping = false;
var score = 0;
var comboMultiplier = 1;
// Create explosion effect at gem position
function createExplosion(x, y, gemColor) {
var particleCount = 15;
var gemColors = [0xff2222, 0x2222ff, 0x22ff22, 0xffff22, 0xff22ff, 0xff6622];
var color = gemColors[gemColor] || 0xffffff;
for (var i = 0; i < particleCount; i++) {
var particle = new Particle(x, y, color);
game.addChild(particle);
}
}
// Create enhanced explosion for 4-gem matches
function createSuperExplosion(x, y, gemColor) {
var particleCount = 25;
var gemColors = [0xff2222, 0x2222ff, 0x22ff22, 0xffff22, 0xff22ff, 0xff6622];
var color = gemColors[gemColor] || 0xffffff;
for (var i = 0; i < particleCount; i++) {
var particle = new Particle(x, y, color);
// Enhanced particle properties for super matches
particle.velocityX *= 1.5;
particle.velocityY *= 1.5;
particle.life *= 1.3;
particle.scale *= 1.2;
game.addChild(particle);
}
// Add additional golden particles for super effect
for (var i = 0; i < 10; i++) {
var goldParticle = new Particle(x, y, 0xFFD700);
goldParticle.velocityX *= 0.8;
goldParticle.velocityY *= 0.8;
game.addChild(goldParticle);
}
}
// Create mega explosion for 5+ gem matches
function createMegaExplosion(x, y, gemColor) {
var particleCount = 40;
var gemColors = [0xff2222, 0x2222ff, 0x22ff22, 0xffff22, 0xff22ff, 0xff6622];
var color = gemColors[gemColor] || 0xffffff;
for (var i = 0; i < particleCount; i++) {
var particle = new Particle(x, y, color);
// Mega enhanced particle properties
particle.velocityX *= 2.0;
particle.velocityY *= 2.0;
particle.life *= 1.8;
particle.scale *= 1.5;
game.addChild(particle);
}
// Add rainbow particles for mega effect
var rainbowColors = [0xFF0000, 0xFF8000, 0xFFFF00, 0x00FF00, 0x0080FF, 0x8000FF];
for (var i = 0; i < 20; i++) {
var rainbowParticle = new Particle(x, y, rainbowColors[i % rainbowColors.length]);
rainbowParticle.velocityX *= 1.2;
rainbowParticle.velocityY *= 1.2;
rainbowParticle.life *= 1.5;
game.addChild(rainbowParticle);
}
}
// Create board frame
var boardFrame = game.attachAsset('boardFrame', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
y: BOARD_OFFSET_Y + GRID_SIZE * CELL_SIZE / 2
});
// Create board background
var boardBg = game.attachAsset('boardBg', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
y: BOARD_OFFSET_Y + GRID_SIZE * CELL_SIZE / 2
});
// Create score display
var scoreTxt = new Text2('Score: 0', {
size: 60,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
scoreTxt.y = 100;
// Initialize empty board
function initializeBoard() {
gameBoard = [];
for (var x = 0; x < GRID_SIZE; x++) {
gameBoard[x] = [];
for (var y = 0; y < GRID_SIZE; y++) {
gameBoard[x][y] = null;
}
}
}
// Fill board with random gems
function fillBoard() {
for (var x = 0; x < GRID_SIZE; x++) {
for (var y = 0; y < GRID_SIZE; y++) {
if (!gameBoard[x][y]) {
var gemType = Math.floor(Math.random() * 6);
var gem = new Gem(gemType, x, y);
var worldPos = gridToWorld(x, y);
gem.x = worldPos.x;
gem.y = worldPos.y;
gameBoard[x][y] = gem;
game.addChild(gem);
}
}
}
}
// Convert grid coordinates to world coordinates
function gridToWorld(gridX, gridY) {
return {
x: BOARD_OFFSET_X + gridX * CELL_SIZE + CELL_SIZE / 2,
y: BOARD_OFFSET_Y + gridY * CELL_SIZE + CELL_SIZE / 2
};
}
// Convert world coordinates to grid coordinates
function worldToGrid(worldX, worldY) {
var gridX = Math.floor((worldX - BOARD_OFFSET_X) / CELL_SIZE);
var gridY = Math.floor((worldY - BOARD_OFFSET_Y) / CELL_SIZE);
if (gridX < 0 || gridX >= GRID_SIZE || gridY < 0 || gridY >= GRID_SIZE) {
return null;
}
return {
x: gridX,
y: gridY
};
}
// Check if two grid positions are adjacent
function areAdjacent(pos1, pos2) {
var dx = Math.abs(pos1.x - pos2.x);
var dy = Math.abs(pos1.y - pos2.y);
return dx === 1 && dy === 0 || dx === 0 && dy === 1;
}
// Check if any valid moves are possible on the board
function hasValidMoves() {
for (var x = 0; x < GRID_SIZE; x++) {
for (var y = 0; y < GRID_SIZE; y++) {
if (!gameBoard[x][y]) continue;
// Check adjacent positions for potential swaps
var adjacentPositions = [{
x: x + 1,
y: y
},
// Right
{
x: x - 1,
y: y
},
// Left
{
x: x,
y: y + 1
},
// Down
{
x: x,
y: y - 1
} // Up
];
for (var i = 0; i < adjacentPositions.length; i++) {
var adj = adjacentPositions[i];
if (adj.x >= 0 && adj.x < GRID_SIZE && adj.y >= 0 && adj.y < GRID_SIZE && gameBoard[adj.x][adj.y]) {
// Simulate swap and check for matches
var gem1 = gameBoard[x][y];
var gem2 = gameBoard[adj.x][adj.y];
// Temporarily swap gem types
var tempType = gem1.gemType;
gem1.gemType = gem2.gemType;
gem2.gemType = tempType;
// Check for matches at both positions
var matches1 = checkMatches(x, y);
var matches2 = checkMatches(adj.x, adj.y);
// Restore original gem types
gem1.gemType = gem2.gemType;
gem2.gemType = tempType;
// If either position creates matches, we have a valid move
if (matches1.length > 0 || matches2.length > 0) {
return true;
}
}
}
}
}
return false;
}
// Shuffle board gems randomly using tween animations
function shuffleBoard() {
if (isSwapping) return;
isSwapping = true;
// Collect all gem types currently on board
var gemTypes = [];
for (var x = 0; x < GRID_SIZE; x++) {
for (var y = 0; y < GRID_SIZE; y++) {
if (gameBoard[x][y]) {
gemTypes.push(gameBoard[x][y].gemType);
}
}
}
// Shuffle the gem types array
for (var i = gemTypes.length - 1; i > 0; i--) {
var j = Math.floor(Math.random() * (i + 1));
var temp = gemTypes[i];
gemTypes[i] = gemTypes[j];
gemTypes[j] = temp;
}
// Apply shuffled types to gems with animation
var typeIndex = 0;
var animationsCompleted = 0;
var totalAnimations = 0;
for (var x = 0; x < GRID_SIZE; x++) {
for (var y = 0; y < GRID_SIZE; y++) {
if (gameBoard[x][y]) {
totalAnimations++;
}
}
}
for (var x = 0; x < GRID_SIZE; x++) {
for (var y = 0; y < GRID_SIZE; y++) {
if (gameBoard[x][y] && typeIndex < gemTypes.length) {
var gem = gameBoard[x][y];
var newType = gemTypes[typeIndex++];
// Only animate if type is different
if (gem.gemType !== newType) {
// Scale down, change type, scale back up
tween(gem, {
scaleX: 0,
scaleY: 0
}, {
duration: 200,
easing: tween.easeIn,
onFinish: function (currentGem, currentNewType) {
return function () {
currentGem.gemType = currentNewType;
// Update the gem's visual asset
currentGem.removeChild(currentGem.children[0]);
var gemAssets = ['gemRed', 'gemBlue', 'gemGreen', 'gemYellow', 'gemPurple', 'gemOrange'];
var newGraphics = currentGem.attachAsset(gemAssets[currentNewType], {
anchorX: 0.5,
anchorY: 0.5
});
tween(currentGem, {
scaleX: 1,
scaleY: 1
}, {
duration: 200,
easing: tween.easeOut,
onFinish: function onFinish() {
animationsCompleted++;
if (animationsCompleted >= totalAnimations) {
isSwapping = false;
// Check for matches after shuffle
LK.setTimeout(function () {
var matches = findAllMatches();
if (matches.length > 0) {
clearMatches(matches);
}
}, 300);
}
}
});
};
}(gem, newType)
});
} else {
animationsCompleted++;
if (animationsCompleted >= totalAnimations) {
isSwapping = false;
}
}
}
}
}
}
// Check for matches starting at position
function checkMatches(startX, startY) {
var gem = gameBoard[startX][startY];
if (!gem) return [];
var matches = [];
var gemType = gem.gemType;
// Check horizontal matches
var horizontalMatches = [gem];
// Check left
for (var x = startX - 1; x >= 0; x--) {
if (gameBoard[x][startY] && gameBoard[x][startY].gemType === gemType) {
horizontalMatches.unshift(gameBoard[x][startY]);
} else {
break;
}
}
// Check right
for (var x = startX + 1; x < GRID_SIZE; x++) {
if (gameBoard[x][startY] && gameBoard[x][startY].gemType === gemType) {
horizontalMatches.push(gameBoard[x][startY]);
} else {
break;
}
}
if (horizontalMatches.length >= 3) {
// Mark match type based on length for special effects
for (var i = 0; i < horizontalMatches.length; i++) {
horizontalMatches[i].matchType = horizontalMatches.length >= 5 ? 'mega' : horizontalMatches.length >= 4 ? 'super' : 'normal';
}
matches = matches.concat(horizontalMatches);
}
// Check vertical matches
var verticalMatches = [gem];
// Check up
for (var y = startY - 1; y >= 0; y--) {
if (gameBoard[startX][y] && gameBoard[startX][y].gemType === gemType) {
verticalMatches.unshift(gameBoard[startX][y]);
} else {
break;
}
}
// Check down
for (var y = startY + 1; y < GRID_SIZE; y++) {
if (gameBoard[startX][y] && gameBoard[startX][y].gemType === gemType) {
verticalMatches.push(gameBoard[startX][y]);
} else {
break;
}
}
if (verticalMatches.length >= 3) {
// Mark match type based on length for special effects
for (var i = 0; i < verticalMatches.length; i++) {
verticalMatches[i].matchType = verticalMatches.length >= 5 ? 'mega' : verticalMatches.length >= 4 ? 'super' : 'normal';
}
matches = matches.concat(verticalMatches);
}
// Remove duplicates
var uniqueMatches = [];
for (var i = 0; i < matches.length; i++) {
var found = false;
for (var j = 0; j < uniqueMatches.length; j++) {
if (matches[i] === uniqueMatches[j]) {
found = true;
break;
}
}
if (!found) {
uniqueMatches.push(matches[i]);
}
}
return uniqueMatches;
}
// Find all matches on the board
function findAllMatches() {
var allMatches = [];
var processedGems = [];
for (var x = 0; x < GRID_SIZE; x++) {
for (var y = 0; y < GRID_SIZE; y++) {
if (gameBoard[x][y]) {
var matches = checkMatches(x, y);
for (var i = 0; i < matches.length; i++) {
var gem = matches[i];
var found = false;
for (var j = 0; j < processedGems.length; j++) {
if (processedGems[j] === gem) {
found = true;
break;
}
}
if (!found) {
allMatches.push(gem);
processedGems.push(gem);
}
}
}
}
}
return allMatches;
}
// Clear matched gems
function clearMatches(matches) {
if (matches.length === 0) return;
// Only play sound and effects if there are actual matches
LK.getSound('match').play();
// Calculate points based on match types and sizes
var normalMatches = 0;
var superMatches = 0;
var megaMatches = 0;
for (var i = 0; i < matches.length; i++) {
var gem = matches[i];
if (gem.matchType === 'mega') {
megaMatches++;
} else if (gem.matchType === 'super') {
superMatches++;
} else {
normalMatches++;
}
}
// Enhanced scoring system
var points = (normalMatches * 10 + superMatches * 25 + megaMatches * 50) * comboMultiplier;
score += points;
scoreTxt.setText('Score: ' + score);
var gemsToDestroy = matches.length;
var gemsDestroyed = 0;
for (var i = 0; i < matches.length; i++) {
var gem = matches[i];
// Create enhanced explosion effects based on match type
if (gem.matchType === 'mega') {
// Mega match - bigger explosion with more particles
createMegaExplosion(gem.x, gem.y, gem.gemType);
} else if (gem.matchType === 'super') {
// Super match - enhanced explosion
createSuperExplosion(gem.x, gem.y, gem.gemType);
} else {
// Normal match - regular explosion
createExplosion(gem.x, gem.y, gem.gemType);
}
gameBoard[gem.gridX][gem.gridY] = null;
// Enhanced tween effects based on match type
var animationDuration = gem.matchType === 'mega' ? 500 : gem.matchType === 'super' ? 400 : 300;
var finalScale = gem.matchType === 'mega' ? 0.1 : gem.matchType === 'super' ? 0.2 : 0.3;
// Add screen flash for special matches
if (gem.matchType === 'mega') {
LK.effects.flashScreen(0xFFD700, 300); // Gold flash for mega matches
} else if (gem.matchType === 'super') {
LK.effects.flashScreen(0xFF6B35, 200); // Orange flash for super matches
}
// Add tween fade-out effect before destroying
tween(gem, {
alpha: 0,
scaleX: finalScale,
scaleY: finalScale,
rotation: gem.matchType === 'mega' ? Math.PI * 2 : gem.matchType === 'super' ? Math.PI : 0
}, {
duration: animationDuration,
easing: tween.easeIn,
onFinish: function (gemToDestroy) {
return function () {
gemToDestroy.destroy();
gemsDestroyed++;
};
}(gem)
});
}
// After clearing gems, apply gravity and fill empty spaces
LK.setTimeout(function () {
// Apply gravity repeatedly until no more gems fall
function applyGravityRepeatedly() {
var moved = applyGravity();
if (moved) {
LK.setTimeout(applyGravityRepeatedly, 100);
} else {
fillEmptySpaces();
// Check for new matches after falling gems settle
LK.setTimeout(function () {
var newMatches = findAllMatches();
if (newMatches.length > 0) {
comboMultiplier++;
clearMatches(newMatches);
} else {
comboMultiplier = 1;
// Check if any valid moves are possible
if (!hasValidMoves()) {
// No valid moves - shuffle the board
LK.setTimeout(function () {
shuffleBoard();
}, 500);
} else {
isSwapping = false;
}
}
}, 500);
}
}
applyGravityRepeatedly();
}, 200);
}
// Apply gravity to make gems fall
function applyGravity() {
var moved = false;
for (var x = 0; x < GRID_SIZE; x++) {
// Process each column from bottom to top
var writeIndex = GRID_SIZE - 1;
for (var y = GRID_SIZE - 1; y >= 0; y--) {
if (gameBoard[x][y]) {
// If gem is not at the write position, move it down
if (y !== writeIndex) {
var gem = gameBoard[x][y];
gameBoard[x][writeIndex] = gem;
gameBoard[x][y] = null;
gem.setGridPosition(x, writeIndex);
var worldPos = gridToWorld(x, writeIndex);
gem.animateToPosition(worldPos.x, worldPos.y, 300);
moved = true;
}
writeIndex--;
}
}
}
return moved;
}
// Fill empty spaces with new gems
function fillEmptySpaces() {
for (var x = 0; x < GRID_SIZE; x++) {
for (var y = 0; y < GRID_SIZE; y++) {
if (!gameBoard[x][y]) {
var gemType = Math.floor(Math.random() * 6);
var gem = new Gem(gemType, x, y);
var worldPos = gridToWorld(x, y);
gem.x = worldPos.x;
gem.y = worldPos.y - GRID_SIZE * CELL_SIZE;
gameBoard[x][y] = gem;
game.addChild(gem);
gem.animateToPosition(worldPos.x, worldPos.y, 400);
}
}
}
}
// Swap two gems
function swapGems(gem1, gem2) {
if (isSwapping) return;
isSwapping = true;
// Store original positions
var originalGem1X = gem1.gridX;
var originalGem1Y = gem1.gridY;
var originalGem2X = gem2.gridX;
var originalGem2Y = gem2.gridY;
// Update grid positions
gem1.setGridPosition(gem2.gridX, gem2.gridY);
gem2.setGridPosition(originalGem1X, originalGem1Y);
gameBoard[gem1.gridX][gem1.gridY] = gem1;
gameBoard[gem2.gridX][gem2.gridY] = gem2;
var pos1 = gridToWorld(gem1.gridX, gem1.gridY);
var pos2 = gridToWorld(gem2.gridX, gem2.gridY);
// Animate the swap
gem1.animateToPosition(pos1.x, pos1.y, 200);
gem2.animateToPosition(pos2.x, pos2.y, 200);
LK.setTimeout(function () {
var matches = findAllMatches();
if (matches.length > 0) {
// Valid swap - play sound and process matches
LK.getSound('swap').play();
clearMatches(matches);
} else {
// Invalid move - animate back to original positions
gem1.setGridPosition(originalGem1X, originalGem1Y);
gem2.setGridPosition(originalGem2X, originalGem2Y);
gameBoard[gem1.gridX][gem1.gridY] = gem1;
gameBoard[gem2.gridX][gem2.gridY] = gem2;
var pos1 = gridToWorld(gem1.gridX, gem1.gridY);
var pos2 = gridToWorld(gem2.gridX, gem2.gridY);
gem1.animateToPosition(pos1.x, pos1.y, 200);
gem2.animateToPosition(pos2.x, pos2.y, 200);
LK.setTimeout(function () {
isSwapping = false;
}, 200);
}
}, 200);
}
// Game input handling
game.down = function (x, y, obj) {
if (isSwapping) return;
var gridPos = worldToGrid(x, y);
if (!gridPos) return;
var clickedGem = gameBoard[gridPos.x][gridPos.y];
if (!clickedGem) return;
draggedGem = clickedGem;
dragStartPos = {
x: x,
y: y
};
isDragging = true;
draggedGem.alpha = 0.7;
};
game.move = function (x, y, obj) {
if (!isDragging || !draggedGem || isSwapping) return;
// Calculate drag distance
var dragDeltaX = x - dragStartPos.x;
var dragDeltaY = y - dragStartPos.y;
var dragDistance = Math.sqrt(dragDeltaX * dragDeltaX + dragDeltaY * dragDeltaY);
// Only process if drag distance is significant enough
if (dragDistance > CELL_SIZE * 0.3) {
// Determine drag direction
var targetGridX = draggedGem.gridX;
var targetGridY = draggedGem.gridY;
if (Math.abs(dragDeltaX) > Math.abs(dragDeltaY)) {
// Horizontal drag
if (dragDeltaX > 0) {
targetGridX = Math.min(GRID_SIZE - 1, draggedGem.gridX + 1);
} else {
targetGridX = Math.max(0, draggedGem.gridX - 1);
}
} else {
// Vertical drag
if (dragDeltaY > 0) {
targetGridY = Math.min(GRID_SIZE - 1, draggedGem.gridY + 1);
} else {
targetGridY = Math.max(0, draggedGem.gridY - 1);
}
}
// Update visual position to show intended swap
var targetWorldPos = gridToWorld(targetGridX, targetGridY);
draggedGem.x = targetWorldPos.x;
draggedGem.y = targetWorldPos.y;
// Store target position for later use
draggedGem.targetGridX = targetGridX;
draggedGem.targetGridY = targetGridY;
}
};
game.up = function (x, y, obj) {
if (!isDragging || !draggedGem || isSwapping) return;
var startGridPos = {
x: draggedGem.gridX,
y: draggedGem.gridY
};
// Check if we have a target position from dragging
if (draggedGem.targetGridX !== undefined && draggedGem.targetGridY !== undefined) {
var targetGridPos = {
x: draggedGem.targetGridX,
y: draggedGem.targetGridY
};
// Check if target position is valid and adjacent
if (areAdjacent(startGridPos, targetGridPos) && gameBoard[targetGridPos.x][targetGridPos.y]) {
var targetGem = gameBoard[targetGridPos.x][targetGridPos.y];
// Attempt swap
swapGems(draggedGem, targetGem);
} else {
// Invalid swap - animate back to original position
var worldPos = gridToWorld(draggedGem.gridX, draggedGem.gridY);
draggedGem.animateToPosition(worldPos.x, worldPos.y, 200);
}
// Clean up target position
draggedGem.targetGridX = undefined;
draggedGem.targetGridY = undefined;
} else {
// No significant drag - just return to original position
var worldPos = gridToWorld(draggedGem.gridX, draggedGem.gridY);
draggedGem.animateToPosition(worldPos.x, worldPos.y, 200);
}
draggedGem.alpha = 1.0;
draggedGem = null;
dragStartPos = null;
isDragging = false;
};
// Initialize the game
initializeBoard();
fillBoard();
// Initial match clearing
LK.setTimeout(function () {
var matches = findAllMatches();
if (matches.length > 0) {
clearMatches(matches);
}
}, 100);
; ===================================================================
--- original.js
+++ change.js
@@ -490,8 +490,9 @@
}
// Clear matched gems
function clearMatches(matches) {
if (matches.length === 0) return;
+ // Only play sound and effects if there are actual matches
LK.getSound('match').play();
// Calculate points based on match types and sizes
var normalMatches = 0;
var superMatches = 0;
Alev spiral parçacık. In-Game asset. 2d. High contrast. No shadows
Su damlası patlama parçacık. In-Game asset. 2d. High contrast. No shadows
Karadelik vortex parçacık spiral. In-Game asset. 2d. High contrast. No shadows
Yeşil yaprak süzülen. In-Game asset. 2d. High contrast. No shadows
Yıldız patlama parlak. In-Game asset. 2d. High contrast. No shadows
Lav topu erimiş. In-Game asset. 2d. High contrast. No shadows
Health bar, grandyan, green,. In-Game asset. 2d. High contrast. No shadows
Hiç birşeye dokunma sadece yeşil olan kısımları kırmızı ile yer değiştir
Bomba şeklinide grandyan ama çizgili rengarenk olsun