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 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 ****/ // Tween plugin for fruit spawn/collect animations // Game constants 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; // 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); // Helper: update score display function updateScore() { scoreTxt.setText(score); } // Helper: spawn a fruit at a random position function spawnFruit() { // Avoid top 100px (menu), and bottom 200px (player area) var margin = 140; var minY = 120; var maxY = GAME_HEIGHT - 400; var minX = margin; var maxX = GAME_WIDTH - margin; var fruit = new Fruit(); fruit.x = Math.floor(Math.random() * (maxX - minX)) + minX; fruit.y = Math.floor(Math.random() * (maxY - minY)) + minY; fruits.push(fruit); game.addChild(fruit); // Remove fruit after lifetime if not collected fruit._timeout = LK.setTimeout(function () { if (!fruit.collected) { fruit.collect(function () { // Remove from array for (var i = 0; i < fruits.length; i++) { if (fruits[i] === fruit) { fruits.splice(i, 1); break; } } }); } }, FRUIT_LIFETIME); } // 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) { // Clamp player inside game area var px = Math.max(70, Math.min(GAME_WIDTH - 70, x)); var py = Math.max(GAME_HEIGHT * 0.2, Math.min(GAME_HEIGHT - 70, y)); player.x = px; player.y = py; lastTouch.x = px; lastTouch.y = py; } }; game.up = function (x, y, obj) { dragNode = null; }; // Main update loop: check for fruit collection game.update = function () { for (var i = fruits.length - 1; i >= 0; i--) { var fruit = fruits[i]; if (fruit.collected) 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 += 1; updateScore(); // Win condition if (score >= WIN_SCORE) { // Flash green, show win LK.effects.flashScreen(0x44ff44, 800); LK.showYouWin(); return; } } } }; // 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
@@ -1,6 +1,261 @@
-/****
+/****
+* 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: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0xf7f7f7
+});
+
+/****
+* Game Code
+****/
+// Tween plugin for fruit spawn/collect animations
+// Game constants
+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;
+// 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);
+// Helper: update score display
+function updateScore() {
+ scoreTxt.setText(score);
+}
+// Helper: spawn a fruit at a random position
+function spawnFruit() {
+ // Avoid top 100px (menu), and bottom 200px (player area)
+ var margin = 140;
+ var minY = 120;
+ var maxY = GAME_HEIGHT - 400;
+ var minX = margin;
+ var maxX = GAME_WIDTH - margin;
+ var fruit = new Fruit();
+ fruit.x = Math.floor(Math.random() * (maxX - minX)) + minX;
+ fruit.y = Math.floor(Math.random() * (maxY - minY)) + minY;
+ fruits.push(fruit);
+ game.addChild(fruit);
+ // Remove fruit after lifetime if not collected
+ fruit._timeout = LK.setTimeout(function () {
+ if (!fruit.collected) {
+ fruit.collect(function () {
+ // Remove from array
+ for (var i = 0; i < fruits.length; i++) {
+ if (fruits[i] === fruit) {
+ fruits.splice(i, 1);
+ break;
+ }
+ }
+ });
+ }
+ }, FRUIT_LIFETIME);
+}
+// 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) {
+ // Clamp player inside game area
+ var px = Math.max(70, Math.min(GAME_WIDTH - 70, x));
+ var py = Math.max(GAME_HEIGHT * 0.2, Math.min(GAME_HEIGHT - 70, y));
+ player.x = px;
+ player.y = py;
+ lastTouch.x = px;
+ lastTouch.y = py;
+ }
+};
+game.up = function (x, y, obj) {
+ dragNode = null;
+};
+// Main update loop: check for fruit collection
+game.update = function () {
+ for (var i = fruits.length - 1; i >= 0; i--) {
+ var fruit = fruits[i];
+ if (fruit.collected) 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 += 1;
+ updateScore();
+ // Win condition
+ if (score >= WIN_SCORE) {
+ // Flash green, show win
+ LK.effects.flashScreen(0x44ff44, 800);
+ LK.showYouWin();
+ return;
+ }
+ }
+ }
+};
+// 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();
\ No newline at end of file
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