User prompt
Oyunu hiç bozmadan hataları düzelt.
User prompt
Yanlışlıkla bombaya dokunun da bomba sesi tıksın.
User prompt
Yanlışlıkla bombaya tıklayın da bomba sesi tıksın.
User prompt
Dan yazan yere kalp ekle 3 tane.
User prompt
Her meyve yediğinde beş puan versin.
User prompt
Diğerlerini de aynı zikirde bomba boyutuna getir.
User prompt
Bombanın boyutunu büyüt.
Code edit (1 edits merged)
Please save this source code
User prompt
Sky Food Catcher
Initial prompt
Şimdi havada yemek düşüyor ve biz onlara tıklayarak yemekleri yiyoruz ama havada bomba da geliyor. Eğer bombayı yersen danın azarır ve 3 danın var. Eğer 3 danını da bitirirsen oyunu yenirirsin.
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var Bomb = Container.expand(function () {
var self = Container.call(this);
self.speed = 2 + Math.random() * 3;
var graphics = self.attachAsset('bomb', {
anchorX: 0.5,
anchorY: 0.5
});
self.update = function () {
self.y += self.speed;
};
self.down = function (x, y, obj) {
// Hit a bomb - lose a life
lives--;
var heartsDisplay = '';
for (var h = 0; h < lives; h++) {
heartsDisplay += '♥ ';
}
livesText.setText(heartsDisplay.trim());
LK.getSound('bombHit').play();
LK.getSound('bombSound').play();
// Flash screen red
LK.effects.flashScreen(0xff0000, 500);
// Check game over
if (lives <= 0) {
LK.showGameOver();
}
// Remove bomb
self.destroy();
var index = fallingItems.indexOf(self);
if (index > -1) {
fallingItems.splice(index, 1);
}
};
return self;
});
var FoodItem = Container.expand(function (foodType) {
var self = Container.call(this);
self.foodType = foodType;
self.speed = 3 + Math.random() * 2;
self.points = 5;
var graphics = self.attachAsset(foodType, {
anchorX: 0.5,
anchorY: 0.5
});
self.update = function () {
self.y += self.speed;
};
self.down = function (x, y, obj) {
// Catch the food
LK.setScore(LK.getScore() + self.points);
scoreTxt.setText(LK.getScore());
LK.getSound('catchFood').play();
// Visual feedback
tween(self, {
scaleX: 1.5,
scaleY: 1.5,
alpha: 0
}, {
duration: 200,
onFinish: function onFinish() {
self.destroy();
var index = fallingItems.indexOf(self);
if (index > -1) {
fallingItems.splice(index, 1);
}
}
});
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB
});
/****
* Game Code
****/
var fallingItems = [];
var lives = 3;
var spawnTimer = 0;
var difficultyTimer = 0;
var spawnRate = 90; // Frames between spawns
var foodTypes = ['apple', 'banana', 'orange'];
// Create score display
var scoreTxt = new Text2('0', {
size: 80,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Create lives display with hearts
var livesText = new Text2('♥ ♥ ♥', {
size: 60,
fill: 0xFF0000
});
livesText.anchor.set(1, 0);
livesText.x = -20;
livesText.y = 20;
LK.gui.topRight.addChild(livesText);
function spawnItem() {
var item;
var x = 100 + Math.random() * (2048 - 200);
// 70% chance for food, 30% chance for bomb
if (Math.random() < 0.7) {
var foodType = foodTypes[Math.floor(Math.random() * foodTypes.length)];
item = new FoodItem(foodType);
} else {
item = new Bomb();
}
item.x = x;
item.y = -50;
item.lastY = item.y;
fallingItems.push(item);
game.addChild(item);
}
game.update = function () {
// Spawn items
spawnTimer++;
if (spawnTimer >= spawnRate) {
spawnItem();
spawnTimer = 0;
}
// Increase difficulty over time
difficultyTimer++;
if (difficultyTimer >= 600 && spawnRate > 30) {
// Every 10 seconds
spawnRate -= 2;
difficultyTimer = 0;
}
// Update and check falling items
for (var i = fallingItems.length - 1; i >= 0; i--) {
var item = fallingItems[i];
// Remove items that fall off screen
if (item.lastY <= 2732 + 50 && item.y > 2732 + 50) {
item.destroy();
fallingItems.splice(i, 1);
continue;
}
item.lastY = item.y;
}
// Update score display
scoreTxt.setText(LK.getScore());
}; ===================================================================
--- original.js
+++ change.js
@@ -24,8 +24,9 @@
heartsDisplay += '♥ ';
}
livesText.setText(heartsDisplay.trim());
LK.getSound('bombHit').play();
+ LK.getSound('bombSound').play();
// Flash screen red
LK.effects.flashScreen(0xff0000, 500);
// Check game over
if (lives <= 0) {