User prompt
Her meyve toplandığında skor 10 artsın
User prompt
Sepet hareket hızını %30 oranında artır
User prompt
Biraz azalt
User prompt
Sepet hareket hızını artır
User prompt
Tüm meyvelerin hareket hızı aynı olsun
User prompt
Eğer skor +50 olursa meyve ve sepetin hareket etme hızını %100 olarak artır
User prompt
Butona basınca daha pürüzsüz bir hareket olsun ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Sepeti hareket etirebilecek iki buton olsun sağ ve sol
User prompt
Sepet x yönünde hareket edebilsin
User prompt
Meyveler yere sepeti geçerse skor -5 olarak azalsın
User prompt
Meyveler belirli bir süreden sonra kaybolmasın
User prompt
Sepet sadece x yönünde hareket etsin
User prompt
Meyveler yukarıdan rastgele aralıklarla yağsın
Code edit (1 edits merged)
Please save this source code
User prompt
Meyve Topla!
Initial prompt
Meyve toplama oyunu yap
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ // Fruit class: represents a collectible fruit var Fruit = Container.expand(function () { var self = Container.call(this); // Randomly pick a fruit image asset for variety var fruitAssets = ['fruit', 'fruit2', 'fruit3', 'fruit4']; var fruitAssetId = fruitAssets[Math.floor(Math.random() * fruitAssets.length)]; // Optionally, randomize color for extra variety (if you want to tint, but not required) // var fruitColors = [0xff3b3b, 0xffe14d, 0x4de14d, 0x4db8ff, 0xff7ff0]; // var color = fruitColors[Math.floor(Math.random() * fruitColors.length)]; // Create fruit image asset var fruitAsset = self.attachAsset(fruitAssetId, { width: 120, height: 120, anchorX: 0.5, anchorY: 0.5 }); // Used for animation self.alpha = 0; self.scaleX = 0.7; self.scaleY = 0.7; // Animate fruit appearing tween(self, { alpha: 1, scaleX: 1, scaleY: 1 }, { duration: 200, easing: tween.easeOut }); // For tracking if already collected self.collected = false; // Destroy with a pop animation self.collect = function (_onFinish) { if (self.collected) return; self.collected = true; tween(self, { scaleX: 1.4, scaleY: 1.4, alpha: 0 }, { duration: 180, easing: tween.easeIn, onFinish: function onFinish() { self.destroy(); if (_onFinish) _onFinish(); } }); }; return self; }); // Player class: single block basket var Player = Container.expand(function () { var self = Container.call(this); // Basket is a single colored box var playerAsset = self.attachAsset('player', { width: 180, height: 80, color: 0x3b7fff, shape: 'box', anchorX: 0.5, anchorY: 0.5 }); playerAsset.alpha = 0.7; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0xf7f7f7 }); /**** * Game Code ****/ // Pause menu round buttons as assets // Game constants // Tween plugin for fruit spawn/collect animations // Second block above start, can use same asset or a new one if desired var GAME_WIDTH = 2048; var GAME_HEIGHT = 2732; var FRUIT_SPAWN_MIN = 900; // ms var FRUIT_SPAWN_MAX = 1800; // ms var FRUIT_LIFETIME = 2600; // ms before fruit disappears var WIN_SCORE = 20; var FRUIT_FALL_SPEED = 10; // Meyve hızı 10 // Game state var fruits = []; var player = null; var dragNode = null; var score = 0; var scoreTxt = null; var spawnTimer = null; var fruitSpawnInterval = FRUIT_SPAWN_MAX; var lastTouch = { x: GAME_WIDTH / 2, y: GAME_HEIGHT * 0.8 }; // Set up background color game.setBackgroundColor(0xf7f7f7); // --- START SCREEN OVERLAY --- var startOverlay = new Container(); startOverlay.width = GAME_WIDTH; startOverlay.height = GAME_HEIGHT; startOverlay.interactive = true; // Start screen background image var startBg = LK.getAsset('startBg', { anchorX: 0, anchorY: 0, x: 0, y: 0, width: GAME_WIDTH, height: GAME_HEIGHT }); startOverlay.addChild(startBg); // Semi-transparent background (over the image, for darkening effect) var overlayBg = LK.getAsset('player', { width: GAME_WIDTH, height: GAME_HEIGHT, color: 0x000000, shape: 'box', anchorX: 0, anchorY: 0, x: 0, y: 0 }); overlayBg.alpha = 0.3; startOverlay.addChild(overlayBg); // Add a new block at the very top of the start screen var startTopBlock2 = LK.getAsset('startTopBlock', { anchorX: 0.5, anchorY: 0, x: GAME_WIDTH / 2, y: 80 // higher than the first block // Use asset's native size, do not scale or stretch }); startOverlay.addChild(startTopBlock2); // Add a new block at the top of the start screen var startTopBlock = LK.getAsset('startTopBlock', { anchorX: 0.5, anchorY: 0, x: GAME_WIDTH / 2, y: 200 // Use asset's native size, do not scale or stretch }); startOverlay.addChild(startTopBlock); // "Başla" button (centered) - now as a dedicated asset, no text or title var startBtn = LK.getAsset('startBtn', { anchorX: 0.5, anchorY: 0.5, x: GAME_WIDTH / 2, y: GAME_HEIGHT / 2 }); startOverlay.addChild(startBtn); // Settings button (even further below start button, centered) var settingsBtn = LK.getAsset('settingsBtn', { anchorX: 0.5, anchorY: 0.5, x: GAME_WIDTH / 2, y: GAME_HEIGHT / 2 + 420 // moved up, now 420px below startBtn }); startOverlay.addChild(settingsBtn); // Settings menu overlay (hidden by default, shown as a separate "scene" when settings is pressed) var settingsMenuOverlay = new Container(); settingsMenuOverlay.width = GAME_WIDTH; settingsMenuOverlay.height = GAME_HEIGHT; settingsMenuOverlay.visible = false; settingsMenuOverlay.interactive = true; // Full screen background image for settings menu var settingsMenuBgImage = LK.getAsset('settingsMenuBg', { anchorX: 0, anchorY: 0, x: 0, y: 0, width: GAME_WIDTH, height: GAME_HEIGHT }); settingsMenuOverlay.addChild(settingsMenuBgImage); // Semi-transparent overlay for settings menu (for click-to-close) var settingsMenuBg = LK.getAsset('player', { width: GAME_WIDTH, height: GAME_HEIGHT, color: 0x000000, shape: 'box', anchorX: 0, anchorY: 0, x: 0, y: 0 }); settingsMenuBg.alpha = 0.2; settingsMenuOverlay.addChild(settingsMenuBg); // Settings menu buttons (centered vertically: top, center, bottom) var menuBtnSpacing = 340; var menuBtnYCenter = GAME_HEIGHT / 2; var menuBtn1 = LK.getAsset('settingsMenuBtn1', { anchorX: 0.5, anchorY: 0.5, x: GAME_WIDTH / 2, y: menuBtnYCenter - menuBtnSpacing }); var menuBtn2 = LK.getAsset('settingsMenuBtn2', { anchorX: 0.5, anchorY: 0.5, x: GAME_WIDTH / 2, y: menuBtnYCenter }); var menuBtn3 = LK.getAsset('settingsMenuBtn3', { anchorX: 0.5, anchorY: 0.5, x: GAME_WIDTH / 2, y: menuBtnYCenter + menuBtnSpacing }); settingsMenuOverlay.addChild(menuBtn1); settingsMenuOverlay.addChild(menuBtn2); settingsMenuOverlay.addChild(menuBtn3); // Hide settings menu when background is pressed settingsMenuBg.down = function (x, y, obj) { settingsMenuOverlay.visible = false; startOverlay.visible = true; }; // Close menu on any menu button press menuBtn1.down = function (x, y, obj) { // Hide settings and start overlays settingsMenuOverlay.visible = false; if (startOverlay.parent) startOverlay.parent.removeChild(startOverlay); // Start the game if not already started if (!gameStarted) { gameStarted = true; showGameElements(); scheduleNextFruit(); } else { showGameElements(); } // Show move buttons directly leftBtn.visible = true; rightBtn.visible = true; moveButtonsVisible = true; }; menuBtn2.down = function (x, y, obj) { settingsMenuOverlay.visible = false; startOverlay.visible = true; }; menuBtn3.down = function (x, y, obj) { settingsMenuOverlay.visible = false; startOverlay.visible = true; }; game.addChild(settingsMenuOverlay); game.addChild(startOverlay); // Show settings menu as a separate "scene" when settingsBtn is pressed settingsBtn.down = function (x, y, obj) { // Animate settingsBtn shrinking tween(settingsBtn, { scaleX: 0.85, scaleY: 0.85 }, { duration: 90, easing: tween.cubicIn, onFinish: function onFinish() { tween(settingsBtn, { scaleX: 0.1, scaleY: 0.1, alpha: 0 }, { duration: 180, easing: tween.cubicIn, onFinish: function onFinish() { // After animation, show settings menu settingsMenuOverlay.visible = true; startOverlay.visible = false; // Hide move buttons when not in game leftBtn.visible = false; rightBtn.visible = false; moveButtonsVisible = false; // Reset settingsBtn for next time settingsBtn.scaleX = 1; settingsBtn.scaleY = 1; settingsBtn.alpha = 1; } }); } }); }; // --- GAME ELEMENTS (hidden until start) --- player = new Player(); player.x = GAME_WIDTH / 2; player.y = GAME_HEIGHT * 0.8; player.visible = false; game.addChild(player); scoreTxt = new Text2('0', { size: 120, fill: 0x222222 }); scoreTxt.anchor.set(0.5, 0); scoreTxt.visible = false; LK.gui.top.addChild(scoreTxt); // Add pause button below the score var pauseBtn = LK.getAsset('player', { width: 180, height: 110, color: 0x888888, shape: 'box', anchorX: 0.5, anchorY: 0, x: 0, // will be positioned by container y: 0 }); var pauseIcon = new Text2('⏸', { size: 80, fill: "#fff" }); pauseIcon.anchor.set(0.5, 0.5); pauseIcon.x = pauseBtn.width / 2; pauseIcon.y = pauseBtn.height / 2; pauseBtn.addChild(pauseIcon); // Container to position pauseBtn under score var pauseBtnContainer = new Container(); pauseBtnContainer.addChild(pauseBtn); pauseBtnContainer.x = 0; pauseBtnContainer.y = scoreTxt.height + 10; // 10px below score // Add to GUI, under score LK.gui.top.addChild(pauseBtnContainer); // Pause overlay (hidden by default) var pauseOverlay = new Container(); pauseOverlay.width = GAME_WIDTH; pauseOverlay.height = GAME_HEIGHT; pauseOverlay.visible = false; pauseOverlay.interactive = true; // Semi-transparent background with blur var pauseBg = LK.getAsset('player', { width: GAME_WIDTH, height: GAME_HEIGHT, color: 0x000000, shape: 'box', anchorX: 0, anchorY: 0, x: 0, y: 0 }); pauseBg.alpha = 0.10; pauseOverlay.addChild(pauseBg); // Add a blur effect to the overlay (simulate with a blurred asset if available, or just comment for now) // If LK.effects.blurScreen existed, we would use it. For now, we note the intent. // LK.effects.blurScreen(10); // Not available, so just use alpha // Add three round (ellipse) buttons to pause overlay var pauseButtonSpacing = 340; var pauseButtonYCenter = GAME_HEIGHT / 2; var pauseBtnRadius = 220; // 1. Devam Et (Continue) round button var pauseContinueRoundBtn = LK.getAsset('fruit', { width: pauseBtnRadius, height: pauseBtnRadius, color: 0x4db8ff, shape: 'ellipse', anchorX: 0.5, anchorY: 0.5, x: GAME_WIDTH / 2, y: pauseButtonYCenter - pauseButtonSpacing }); pauseOverlay.addChild(pauseContinueRoundBtn); // 2. Başa Dön (Restart) round button var pauseRestartRoundBtn = LK.getAsset('fruit', { width: pauseBtnRadius, height: pauseBtnRadius, color: 0xffe14d, shape: 'ellipse', anchorX: 0.5, anchorY: 0.5, x: GAME_WIDTH / 2, y: pauseButtonYCenter }); pauseOverlay.addChild(pauseRestartRoundBtn); // 3. Ayarlar (Settings) round button var pauseSettingsRoundBtn = LK.getAsset('fruit', { width: pauseBtnRadius, height: pauseBtnRadius, color: 0xff7ff0, shape: 'ellipse', anchorX: 0.5, anchorY: 0.5, x: GAME_WIDTH / 2, y: pauseButtonYCenter + pauseButtonSpacing }); pauseOverlay.addChild(pauseSettingsRoundBtn); // Button logic (same as before) pauseContinueRoundBtn.down = function (x, y, obj) { pauseOverlay.visible = false; showGameElements(); }; pauseRestartRoundBtn.down = function (x, y, obj) { // Return to start: show start overlay, hide pause overlay, reset game state pauseOverlay.visible = false; if (!startOverlay.parent) game.addChild(startOverlay); hideGameElements(); gameStarted = false; // Clean up fruits and timers if (spawnTimer) LK.clearTimeout(spawnTimer); for (var i = 0; i < fruits.length; i++) { if (fruits[i]._timeout) LK.clearTimeout(fruits[i]._timeout); fruits[i].destroy(); } fruits = []; score = 0; updateScore(); player.x = GAME_WIDTH / 2; player.y = GAME_HEIGHT * 0.8; }; pauseSettingsRoundBtn.down = function (x, y, obj) { pauseOverlay.visible = false; settingsMenuOverlay.visible = true; startOverlay.visible = false; leftBtn.visible = false; rightBtn.visible = false; moveButtonsVisible = false; }; // Add overlay to game game.addChild(pauseOverlay); // Pause button logic: show pause overlay, hide game elements pauseBtn.down = function (x, y, obj) { hideGameElements(); pauseOverlay.visible = true; }; pauseBtn.visible = false; // --- Add left/right move buttons, initially hidden, and a toggle button at top right --- // Button sizes and positions are optimized for mobile (large touch targets, no overlap with menu) var buttonSize = 260; var buttonMargin = 120; var buttonY = GAME_HEIGHT - buttonSize - 60; // Toggle button (top right, avoid top left 100x100 and right edge) var toggleBtnSize = 120; var toggleBtn = LK.getAsset('player', { width: toggleBtnSize, height: toggleBtnSize, color: 0x222222, shape: 'box', anchorX: 0.5, anchorY: 0.5, x: GAME_WIDTH - 100 - toggleBtnSize / 2 - 20, // right margin, avoid top right 100x100 y: 100 / 2 + 20 }); var toggleIcon = new Text2('☰', { size: 80, fill: "#fff" }); toggleIcon.anchor.set(0.5, 0.5); toggleIcon.x = toggleBtn.width / 2; toggleIcon.y = toggleBtn.height / 2; toggleBtn.addChild(toggleIcon); toggleBtn.visible = false; game.addChild(toggleBtn); // Left button (bottom left, above safe margin) var leftBtn = LK.getAsset('player', { width: buttonSize, height: buttonSize, color: 0x3b7fff, shape: 'box', anchorX: 0.5, anchorY: 0.5, x: buttonMargin + buttonSize / 2, y: buttonY }); var leftArrow = new Text2('◀', { size: 180, fill: "#fff" }); leftArrow.anchor.set(0.5, 0.5); leftArrow.x = leftBtn.width / 2; leftArrow.y = leftBtn.height / 2; leftBtn.addChild(leftArrow); leftBtn.visible = false; // Right button (bottom right, above safe margin) var rightBtn = LK.getAsset('player', { width: buttonSize, height: buttonSize, color: 0x3b7fff, shape: 'box', anchorX: 0.5, anchorY: 0.5, x: GAME_WIDTH - buttonMargin - buttonSize / 2, y: buttonY }); var rightArrow = new Text2('▶', { size: 180, fill: "#fff" }); rightArrow.anchor.set(0.5, 0.5); rightArrow.x = rightBtn.width / 2; rightArrow.y = rightBtn.height / 2; rightBtn.addChild(rightArrow); rightBtn.visible = false; game.addChild(leftBtn); game.addChild(rightBtn); // Toggle logic var moveButtonsVisible = false; toggleBtn.down = function (x, y, obj) { moveButtonsVisible = !moveButtonsVisible; leftBtn.visible = moveButtonsVisible; rightBtn.visible = moveButtonsVisible; }; // --- START BUTTON LOGIC --- function showGameElements() { player.visible = true; scoreTxt.visible = true; toggleBtn.visible = true; pauseBtn.visible = true; // Hide pause overlay if visible if (typeof pauseOverlay !== "undefined") pauseOverlay.visible = false; // Move buttons are only visible if toggled, but always hidden at game start leftBtn.visible = false; rightBtn.visible = false; moveButtonsVisible = false; } function hideGameElements() { player.visible = false; scoreTxt.visible = false; toggleBtn.visible = false; pauseBtn.visible = false; leftBtn.visible = false; rightBtn.visible = false; moveButtonsVisible = false; // Hide pause overlay if visible if (typeof pauseOverlay !== "undefined") pauseOverlay.visible = false; } // When start is pressed, remove overlay and show game elements, start fruit spawning var gameStarted = false; startBtn.down = function (x, y, obj) { if (gameStarted) return; gameStarted = true; // Animate startBtn shrinking tween(startBtn, { scaleX: 0.85, scaleY: 0.85 }, { duration: 90, easing: tween.cubicIn, onFinish: function onFinish() { tween(startBtn, { scaleX: 0.1, scaleY: 0.1, alpha: 0 }, { duration: 180, easing: tween.cubicIn, onFinish: function onFinish() { // Animate startTopBlock as before tween(startTopBlock, { scaleX: 0.1, scaleY: 0.1, alpha: 0 }, { duration: 220, easing: tween.cubicIn, onFinish: function onFinish() { if (startOverlay.parent) startOverlay.parent.removeChild(startOverlay); showGameElements(); scheduleNextFruit(); } }); } }); } }); }; hideGameElements(); // Button press logic var moveBtnInterval = null; // Pürüzsüz hareket için hız ve hedef yön var MOVE_SPEED = 32; // px/frame, pürüzsüz hız (20'den biraz daha hızlı, ayarlanabilir) var playerVelocity = 0; var playerTargetDir = 0; // -1: sola, 1: sağa, 0: dur // Sepet hızlandırma için çarpan (her 50'de %5 artar) var playerSpeedMultiplier = 1; var lastSpeedupScore = 0; // Touch/hold left leftBtn.down = function (x, y, obj) { if (!leftBtn.visible) return; playerTargetDir = -1; }; leftBtn.up = function (x, y, obj) { if (playerTargetDir === -1) playerTargetDir = 0; }; // Touch/hold right rightBtn.down = function (x, y, obj) { if (!rightBtn.visible) return; playerTargetDir = 1; }; rightBtn.up = function (x, y, obj) { if (playerTargetDir === 1) playerTargetDir = 0; }; // Helper: update score display function updateScore() { scoreTxt.setText(score); } // Helper: spawn a fruit at a random X position at the top, and make it fall down function spawnFruit() { // Avoid top 100px (menu), and bottom 200px (player area) var margin = 140; var minX = margin; var maxX = GAME_WIDTH - margin; var fruit = new Fruit(); fruit.x = Math.floor(Math.random() * (maxX - minX)) + minX; fruit.y = 120; // Always spawn at the top // All fruits have the same fall speed, controlled by a single variable fruit.fallSpeed = FRUIT_FALL_SPEED; // Track lastY for good practice fruit.lastY = fruit.y; fruits.push(fruit); game.addChild(fruit); // Fruit will only be removed if collected or falls below the screen } // Helper: schedule next fruit spawn, with increasing speed function scheduleNextFruit() { if (!gameStarted) return; // As score increases, spawn interval decreases var minInterval = FRUIT_SPAWN_MIN; var maxInterval = FRUIT_SPAWN_MAX; var progress = Math.min(score / WIN_SCORE, 1); fruitSpawnInterval = maxInterval - (maxInterval - minInterval) * progress; var nextIn = Math.floor(fruitSpawnInterval * (0.7 + Math.random() * 0.6)); // randomize a bit spawnTimer = LK.setTimeout(function () { if (!gameStarted) return; spawnFruit(); scheduleNextFruit(); }, nextIn); } // Dragging logic game.down = function (x, y, obj) { if (!gameStarted) return; // Only start drag if touch is on player (or close to it) var dx = x - player.x; var dy = y - player.y; var dist = Math.sqrt(dx * dx + dy * dy); if (dist < 120) { dragNode = player; lastTouch.x = x; lastTouch.y = y; } }; game.move = function (x, y, obj) { if (!gameStarted) return; if (dragNode === player) { // Allow player to move only in X direction, clamp within game area var moveMultiplier = playerSpeedMultiplier; var px = Math.max(70, Math.min(GAME_WIDTH - 70, x)); // Stop any previous tween on player.x to avoid stacking tween.stop(player, { x: true }); tween(player, { x: px }, { duration: Math.round(90 / 1.3) / moveMultiplier, // 30% faster easing: tween.cubicOut }); // Y stays fixed at initial position (bottom 20% of screen) lastTouch.x = px; lastTouch.y = player.y; } }; game.up = function (x, y, obj) { if (!gameStarted) return; dragNode = null; }; // Main update loop: check for fruit collection game.update = function () { if (!gameStarted) return; if (pauseOverlay.visible) return; // FRUIT_FALL_SPEED is now handled by 100s logic above, no need to reset here // Pürüzsüz sepet hareketi if (!dragNode) { // Her +100'de bir %3 hızlandır (örn: 100, 200, 300, ...), ve bunu her zaman uygula if (Math.floor(score / 100) > Math.floor(lastSpeedupScore / 100)) { var speedupSteps = Math.floor(score / 100) - Math.floor(lastSpeedupScore / 100); for (var s = 0; s < speedupSteps; s++) { playerSpeedMultiplier *= 1.03; FRUIT_FALL_SPEED *= 1.03; } lastSpeedupScore = Math.floor(score / 100) * 100; } // Sadece butonla hareket ediyorsa var moveMultiplier = playerSpeedMultiplier; // Hedef hıza doğru yumuşak geçiş (smooth acceleration) var targetVelocity = playerTargetDir * MOVE_SPEED * moveMultiplier; // Linear interpolation (lerp) ile hız geçişi playerVelocity += (targetVelocity - playerVelocity) * 0.22; // Eğer hedef durmaksa, yavaşça sıfıra yaklaşsın if (playerTargetDir === 0 && Math.abs(playerVelocity) < 1) playerVelocity = 0; var nextX = player.x + playerVelocity; // Clamp to game area nextX = Math.max(70, Math.min(GAME_WIDTH - 70, nextX)); player.x = nextX; lastTouch.x = player.x; lastTouch.y = player.y; } for (var i = fruits.length - 1; i >= 0; i--) { var fruit = fruits[i]; if (fruit.collected) continue; // Always update fruit fall speed in case it changed (prevents stuck fruits) fruit.fallSpeed = FRUIT_FALL_SPEED; // Move fruit down fruit.lastY = fruit.lastY === undefined ? fruit.y : fruit.lastY; fruit.y += fruit.fallSpeed; // Remove fruit if it falls below the screen (bottom margin) if (fruit.lastY <= GAME_HEIGHT - 120 && fruit.y > GAME_HEIGHT - 120) { if (!fruit.collected) { // Decrease score by 5 if missed score -= 5; if (score < 0) score = 0; updateScore(); // Play pop animation before removing tween(fruit, { scaleX: 1.7, scaleY: 1.7, alpha: 0 }, { duration: 220, easing: tween.cubicIn, onFinish: function onFinish() { fruit.destroy(); } }); // Remove from array for (var j = 0; j < fruits.length; j++) { if (fruits[j] === fruit) { fruits.splice(j, 1); break; } } } // Cancel fruit timeout if (fruit._timeout) LK.clearTimeout(fruit._timeout); continue; } // Check intersection with player if (player.intersects(fruit)) { fruit.collect(function () { // Remove from array for (var j = 0; j < fruits.length; j++) { if (fruits[j] === fruit) { fruits.splice(j, 1); break; } } }); // Cancel fruit timeout if (fruit._timeout) LK.clearTimeout(fruit._timeout); // Add score score += 10; updateScore(); // Win condition removed: no win popup or flash when score reaches WIN_SCORE } fruit.lastY = fruit.y; } }; // On game over or win, cleanup timers game.onDestroy = function () { if (spawnTimer) LK.clearTimeout(spawnTimer); for (var i = 0; i < fruits.length; i++) { if (fruits[i]._timeout) LK.clearTimeout(fruits[i]._timeout); } fruits = []; }; // Initial score updateScore();
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
// Fruit class: represents a collectible fruit
var Fruit = Container.expand(function () {
var self = Container.call(this);
// Randomly pick a fruit image asset for variety
var fruitAssets = ['fruit', 'fruit2', 'fruit3', 'fruit4'];
var fruitAssetId = fruitAssets[Math.floor(Math.random() * fruitAssets.length)];
// Optionally, randomize color for extra variety (if you want to tint, but not required)
// var fruitColors = [0xff3b3b, 0xffe14d, 0x4de14d, 0x4db8ff, 0xff7ff0];
// var color = fruitColors[Math.floor(Math.random() * fruitColors.length)];
// Create fruit image asset
var fruitAsset = self.attachAsset(fruitAssetId, {
width: 120,
height: 120,
anchorX: 0.5,
anchorY: 0.5
});
// Used for animation
self.alpha = 0;
self.scaleX = 0.7;
self.scaleY = 0.7;
// Animate fruit appearing
tween(self, {
alpha: 1,
scaleX: 1,
scaleY: 1
}, {
duration: 200,
easing: tween.easeOut
});
// For tracking if already collected
self.collected = false;
// Destroy with a pop animation
self.collect = function (_onFinish) {
if (self.collected) return;
self.collected = true;
tween(self, {
scaleX: 1.4,
scaleY: 1.4,
alpha: 0
}, {
duration: 180,
easing: tween.easeIn,
onFinish: function onFinish() {
self.destroy();
if (_onFinish) _onFinish();
}
});
};
return self;
});
// Player class: single block basket
var Player = Container.expand(function () {
var self = Container.call(this);
// Basket is a single colored box
var playerAsset = self.attachAsset('player', {
width: 180,
height: 80,
color: 0x3b7fff,
shape: 'box',
anchorX: 0.5,
anchorY: 0.5
});
playerAsset.alpha = 0.7;
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0xf7f7f7
});
/****
* Game Code
****/
// Pause menu round buttons as assets
// Game constants
// Tween plugin for fruit spawn/collect animations
// Second block above start, can use same asset or a new one if desired
var GAME_WIDTH = 2048;
var GAME_HEIGHT = 2732;
var FRUIT_SPAWN_MIN = 900; // ms
var FRUIT_SPAWN_MAX = 1800; // ms
var FRUIT_LIFETIME = 2600; // ms before fruit disappears
var WIN_SCORE = 20;
var FRUIT_FALL_SPEED = 10; // Meyve hızı 10
// Game state
var fruits = [];
var player = null;
var dragNode = null;
var score = 0;
var scoreTxt = null;
var spawnTimer = null;
var fruitSpawnInterval = FRUIT_SPAWN_MAX;
var lastTouch = {
x: GAME_WIDTH / 2,
y: GAME_HEIGHT * 0.8
};
// Set up background color
game.setBackgroundColor(0xf7f7f7);
// --- START SCREEN OVERLAY ---
var startOverlay = new Container();
startOverlay.width = GAME_WIDTH;
startOverlay.height = GAME_HEIGHT;
startOverlay.interactive = true;
// Start screen background image
var startBg = LK.getAsset('startBg', {
anchorX: 0,
anchorY: 0,
x: 0,
y: 0,
width: GAME_WIDTH,
height: GAME_HEIGHT
});
startOverlay.addChild(startBg);
// Semi-transparent background (over the image, for darkening effect)
var overlayBg = LK.getAsset('player', {
width: GAME_WIDTH,
height: GAME_HEIGHT,
color: 0x000000,
shape: 'box',
anchorX: 0,
anchorY: 0,
x: 0,
y: 0
});
overlayBg.alpha = 0.3;
startOverlay.addChild(overlayBg);
// Add a new block at the very top of the start screen
var startTopBlock2 = LK.getAsset('startTopBlock', {
anchorX: 0.5,
anchorY: 0,
x: GAME_WIDTH / 2,
y: 80 // higher than the first block
// Use asset's native size, do not scale or stretch
});
startOverlay.addChild(startTopBlock2);
// Add a new block at the top of the start screen
var startTopBlock = LK.getAsset('startTopBlock', {
anchorX: 0.5,
anchorY: 0,
x: GAME_WIDTH / 2,
y: 200
// Use asset's native size, do not scale or stretch
});
startOverlay.addChild(startTopBlock);
// "Başla" button (centered) - now as a dedicated asset, no text or title
var startBtn = LK.getAsset('startBtn', {
anchorX: 0.5,
anchorY: 0.5,
x: GAME_WIDTH / 2,
y: GAME_HEIGHT / 2
});
startOverlay.addChild(startBtn);
// Settings button (even further below start button, centered)
var settingsBtn = LK.getAsset('settingsBtn', {
anchorX: 0.5,
anchorY: 0.5,
x: GAME_WIDTH / 2,
y: GAME_HEIGHT / 2 + 420 // moved up, now 420px below startBtn
});
startOverlay.addChild(settingsBtn);
// Settings menu overlay (hidden by default, shown as a separate "scene" when settings is pressed)
var settingsMenuOverlay = new Container();
settingsMenuOverlay.width = GAME_WIDTH;
settingsMenuOverlay.height = GAME_HEIGHT;
settingsMenuOverlay.visible = false;
settingsMenuOverlay.interactive = true;
// Full screen background image for settings menu
var settingsMenuBgImage = LK.getAsset('settingsMenuBg', {
anchorX: 0,
anchorY: 0,
x: 0,
y: 0,
width: GAME_WIDTH,
height: GAME_HEIGHT
});
settingsMenuOverlay.addChild(settingsMenuBgImage);
// Semi-transparent overlay for settings menu (for click-to-close)
var settingsMenuBg = LK.getAsset('player', {
width: GAME_WIDTH,
height: GAME_HEIGHT,
color: 0x000000,
shape: 'box',
anchorX: 0,
anchorY: 0,
x: 0,
y: 0
});
settingsMenuBg.alpha = 0.2;
settingsMenuOverlay.addChild(settingsMenuBg);
// Settings menu buttons (centered vertically: top, center, bottom)
var menuBtnSpacing = 340;
var menuBtnYCenter = GAME_HEIGHT / 2;
var menuBtn1 = LK.getAsset('settingsMenuBtn1', {
anchorX: 0.5,
anchorY: 0.5,
x: GAME_WIDTH / 2,
y: menuBtnYCenter - menuBtnSpacing
});
var menuBtn2 = LK.getAsset('settingsMenuBtn2', {
anchorX: 0.5,
anchorY: 0.5,
x: GAME_WIDTH / 2,
y: menuBtnYCenter
});
var menuBtn3 = LK.getAsset('settingsMenuBtn3', {
anchorX: 0.5,
anchorY: 0.5,
x: GAME_WIDTH / 2,
y: menuBtnYCenter + menuBtnSpacing
});
settingsMenuOverlay.addChild(menuBtn1);
settingsMenuOverlay.addChild(menuBtn2);
settingsMenuOverlay.addChild(menuBtn3);
// Hide settings menu when background is pressed
settingsMenuBg.down = function (x, y, obj) {
settingsMenuOverlay.visible = false;
startOverlay.visible = true;
};
// Close menu on any menu button press
menuBtn1.down = function (x, y, obj) {
// Hide settings and start overlays
settingsMenuOverlay.visible = false;
if (startOverlay.parent) startOverlay.parent.removeChild(startOverlay);
// Start the game if not already started
if (!gameStarted) {
gameStarted = true;
showGameElements();
scheduleNextFruit();
} else {
showGameElements();
}
// Show move buttons directly
leftBtn.visible = true;
rightBtn.visible = true;
moveButtonsVisible = true;
};
menuBtn2.down = function (x, y, obj) {
settingsMenuOverlay.visible = false;
startOverlay.visible = true;
};
menuBtn3.down = function (x, y, obj) {
settingsMenuOverlay.visible = false;
startOverlay.visible = true;
};
game.addChild(settingsMenuOverlay);
game.addChild(startOverlay);
// Show settings menu as a separate "scene" when settingsBtn is pressed
settingsBtn.down = function (x, y, obj) {
// Animate settingsBtn shrinking
tween(settingsBtn, {
scaleX: 0.85,
scaleY: 0.85
}, {
duration: 90,
easing: tween.cubicIn,
onFinish: function onFinish() {
tween(settingsBtn, {
scaleX: 0.1,
scaleY: 0.1,
alpha: 0
}, {
duration: 180,
easing: tween.cubicIn,
onFinish: function onFinish() {
// After animation, show settings menu
settingsMenuOverlay.visible = true;
startOverlay.visible = false;
// Hide move buttons when not in game
leftBtn.visible = false;
rightBtn.visible = false;
moveButtonsVisible = false;
// Reset settingsBtn for next time
settingsBtn.scaleX = 1;
settingsBtn.scaleY = 1;
settingsBtn.alpha = 1;
}
});
}
});
};
// --- GAME ELEMENTS (hidden until start) ---
player = new Player();
player.x = GAME_WIDTH / 2;
player.y = GAME_HEIGHT * 0.8;
player.visible = false;
game.addChild(player);
scoreTxt = new Text2('0', {
size: 120,
fill: 0x222222
});
scoreTxt.anchor.set(0.5, 0);
scoreTxt.visible = false;
LK.gui.top.addChild(scoreTxt);
// Add pause button below the score
var pauseBtn = LK.getAsset('player', {
width: 180,
height: 110,
color: 0x888888,
shape: 'box',
anchorX: 0.5,
anchorY: 0,
x: 0,
// will be positioned by container
y: 0
});
var pauseIcon = new Text2('⏸', {
size: 80,
fill: "#fff"
});
pauseIcon.anchor.set(0.5, 0.5);
pauseIcon.x = pauseBtn.width / 2;
pauseIcon.y = pauseBtn.height / 2;
pauseBtn.addChild(pauseIcon);
// Container to position pauseBtn under score
var pauseBtnContainer = new Container();
pauseBtnContainer.addChild(pauseBtn);
pauseBtnContainer.x = 0;
pauseBtnContainer.y = scoreTxt.height + 10; // 10px below score
// Add to GUI, under score
LK.gui.top.addChild(pauseBtnContainer);
// Pause overlay (hidden by default)
var pauseOverlay = new Container();
pauseOverlay.width = GAME_WIDTH;
pauseOverlay.height = GAME_HEIGHT;
pauseOverlay.visible = false;
pauseOverlay.interactive = true;
// Semi-transparent background with blur
var pauseBg = LK.getAsset('player', {
width: GAME_WIDTH,
height: GAME_HEIGHT,
color: 0x000000,
shape: 'box',
anchorX: 0,
anchorY: 0,
x: 0,
y: 0
});
pauseBg.alpha = 0.10;
pauseOverlay.addChild(pauseBg);
// Add a blur effect to the overlay (simulate with a blurred asset if available, or just comment for now)
// If LK.effects.blurScreen existed, we would use it. For now, we note the intent.
// LK.effects.blurScreen(10); // Not available, so just use alpha
// Add three round (ellipse) buttons to pause overlay
var pauseButtonSpacing = 340;
var pauseButtonYCenter = GAME_HEIGHT / 2;
var pauseBtnRadius = 220;
// 1. Devam Et (Continue) round button
var pauseContinueRoundBtn = LK.getAsset('fruit', {
width: pauseBtnRadius,
height: pauseBtnRadius,
color: 0x4db8ff,
shape: 'ellipse',
anchorX: 0.5,
anchorY: 0.5,
x: GAME_WIDTH / 2,
y: pauseButtonYCenter - pauseButtonSpacing
});
pauseOverlay.addChild(pauseContinueRoundBtn);
// 2. Başa Dön (Restart) round button
var pauseRestartRoundBtn = LK.getAsset('fruit', {
width: pauseBtnRadius,
height: pauseBtnRadius,
color: 0xffe14d,
shape: 'ellipse',
anchorX: 0.5,
anchorY: 0.5,
x: GAME_WIDTH / 2,
y: pauseButtonYCenter
});
pauseOverlay.addChild(pauseRestartRoundBtn);
// 3. Ayarlar (Settings) round button
var pauseSettingsRoundBtn = LK.getAsset('fruit', {
width: pauseBtnRadius,
height: pauseBtnRadius,
color: 0xff7ff0,
shape: 'ellipse',
anchorX: 0.5,
anchorY: 0.5,
x: GAME_WIDTH / 2,
y: pauseButtonYCenter + pauseButtonSpacing
});
pauseOverlay.addChild(pauseSettingsRoundBtn);
// Button logic (same as before)
pauseContinueRoundBtn.down = function (x, y, obj) {
pauseOverlay.visible = false;
showGameElements();
};
pauseRestartRoundBtn.down = function (x, y, obj) {
// Return to start: show start overlay, hide pause overlay, reset game state
pauseOverlay.visible = false;
if (!startOverlay.parent) game.addChild(startOverlay);
hideGameElements();
gameStarted = false;
// Clean up fruits and timers
if (spawnTimer) LK.clearTimeout(spawnTimer);
for (var i = 0; i < fruits.length; i++) {
if (fruits[i]._timeout) LK.clearTimeout(fruits[i]._timeout);
fruits[i].destroy();
}
fruits = [];
score = 0;
updateScore();
player.x = GAME_WIDTH / 2;
player.y = GAME_HEIGHT * 0.8;
};
pauseSettingsRoundBtn.down = function (x, y, obj) {
pauseOverlay.visible = false;
settingsMenuOverlay.visible = true;
startOverlay.visible = false;
leftBtn.visible = false;
rightBtn.visible = false;
moveButtonsVisible = false;
};
// Add overlay to game
game.addChild(pauseOverlay);
// Pause button logic: show pause overlay, hide game elements
pauseBtn.down = function (x, y, obj) {
hideGameElements();
pauseOverlay.visible = true;
};
pauseBtn.visible = false;
// --- Add left/right move buttons, initially hidden, and a toggle button at top right ---
// Button sizes and positions are optimized for mobile (large touch targets, no overlap with menu)
var buttonSize = 260;
var buttonMargin = 120;
var buttonY = GAME_HEIGHT - buttonSize - 60;
// Toggle button (top right, avoid top left 100x100 and right edge)
var toggleBtnSize = 120;
var toggleBtn = LK.getAsset('player', {
width: toggleBtnSize,
height: toggleBtnSize,
color: 0x222222,
shape: 'box',
anchorX: 0.5,
anchorY: 0.5,
x: GAME_WIDTH - 100 - toggleBtnSize / 2 - 20,
// right margin, avoid top right 100x100
y: 100 / 2 + 20
});
var toggleIcon = new Text2('☰', {
size: 80,
fill: "#fff"
});
toggleIcon.anchor.set(0.5, 0.5);
toggleIcon.x = toggleBtn.width / 2;
toggleIcon.y = toggleBtn.height / 2;
toggleBtn.addChild(toggleIcon);
toggleBtn.visible = false;
game.addChild(toggleBtn);
// Left button (bottom left, above safe margin)
var leftBtn = LK.getAsset('player', {
width: buttonSize,
height: buttonSize,
color: 0x3b7fff,
shape: 'box',
anchorX: 0.5,
anchorY: 0.5,
x: buttonMargin + buttonSize / 2,
y: buttonY
});
var leftArrow = new Text2('◀', {
size: 180,
fill: "#fff"
});
leftArrow.anchor.set(0.5, 0.5);
leftArrow.x = leftBtn.width / 2;
leftArrow.y = leftBtn.height / 2;
leftBtn.addChild(leftArrow);
leftBtn.visible = false;
// Right button (bottom right, above safe margin)
var rightBtn = LK.getAsset('player', {
width: buttonSize,
height: buttonSize,
color: 0x3b7fff,
shape: 'box',
anchorX: 0.5,
anchorY: 0.5,
x: GAME_WIDTH - buttonMargin - buttonSize / 2,
y: buttonY
});
var rightArrow = new Text2('▶', {
size: 180,
fill: "#fff"
});
rightArrow.anchor.set(0.5, 0.5);
rightArrow.x = rightBtn.width / 2;
rightArrow.y = rightBtn.height / 2;
rightBtn.addChild(rightArrow);
rightBtn.visible = false;
game.addChild(leftBtn);
game.addChild(rightBtn);
// Toggle logic
var moveButtonsVisible = false;
toggleBtn.down = function (x, y, obj) {
moveButtonsVisible = !moveButtonsVisible;
leftBtn.visible = moveButtonsVisible;
rightBtn.visible = moveButtonsVisible;
};
// --- START BUTTON LOGIC ---
function showGameElements() {
player.visible = true;
scoreTxt.visible = true;
toggleBtn.visible = true;
pauseBtn.visible = true;
// Hide pause overlay if visible
if (typeof pauseOverlay !== "undefined") pauseOverlay.visible = false;
// Move buttons are only visible if toggled, but always hidden at game start
leftBtn.visible = false;
rightBtn.visible = false;
moveButtonsVisible = false;
}
function hideGameElements() {
player.visible = false;
scoreTxt.visible = false;
toggleBtn.visible = false;
pauseBtn.visible = false;
leftBtn.visible = false;
rightBtn.visible = false;
moveButtonsVisible = false;
// Hide pause overlay if visible
if (typeof pauseOverlay !== "undefined") pauseOverlay.visible = false;
}
// When start is pressed, remove overlay and show game elements, start fruit spawning
var gameStarted = false;
startBtn.down = function (x, y, obj) {
if (gameStarted) return;
gameStarted = true;
// Animate startBtn shrinking
tween(startBtn, {
scaleX: 0.85,
scaleY: 0.85
}, {
duration: 90,
easing: tween.cubicIn,
onFinish: function onFinish() {
tween(startBtn, {
scaleX: 0.1,
scaleY: 0.1,
alpha: 0
}, {
duration: 180,
easing: tween.cubicIn,
onFinish: function onFinish() {
// Animate startTopBlock as before
tween(startTopBlock, {
scaleX: 0.1,
scaleY: 0.1,
alpha: 0
}, {
duration: 220,
easing: tween.cubicIn,
onFinish: function onFinish() {
if (startOverlay.parent) startOverlay.parent.removeChild(startOverlay);
showGameElements();
scheduleNextFruit();
}
});
}
});
}
});
};
hideGameElements();
// Button press logic
var moveBtnInterval = null;
// Pürüzsüz hareket için hız ve hedef yön
var MOVE_SPEED = 32; // px/frame, pürüzsüz hız (20'den biraz daha hızlı, ayarlanabilir)
var playerVelocity = 0;
var playerTargetDir = 0; // -1: sola, 1: sağa, 0: dur
// Sepet hızlandırma için çarpan (her 50'de %5 artar)
var playerSpeedMultiplier = 1;
var lastSpeedupScore = 0;
// Touch/hold left
leftBtn.down = function (x, y, obj) {
if (!leftBtn.visible) return;
playerTargetDir = -1;
};
leftBtn.up = function (x, y, obj) {
if (playerTargetDir === -1) playerTargetDir = 0;
};
// Touch/hold right
rightBtn.down = function (x, y, obj) {
if (!rightBtn.visible) return;
playerTargetDir = 1;
};
rightBtn.up = function (x, y, obj) {
if (playerTargetDir === 1) playerTargetDir = 0;
};
// Helper: update score display
function updateScore() {
scoreTxt.setText(score);
}
// Helper: spawn a fruit at a random X position at the top, and make it fall down
function spawnFruit() {
// Avoid top 100px (menu), and bottom 200px (player area)
var margin = 140;
var minX = margin;
var maxX = GAME_WIDTH - margin;
var fruit = new Fruit();
fruit.x = Math.floor(Math.random() * (maxX - minX)) + minX;
fruit.y = 120; // Always spawn at the top
// All fruits have the same fall speed, controlled by a single variable
fruit.fallSpeed = FRUIT_FALL_SPEED;
// Track lastY for good practice
fruit.lastY = fruit.y;
fruits.push(fruit);
game.addChild(fruit);
// Fruit will only be removed if collected or falls below the screen
}
// Helper: schedule next fruit spawn, with increasing speed
function scheduleNextFruit() {
if (!gameStarted) return;
// As score increases, spawn interval decreases
var minInterval = FRUIT_SPAWN_MIN;
var maxInterval = FRUIT_SPAWN_MAX;
var progress = Math.min(score / WIN_SCORE, 1);
fruitSpawnInterval = maxInterval - (maxInterval - minInterval) * progress;
var nextIn = Math.floor(fruitSpawnInterval * (0.7 + Math.random() * 0.6)); // randomize a bit
spawnTimer = LK.setTimeout(function () {
if (!gameStarted) return;
spawnFruit();
scheduleNextFruit();
}, nextIn);
}
// Dragging logic
game.down = function (x, y, obj) {
if (!gameStarted) return;
// Only start drag if touch is on player (or close to it)
var dx = x - player.x;
var dy = y - player.y;
var dist = Math.sqrt(dx * dx + dy * dy);
if (dist < 120) {
dragNode = player;
lastTouch.x = x;
lastTouch.y = y;
}
};
game.move = function (x, y, obj) {
if (!gameStarted) return;
if (dragNode === player) {
// Allow player to move only in X direction, clamp within game area
var moveMultiplier = playerSpeedMultiplier;
var px = Math.max(70, Math.min(GAME_WIDTH - 70, x));
// Stop any previous tween on player.x to avoid stacking
tween.stop(player, {
x: true
});
tween(player, {
x: px
}, {
duration: Math.round(90 / 1.3) / moveMultiplier,
// 30% faster
easing: tween.cubicOut
});
// Y stays fixed at initial position (bottom 20% of screen)
lastTouch.x = px;
lastTouch.y = player.y;
}
};
game.up = function (x, y, obj) {
if (!gameStarted) return;
dragNode = null;
};
// Main update loop: check for fruit collection
game.update = function () {
if (!gameStarted) return;
if (pauseOverlay.visible) return;
// FRUIT_FALL_SPEED is now handled by 100s logic above, no need to reset here
// Pürüzsüz sepet hareketi
if (!dragNode) {
// Her +100'de bir %3 hızlandır (örn: 100, 200, 300, ...), ve bunu her zaman uygula
if (Math.floor(score / 100) > Math.floor(lastSpeedupScore / 100)) {
var speedupSteps = Math.floor(score / 100) - Math.floor(lastSpeedupScore / 100);
for (var s = 0; s < speedupSteps; s++) {
playerSpeedMultiplier *= 1.03;
FRUIT_FALL_SPEED *= 1.03;
}
lastSpeedupScore = Math.floor(score / 100) * 100;
}
// Sadece butonla hareket ediyorsa
var moveMultiplier = playerSpeedMultiplier;
// Hedef hıza doğru yumuşak geçiş (smooth acceleration)
var targetVelocity = playerTargetDir * MOVE_SPEED * moveMultiplier;
// Linear interpolation (lerp) ile hız geçişi
playerVelocity += (targetVelocity - playerVelocity) * 0.22;
// Eğer hedef durmaksa, yavaşça sıfıra yaklaşsın
if (playerTargetDir === 0 && Math.abs(playerVelocity) < 1) playerVelocity = 0;
var nextX = player.x + playerVelocity;
// Clamp to game area
nextX = Math.max(70, Math.min(GAME_WIDTH - 70, nextX));
player.x = nextX;
lastTouch.x = player.x;
lastTouch.y = player.y;
}
for (var i = fruits.length - 1; i >= 0; i--) {
var fruit = fruits[i];
if (fruit.collected) continue;
// Always update fruit fall speed in case it changed (prevents stuck fruits)
fruit.fallSpeed = FRUIT_FALL_SPEED;
// Move fruit down
fruit.lastY = fruit.lastY === undefined ? fruit.y : fruit.lastY;
fruit.y += fruit.fallSpeed;
// Remove fruit if it falls below the screen (bottom margin)
if (fruit.lastY <= GAME_HEIGHT - 120 && fruit.y > GAME_HEIGHT - 120) {
if (!fruit.collected) {
// Decrease score by 5 if missed
score -= 5;
if (score < 0) score = 0;
updateScore();
// Play pop animation before removing
tween(fruit, {
scaleX: 1.7,
scaleY: 1.7,
alpha: 0
}, {
duration: 220,
easing: tween.cubicIn,
onFinish: function onFinish() {
fruit.destroy();
}
});
// Remove from array
for (var j = 0; j < fruits.length; j++) {
if (fruits[j] === fruit) {
fruits.splice(j, 1);
break;
}
}
}
// Cancel fruit timeout
if (fruit._timeout) LK.clearTimeout(fruit._timeout);
continue;
}
// Check intersection with player
if (player.intersects(fruit)) {
fruit.collect(function () {
// Remove from array
for (var j = 0; j < fruits.length; j++) {
if (fruits[j] === fruit) {
fruits.splice(j, 1);
break;
}
}
});
// Cancel fruit timeout
if (fruit._timeout) LK.clearTimeout(fruit._timeout);
// Add score
score += 10;
updateScore();
// Win condition removed: no win popup or flash when score reaches WIN_SCORE
}
fruit.lastY = fruit.y;
}
};
// On game over or win, cleanup timers
game.onDestroy = function () {
if (spawnTimer) LK.clearTimeout(spawnTimer);
for (var i = 0; i < fruits.length; i++) {
if (fruits[i]._timeout) LK.clearTimeout(fruits[i]._timeout);
}
fruits = [];
};
// Initial score
updateScore();
Start button . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
Settings button. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
Left right button. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
A hand. In-Game asset. High contrast. No shadows. 2 d
Between two button a hand. In-Game asset. 2d. High contrast. No shadows
A farm. In-Game asset. 2d. High contrast. No shadows
Left button. In-Game asset. 2d. High contrast. No shadows
Devam et. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
Basket. In-Game asset. 2d. High contrast. No shadows
Banana. In-Game asset. 2d. High contrast. No shadows
Left button. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
Apple. In-Game asset. 2d. High contrast. No shadows
Grape. In-Game asset. 2d. High contrast. No shadows
Potato. In-Game asset. 2d. High contrast. No shadows