User prompt
change victory massage YOU WIN THE UPIT PRİCE
User prompt
OYUN BITTI yazısı yerine TEBRİKLER UPIT ÖDÜLÜNÜ KAZANDIN yazsın
User prompt
oyun 5000 puana ulaşıldığında bitsin
User prompt
oyuna son ekle ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
kombo yapma şansını yükselt
User prompt
2 kere art arda patlama olduğunda da ekrana amazing efekti ekle havai fişekli efektli oslun ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
arka plan sesi yap
User prompt
combo yazılarını daha okunaklı ve parıltılı efektli çiz ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
4lü yan yana gelen meyveler de patlasın ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Kombo efektlerini ikili arka arkaya patlatma içinde koy, kombo efektleri ekranda kocaman bir şekilde yazsın, bütün ekranı kapmasın. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Meyveler ardı ardına patladığında, kombolu patladığında 3 komboya wow yazan bir yazı efekti, 4 komboya fancy yazan bir yazı efekti, 5'li komboya da amazing yazan bir yazı efekti koydum. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Şimdi meyvelerin asetlerini hangi renkle uyuşuyorlarsa, hangi renk, hangi meyveyle uyuşuyorsa onunla değiştir.
User prompt
Score yazısının yerine dolar bank notu koy.
User prompt
Her meyve patlattığımızda ekranda kocaman o meyve ne kadar puan verdiyse o kadar dolar yazsın. Her meyvenin farklı bir puanı olsun. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Her meyve patlattığımızda ekrana o meyve ne kadar puan verdiyse o kadar yanında dolar yazan bir puan verme şey olsun skoru yerinde de dolar yazsın. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
Code edit (1 edits merged)
Please save this source code
User prompt
Fruit Crush Paradise
Initial prompt
Kendi Crash tarzında, 9x9 alanda şekerleri patlattığımız bir oyun yapacaksın ama bu oyunun arka planı grafiği meyveler üzerine olacak, meyveler patlayacak, meyveler patladığında efekt çıkacak, her meyve patladığında bir puan vereceksin. 3 tane denk geldi.
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var Fruit = Container.expand(function (fruitType) {
var self = Container.call(this);
self.fruitType = fruitType;
self.gridX = 0;
self.gridY = 0;
self.isSelected = false;
self.isMatching = false;
var fruitGraphics = self.attachAsset(fruitType, {
anchorX: 0.5,
anchorY: 0.5
});
self.setGridPosition = function (gridX, gridY) {
self.gridX = gridX;
self.gridY = gridY;
self.x = GRID_START_X + gridX * CELL_SIZE + CELL_SIZE / 2;
self.y = GRID_START_Y + gridY * CELL_SIZE + CELL_SIZE / 2;
};
self.animateToPosition = function (x, y, duration) {
duration = duration || 300;
tween(self, {
x: x,
y: y
}, {
duration: duration
});
};
self.highlight = function () {
if (!self.isSelected) {
self.isSelected = true;
fruitGraphics.alpha = 0.7;
}
};
self.unhighlight = function () {
if (self.isSelected) {
self.isSelected = false;
fruitGraphics.alpha = 1.0;
}
};
self.explode = function () {
self.isMatching = true;
tween(self, {
scaleX: 1.5,
scaleY: 1.5,
alpha: 0
}, {
duration: 300,
onFinish: function onFinish() {
self.destroy();
}
});
};
self.down = function (x, y, obj) {
if (!gameState.isProcessing && !self.isMatching) {
handleFruitClick(self);
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB
});
/****
* Game Code
****/
var GRID_SIZE = 9;
var CELL_SIZE = 200;
var GRID_START_X = (2048 - GRID_SIZE * CELL_SIZE) / 2;
var GRID_START_Y = 400;
var FRUIT_TYPES = ['apple', 'orange', 'grape', 'strawberry', 'banana', 'kiwi'];
var grid = [];
var selectedFruit = null;
var score = 0;
var gameState = {
isProcessing: false
};
// Initialize score display
var scoreTxt = new Text2('Score: 0', {
size: 80,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Initialize grid array
for (var y = 0; y < GRID_SIZE; y++) {
grid[y] = [];
for (var x = 0; x < GRID_SIZE; x++) {
grid[y][x] = null;
}
}
// Draw grid background
for (var y = 0; y < GRID_SIZE; y++) {
for (var x = 0; x < GRID_SIZE; x++) {
var cell = LK.getAsset('gridCell', {
anchorX: 0,
anchorY: 0
});
cell.x = GRID_START_X + x * CELL_SIZE;
cell.y = GRID_START_Y + y * CELL_SIZE;
cell.alpha = 0.3;
game.addChild(cell);
}
}
function getRandomFruitType() {
return FRUIT_TYPES[Math.floor(Math.random() * FRUIT_TYPES.length)];
}
function createFruit(x, y, fruitType) {
if (!fruitType) {
fruitType = getRandomFruitType();
}
var fruit = new Fruit(fruitType);
fruit.setGridPosition(x, y);
grid[y][x] = fruit;
game.addChild(fruit);
return fruit;
}
function initializeGrid() {
for (var y = 0; y < GRID_SIZE; y++) {
for (var x = 0; x < GRID_SIZE; x++) {
if (!grid[y][x]) {
createFruit(x, y);
}
}
}
}
function isValidPosition(x, y) {
return x >= 0 && x < GRID_SIZE && y >= 0 && y < GRID_SIZE;
}
function areAdjacent(fruit1, fruit2) {
var dx = Math.abs(fruit1.gridX - fruit2.gridX);
var dy = Math.abs(fruit1.gridY - fruit2.gridY);
return dx === 1 && dy === 0 || dx === 0 && dy === 1;
}
function swapFruits(fruit1, fruit2) {
if (!fruit1 || !fruit2) return;
var tempX = fruit1.gridX;
var tempY = fruit1.gridY;
// Update grid references
grid[fruit1.gridY][fruit1.gridX] = fruit2;
grid[fruit2.gridY][fruit2.gridX] = fruit1;
// Update fruit grid positions
fruit1.gridX = fruit2.gridX;
fruit1.gridY = fruit2.gridY;
fruit2.gridX = tempX;
fruit2.gridY = tempY;
// Animate to new positions
var pos1X = GRID_START_X + fruit1.gridX * CELL_SIZE + CELL_SIZE / 2;
var pos1Y = GRID_START_Y + fruit1.gridY * CELL_SIZE + CELL_SIZE / 2;
var pos2X = GRID_START_X + fruit2.gridX * CELL_SIZE + CELL_SIZE / 2;
var pos2Y = GRID_START_Y + fruit2.gridY * CELL_SIZE + CELL_SIZE / 2;
fruit1.animateToPosition(pos1X, pos1Y);
fruit2.animateToPosition(pos2X, pos2Y);
LK.getSound('swap').play();
}
function findMatches() {
var matches = [];
// Check horizontal matches
for (var y = 0; y < GRID_SIZE; y++) {
var count = 1;
var currentType = grid[y][0] ? grid[y][0].fruitType : null;
for (var x = 1; x < GRID_SIZE; x++) {
var fruit = grid[y][x];
if (fruit && fruit.fruitType === currentType) {
count++;
} else {
if (count >= 3 && currentType) {
for (var i = x - count; i < x; i++) {
matches.push({
x: i,
y: y
});
}
}
count = 1;
currentType = fruit ? fruit.fruitType : null;
}
}
if (count >= 3 && currentType) {
for (var i = GRID_SIZE - count; i < GRID_SIZE; i++) {
matches.push({
x: i,
y: y
});
}
}
}
// Check vertical matches
for (var x = 0; x < GRID_SIZE; x++) {
var count = 1;
var currentType = grid[0][x] ? grid[0][x].fruitType : null;
for (var y = 1; y < GRID_SIZE; y++) {
var fruit = grid[y][x];
if (fruit && fruit.fruitType === currentType) {
count++;
} else {
if (count >= 3 && currentType) {
for (var i = y - count; i < y; i++) {
matches.push({
x: x,
y: i
});
}
}
count = 1;
currentType = fruit ? fruit.fruitType : null;
}
}
if (count >= 3 && currentType) {
for (var i = GRID_SIZE - count; i < GRID_SIZE; i++) {
matches.push({
x: x,
y: i
});
}
}
}
return matches;
}
function removeMatches(matches) {
if (matches.length === 0) return;
gameState.isProcessing = true;
// Mark fruits for removal and add score
for (var i = 0; i < matches.length; i++) {
var match = matches[i];
var fruit = grid[match.y][match.x];
if (fruit && !fruit.isMatching) {
fruit.explode();
grid[match.y][match.x] = null;
score += 10;
}
}
scoreTxt.setText('Score: ' + score);
LK.getSound('match').play();
// Wait for explosion animation to complete
LK.setTimeout(function () {
dropFruits();
}, 350);
}
function dropFruits() {
var moved = false;
// Drop existing fruits
for (var x = 0; x < GRID_SIZE; x++) {
var writePos = GRID_SIZE - 1;
for (var y = GRID_SIZE - 1; y >= 0; y--) {
if (grid[y][x] && !grid[y][x].isMatching) {
if (y !== writePos) {
grid[writePos][x] = grid[y][x];
grid[y][x] = null;
var fruit = grid[writePos][x];
fruit.gridY = writePos;
var newY = GRID_START_Y + writePos * CELL_SIZE + CELL_SIZE / 2;
fruit.animateToPosition(fruit.x, newY, 200);
moved = true;
}
writePos--;
}
}
}
// Fill empty spaces with new fruits
for (var x = 0; x < GRID_SIZE; x++) {
for (var y = 0; y < GRID_SIZE; y++) {
if (!grid[y][x]) {
createFruit(x, y);
var fruit = grid[y][x];
fruit.y = GRID_START_Y - CELL_SIZE;
fruit.animateToPosition(fruit.x, GRID_START_Y + y * CELL_SIZE + CELL_SIZE / 2, 300);
moved = true;
}
}
}
if (moved) {
LK.setTimeout(function () {
checkForMatches();
}, 350);
} else {
gameState.isProcessing = false;
}
}
function checkForMatches() {
var matches = findMatches();
if (matches.length > 0) {
removeMatches(matches);
} else {
gameState.isProcessing = false;
}
}
function handleFruitClick(fruit) {
if (!selectedFruit) {
selectedFruit = fruit;
fruit.highlight();
} else if (selectedFruit === fruit) {
selectedFruit.unhighlight();
selectedFruit = null;
} else if (areAdjacent(selectedFruit, fruit)) {
gameState.isProcessing = true;
var oldSelected = selectedFruit;
selectedFruit.unhighlight();
selectedFruit = null;
swapFruits(oldSelected, fruit);
LK.setTimeout(function () {
var matches = findMatches();
if (matches.length > 0) {
removeMatches(matches);
} else {
// No matches, swap back
swapFruits(oldSelected, fruit);
LK.setTimeout(function () {
gameState.isProcessing = false;
}, 300);
}
}, 300);
} else {
selectedFruit.unhighlight();
selectedFruit = fruit;
fruit.highlight();
}
}
// Initialize the game
initializeGrid();
// Initial match check after a short delay
LK.setTimeout(function () {
checkForMatches();
}, 500);
game.update = function () {
// Game update logic if needed
}; ===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,338 @@
-/****
+/****
+* Plugins
+****/
+var tween = LK.import("@upit/tween.v1");
+
+/****
+* Classes
+****/
+var Fruit = Container.expand(function (fruitType) {
+ var self = Container.call(this);
+ self.fruitType = fruitType;
+ self.gridX = 0;
+ self.gridY = 0;
+ self.isSelected = false;
+ self.isMatching = false;
+ var fruitGraphics = self.attachAsset(fruitType, {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.setGridPosition = function (gridX, gridY) {
+ self.gridX = gridX;
+ self.gridY = gridY;
+ self.x = GRID_START_X + gridX * CELL_SIZE + CELL_SIZE / 2;
+ self.y = GRID_START_Y + gridY * CELL_SIZE + CELL_SIZE / 2;
+ };
+ self.animateToPosition = function (x, y, duration) {
+ duration = duration || 300;
+ tween(self, {
+ x: x,
+ y: y
+ }, {
+ duration: duration
+ });
+ };
+ self.highlight = function () {
+ if (!self.isSelected) {
+ self.isSelected = true;
+ fruitGraphics.alpha = 0.7;
+ }
+ };
+ self.unhighlight = function () {
+ if (self.isSelected) {
+ self.isSelected = false;
+ fruitGraphics.alpha = 1.0;
+ }
+ };
+ self.explode = function () {
+ self.isMatching = true;
+ tween(self, {
+ scaleX: 1.5,
+ scaleY: 1.5,
+ alpha: 0
+ }, {
+ duration: 300,
+ onFinish: function onFinish() {
+ self.destroy();
+ }
+ });
+ };
+ self.down = function (x, y, obj) {
+ if (!gameState.isProcessing && !self.isMatching) {
+ handleFruitClick(self);
+ }
+ };
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0x87CEEB
+});
+
+/****
+* Game Code
+****/
+var GRID_SIZE = 9;
+var CELL_SIZE = 200;
+var GRID_START_X = (2048 - GRID_SIZE * CELL_SIZE) / 2;
+var GRID_START_Y = 400;
+var FRUIT_TYPES = ['apple', 'orange', 'grape', 'strawberry', 'banana', 'kiwi'];
+var grid = [];
+var selectedFruit = null;
+var score = 0;
+var gameState = {
+ isProcessing: false
+};
+// Initialize score display
+var scoreTxt = new Text2('Score: 0', {
+ size: 80,
+ fill: 0xFFFFFF
+});
+scoreTxt.anchor.set(0.5, 0);
+LK.gui.top.addChild(scoreTxt);
+// Initialize grid array
+for (var y = 0; y < GRID_SIZE; y++) {
+ grid[y] = [];
+ for (var x = 0; x < GRID_SIZE; x++) {
+ grid[y][x] = null;
+ }
+}
+// Draw grid background
+for (var y = 0; y < GRID_SIZE; y++) {
+ for (var x = 0; x < GRID_SIZE; x++) {
+ var cell = LK.getAsset('gridCell', {
+ anchorX: 0,
+ anchorY: 0
+ });
+ cell.x = GRID_START_X + x * CELL_SIZE;
+ cell.y = GRID_START_Y + y * CELL_SIZE;
+ cell.alpha = 0.3;
+ game.addChild(cell);
+ }
+}
+function getRandomFruitType() {
+ return FRUIT_TYPES[Math.floor(Math.random() * FRUIT_TYPES.length)];
+}
+function createFruit(x, y, fruitType) {
+ if (!fruitType) {
+ fruitType = getRandomFruitType();
+ }
+ var fruit = new Fruit(fruitType);
+ fruit.setGridPosition(x, y);
+ grid[y][x] = fruit;
+ game.addChild(fruit);
+ return fruit;
+}
+function initializeGrid() {
+ for (var y = 0; y < GRID_SIZE; y++) {
+ for (var x = 0; x < GRID_SIZE; x++) {
+ if (!grid[y][x]) {
+ createFruit(x, y);
+ }
+ }
+ }
+}
+function isValidPosition(x, y) {
+ return x >= 0 && x < GRID_SIZE && y >= 0 && y < GRID_SIZE;
+}
+function areAdjacent(fruit1, fruit2) {
+ var dx = Math.abs(fruit1.gridX - fruit2.gridX);
+ var dy = Math.abs(fruit1.gridY - fruit2.gridY);
+ return dx === 1 && dy === 0 || dx === 0 && dy === 1;
+}
+function swapFruits(fruit1, fruit2) {
+ if (!fruit1 || !fruit2) return;
+ var tempX = fruit1.gridX;
+ var tempY = fruit1.gridY;
+ // Update grid references
+ grid[fruit1.gridY][fruit1.gridX] = fruit2;
+ grid[fruit2.gridY][fruit2.gridX] = fruit1;
+ // Update fruit grid positions
+ fruit1.gridX = fruit2.gridX;
+ fruit1.gridY = fruit2.gridY;
+ fruit2.gridX = tempX;
+ fruit2.gridY = tempY;
+ // Animate to new positions
+ var pos1X = GRID_START_X + fruit1.gridX * CELL_SIZE + CELL_SIZE / 2;
+ var pos1Y = GRID_START_Y + fruit1.gridY * CELL_SIZE + CELL_SIZE / 2;
+ var pos2X = GRID_START_X + fruit2.gridX * CELL_SIZE + CELL_SIZE / 2;
+ var pos2Y = GRID_START_Y + fruit2.gridY * CELL_SIZE + CELL_SIZE / 2;
+ fruit1.animateToPosition(pos1X, pos1Y);
+ fruit2.animateToPosition(pos2X, pos2Y);
+ LK.getSound('swap').play();
+}
+function findMatches() {
+ var matches = [];
+ // Check horizontal matches
+ for (var y = 0; y < GRID_SIZE; y++) {
+ var count = 1;
+ var currentType = grid[y][0] ? grid[y][0].fruitType : null;
+ for (var x = 1; x < GRID_SIZE; x++) {
+ var fruit = grid[y][x];
+ if (fruit && fruit.fruitType === currentType) {
+ count++;
+ } else {
+ if (count >= 3 && currentType) {
+ for (var i = x - count; i < x; i++) {
+ matches.push({
+ x: i,
+ y: y
+ });
+ }
+ }
+ count = 1;
+ currentType = fruit ? fruit.fruitType : null;
+ }
+ }
+ if (count >= 3 && currentType) {
+ for (var i = GRID_SIZE - count; i < GRID_SIZE; i++) {
+ matches.push({
+ x: i,
+ y: y
+ });
+ }
+ }
+ }
+ // Check vertical matches
+ for (var x = 0; x < GRID_SIZE; x++) {
+ var count = 1;
+ var currentType = grid[0][x] ? grid[0][x].fruitType : null;
+ for (var y = 1; y < GRID_SIZE; y++) {
+ var fruit = grid[y][x];
+ if (fruit && fruit.fruitType === currentType) {
+ count++;
+ } else {
+ if (count >= 3 && currentType) {
+ for (var i = y - count; i < y; i++) {
+ matches.push({
+ x: x,
+ y: i
+ });
+ }
+ }
+ count = 1;
+ currentType = fruit ? fruit.fruitType : null;
+ }
+ }
+ if (count >= 3 && currentType) {
+ for (var i = GRID_SIZE - count; i < GRID_SIZE; i++) {
+ matches.push({
+ x: x,
+ y: i
+ });
+ }
+ }
+ }
+ return matches;
+}
+function removeMatches(matches) {
+ if (matches.length === 0) return;
+ gameState.isProcessing = true;
+ // Mark fruits for removal and add score
+ for (var i = 0; i < matches.length; i++) {
+ var match = matches[i];
+ var fruit = grid[match.y][match.x];
+ if (fruit && !fruit.isMatching) {
+ fruit.explode();
+ grid[match.y][match.x] = null;
+ score += 10;
+ }
+ }
+ scoreTxt.setText('Score: ' + score);
+ LK.getSound('match').play();
+ // Wait for explosion animation to complete
+ LK.setTimeout(function () {
+ dropFruits();
+ }, 350);
+}
+function dropFruits() {
+ var moved = false;
+ // Drop existing fruits
+ for (var x = 0; x < GRID_SIZE; x++) {
+ var writePos = GRID_SIZE - 1;
+ for (var y = GRID_SIZE - 1; y >= 0; y--) {
+ if (grid[y][x] && !grid[y][x].isMatching) {
+ if (y !== writePos) {
+ grid[writePos][x] = grid[y][x];
+ grid[y][x] = null;
+ var fruit = grid[writePos][x];
+ fruit.gridY = writePos;
+ var newY = GRID_START_Y + writePos * CELL_SIZE + CELL_SIZE / 2;
+ fruit.animateToPosition(fruit.x, newY, 200);
+ moved = true;
+ }
+ writePos--;
+ }
+ }
+ }
+ // Fill empty spaces with new fruits
+ for (var x = 0; x < GRID_SIZE; x++) {
+ for (var y = 0; y < GRID_SIZE; y++) {
+ if (!grid[y][x]) {
+ createFruit(x, y);
+ var fruit = grid[y][x];
+ fruit.y = GRID_START_Y - CELL_SIZE;
+ fruit.animateToPosition(fruit.x, GRID_START_Y + y * CELL_SIZE + CELL_SIZE / 2, 300);
+ moved = true;
+ }
+ }
+ }
+ if (moved) {
+ LK.setTimeout(function () {
+ checkForMatches();
+ }, 350);
+ } else {
+ gameState.isProcessing = false;
+ }
+}
+function checkForMatches() {
+ var matches = findMatches();
+ if (matches.length > 0) {
+ removeMatches(matches);
+ } else {
+ gameState.isProcessing = false;
+ }
+}
+function handleFruitClick(fruit) {
+ if (!selectedFruit) {
+ selectedFruit = fruit;
+ fruit.highlight();
+ } else if (selectedFruit === fruit) {
+ selectedFruit.unhighlight();
+ selectedFruit = null;
+ } else if (areAdjacent(selectedFruit, fruit)) {
+ gameState.isProcessing = true;
+ var oldSelected = selectedFruit;
+ selectedFruit.unhighlight();
+ selectedFruit = null;
+ swapFruits(oldSelected, fruit);
+ LK.setTimeout(function () {
+ var matches = findMatches();
+ if (matches.length > 0) {
+ removeMatches(matches);
+ } else {
+ // No matches, swap back
+ swapFruits(oldSelected, fruit);
+ LK.setTimeout(function () {
+ gameState.isProcessing = false;
+ }, 300);
+ }
+ }, 300);
+ } else {
+ selectedFruit.unhighlight();
+ selectedFruit = fruit;
+ fruit.highlight();
+ }
+}
+// Initialize the game
+initializeGrid();
+// Initial match check after a short delay
+LK.setTimeout(function () {
+ checkForMatches();
+}, 500);
+game.update = function () {
+ // Game update logic if needed
+};
\ No newline at end of file
strawberry. In-Game asset. 2d. High contrast. No shadows
apple. In-Game asset. 2d. High contrast. No shadows
banana. In-Game asset. 2d. High contrast. No shadows
grape. In-Game asset. 2d. High contrast. No shadows
golden shiny very shiny apple. In-Game asset. 2d. High contrast. No shadows
watermelon slice juicy. In-Game asset. 2d. High contrast. No shadows
green leaf background. In-Game asset. 2d. High contrast. No shadows
bomb. In-Game asset. 2d. High contrast. No shadows