User prompt
Butonlar sadece oyunda gözüksün
User prompt
settingsMenuBtn1 basınca oyundaki sağ sol butonları açılsın
User prompt
Azalt
User prompt
Arka plan opakligini düşür
User prompt
Opacity Do 100
User prompt
Arttır
User prompt
Arka plan opak ligini artır
User prompt
Settings sahnesinin arkasına tüm ekranı kaplayacak bir arkaplan ekle ve bunu asseste ekle
User prompt
Settings basınca başka bir shanede üç buton olsun
User prompt
Biraz yukarıda çok az
User prompt
Biraz daha aşağıda
User prompt
Ayarlar butonunu biraz daha aşağıya indir
User prompt
Start butonunun altinda ayarlar butonu olsun ona basınca üç tane buton çıksın üste ortada ve alta ve bunları aseste ekle
User prompt
Başlama ekraninda sadece buton olsun yazı olmasın ve butonu asest olarak ekle
User prompt
Bir başlama ekranı olsun ve ortada starta basınca oyun başlasın
User prompt
Mobil için olsun
User prompt
Sepet smooth hareket etsin
User prompt
Sepet pürüzsüz hareket etsin
User prompt
Sağ üst köşede olsun
User prompt
Sepet elle sağa ve solla gidebilsin sol üst köşeye bir buton koy o butona basınca sağ sol butonları açılsın
User prompt
Sepet hızını 20 yap
User prompt
Sepeti çok hızlı yap
User prompt
Sepet çok yavaş hızlandır
User prompt
En başta sepet hızı 1 olsun ve meyve hızı 2 olsun
User prompt
Kazanma olmasın
/**** * 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 color for variety var fruitColors = [0xff3b3b, 0xffe14d, 0x4de14d, 0x4db8ff, 0xff7ff0]; var color = fruitColors[Math.floor(Math.random() * fruitColors.length)]; // Create a simple ellipse as fruit var fruitAsset = self.attachAsset('fruit', { width: 120, height: 120, color: color, shape: 'ellipse', 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: draggable character var Player = Container.expand(function () { var self = Container.call(this); // Character is a colored box var playerAsset = self.attachAsset('player', { width: 140, height: 140, color: 0x3b7fff, shape: 'box', anchorX: 0.5, anchorY: 0.5 }); // For a little style, add a face (ellipse for head, two eyes) var face = self.attachAsset('face', { width: 80, height: 80, color: 0xfffbe0, shape: 'ellipse', anchorX: 0.5, anchorY: 0.5, x: 0, y: -10 }); var eyeL = self.attachAsset('eyeL', { width: 12, height: 12, color: 0x222222, shape: 'ellipse', anchorX: 0.5, anchorY: 0.5, x: -18, y: -18 }); var eyeR = self.attachAsset('eyeR', { width: 12, height: 12, color: 0x222222, shape: 'ellipse', anchorX: 0.5, anchorY: 0.5, x: 18, y: -18 }); return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0xf7f7f7 }); /**** * Game Code ****/ // Game constants // Tween plugin for fruit spawn/collect animations 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 = 2; // Meyve hızı 2 // 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); // Create and position player player = new Player(); player.x = GAME_WIDTH / 2; player.y = GAME_HEIGHT * 0.8; game.addChild(player); // Score text scoreTxt = new Text2('0', { size: 120, fill: 0x222222 }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // --- Add left/right move buttons, initially hidden, and a toggle button at top left --- var buttonSize = 220; var buttonMargin = 80; var buttonY = GAME_HEIGHT - buttonSize - 80; // Toggle button (top left, 100x100 area reserved for menu, so offset a bit) var toggleBtnSize = 120; var toggleBtn = LK.getAsset('player', { width: toggleBtnSize, height: toggleBtnSize, color: 0x222222, shape: 'box', anchorX: 0.5, anchorY: 0.5, x: 100 + toggleBtnSize / 2 + 20, // avoid top left 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); game.addChild(toggleBtn); // Left button 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: 160, fill: "#fff" }); leftArrow.anchor.set(0.5, 0.5); leftArrow.x = leftBtn.width / 2; leftArrow.y = leftBtn.height / 2; leftBtn.addChild(leftArrow); // Right button 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: 160, fill: "#fff" }); rightArrow.anchor.set(0.5, 0.5); rightArrow.x = rightBtn.width / 2; rightArrow.y = rightBtn.height / 2; rightBtn.addChild(rightArrow); // Add to game, but start hidden leftBtn.visible = false; 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; }; // Button press logic var moveBtnInterval = null; var MOVE_STEP = 20.0; // Sepet hareket hızı çok çok hızlı (20.0) var MOVE_INTERVAL = 36; // Varsayılan interval (daha yavaş hareket için) function movePlayerDir(dir) { var moveMultiplier = score >= 50 ? 2 : 1; var px = Math.max(70, Math.min(GAME_WIDTH - 70, player.x + dir * MOVE_STEP * moveMultiplier)); // Stop any previous tween on player.x to avoid stacking tween.stop(player, { x: true }); tween(player, { x: px }, { duration: Math.round(180 / 1.3) / moveMultiplier, // 30% faster easing: tween.cubicOut }); lastTouch.x = px; lastTouch.y = player.y; } // Touch/hold left leftBtn.down = function (x, y, obj) { if (!leftBtn.visible) return; movePlayerDir(-1); if (moveBtnInterval) LK.clearInterval(moveBtnInterval); moveBtnInterval = LK.setInterval(function () { movePlayerDir(-1); }, MOVE_INTERVAL); }; leftBtn.up = function (x, y, obj) { if (moveBtnInterval) LK.clearInterval(moveBtnInterval); moveBtnInterval = null; }; // Touch/hold right rightBtn.down = function (x, y, obj) { if (!rightBtn.visible) return; movePlayerDir(1); if (moveBtnInterval) LK.clearInterval(moveBtnInterval); moveBtnInterval = LK.setInterval(function () { movePlayerDir(1); }, MOVE_INTERVAL); }; rightBtn.up = function (x, y, obj) { if (moveBtnInterval) LK.clearInterval(moveBtnInterval); moveBtnInterval = null; }; // 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() { // 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 () { spawnFruit(); scheduleNextFruit(); }, nextIn); } // Start spawning fruits scheduleNextFruit(); // Dragging logic game.down = function (x, y, obj) { // 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 (dragNode === player) { // Allow player to move only in X direction, clamp within game area var moveMultiplier = score >= 50 ? 2 : 1; 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) { dragNode = null; }; // Main update loop: check for fruit collection game.update = function () { // Update fruit fall speed if score >= 50 if (score >= 50) { FRUIT_FALL_SPEED = 24; } else { FRUIT_FALL_SPEED = 12; } for (var i = fruits.length - 1; i >= 0; i--) { var fruit = fruits[i]; if (fruit.collected) continue; // 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(); 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); 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();
===================================================================
--- original.js
+++ change.js
@@ -145,12 +145,34 @@
fill: 0x222222
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
-// --- Add left/right move buttons ---
+// --- Add left/right move buttons, initially hidden, and a toggle button at top left ---
var buttonSize = 220;
var buttonMargin = 80;
var buttonY = GAME_HEIGHT - buttonSize - 80;
+// Toggle button (top left, 100x100 area reserved for menu, so offset a bit)
+var toggleBtnSize = 120;
+var toggleBtn = LK.getAsset('player', {
+ width: toggleBtnSize,
+ height: toggleBtnSize,
+ color: 0x222222,
+ shape: 'box',
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: 100 + toggleBtnSize / 2 + 20,
+ // avoid top left 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);
+game.addChild(toggleBtn);
// Left button
var leftBtn = LK.getAsset('player', {
width: buttonSize,
height: buttonSize,
@@ -187,11 +209,20 @@
rightArrow.anchor.set(0.5, 0.5);
rightArrow.x = rightBtn.width / 2;
rightArrow.y = rightBtn.height / 2;
rightBtn.addChild(rightArrow);
-// Add to game
+// Add to game, but start hidden
+leftBtn.visible = false;
+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;
+};
// Button press logic
var moveBtnInterval = null;
var MOVE_STEP = 20.0; // Sepet hareket hızı çok çok hızlı (20.0)
var MOVE_INTERVAL = 36; // Varsayılan interval (daha yavaş hareket için)
@@ -213,8 +244,9 @@
lastTouch.y = player.y;
}
// Touch/hold left
leftBtn.down = function (x, y, obj) {
+ if (!leftBtn.visible) return;
movePlayerDir(-1);
if (moveBtnInterval) LK.clearInterval(moveBtnInterval);
moveBtnInterval = LK.setInterval(function () {
movePlayerDir(-1);
@@ -225,8 +257,9 @@
moveBtnInterval = null;
};
// Touch/hold right
rightBtn.down = function (x, y, obj) {
+ if (!rightBtn.visible) return;
movePlayerDir(1);
if (moveBtnInterval) LK.clearInterval(moveBtnInterval);
moveBtnInterval = LK.setInterval(function () {
movePlayerDir(1);
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