User prompt
bomba assetini 2 kat büyüt
User prompt
play assetini iki kat büyüt ve biraz aşağı kaydır
User prompt
play asseti yerine by furkan asseti var
User prompt
o zaman şöyle yapalım oyun önce hemen açılmasın önce bir ana menüde play butonu olsun ve buna basınca oyun başlasın ve ana menüde top score da yazsın
User prompt
top score sayacı görünmüyor
User prompt
top score yazısını daha kalın yap ve sağ üste koy
User prompt
top score yazısını siyah yap
User prompt
bir puan sistemi de ekleyelim kesilen her meyve 10 puan getirsin 2 li kombolarda değer 2 kat artar ve 3 lü komboda da aynı şekilde en yüksek yapılan puan için de yukarıya bir sayaç yap
User prompt
arka plan bütün ekranı doldurmalı
User prompt
bazı meyveler sağa ya da sola kaçıyor düzelt
User prompt
tüm meyveleri iki kat büyüt
User prompt
delete fuse asset
User prompt
meyveler için asset ekle
User prompt
çok güzel oldu
Code edit (1 edits merged)
Please save this source code
User prompt
Ninja Fruit Slice
Initial prompt
ninja fruit oyununu yapalım gerçek ninja fruite benzesin farklı meyveler de olsun arka planı da değiştirmek içib bir assetimiz olsun
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ // Bomb class: Represents a bomb flying through the air var Bomb = Container.expand(function () { var self = Container.call(this); self.sliced = false; self.missed = false; // Attach bomb asset (black ellipse) var bombAsset = self.attachAsset('bomb', { anchorX: 0.5, anchorY: 0.5, width: 160, height: 160, color: 0x222222, shape: 'ellipse' }); // Add a white "fuse" (small rectangle) var fuse = self.attachAsset('fuse', { anchorX: 0.5, anchorY: 1, width: 20, height: 50, color: 0xffffff, shape: 'box', y: -80 }); // Set initial position and velocity (to be set by spawner) self.x = 0; self.y = 0; self.vx = 0; self.vy = 0; self.gravity = 0.35 + Math.random() * 0.1; self.lastY = self.y; self.update = function () { if (self.sliced) return; self.x += self.vx; self.y += self.vy; self.vy += self.gravity; bombAsset.rotation += 0.09; if (!self.missed && self.y > 2732 + 100) { self.missed = true; } }; self.slice = function () { if (self.sliced) return; self.sliced = true; // Animate: flash red and fade out tween(self, { scaleX: 1.7, scaleY: 1.7, alpha: 0 }, { duration: 250, easing: tween.easeOut, onFinish: function onFinish() { self.destroy(); } }); }; return self; }); // Fruit class: Represents a fruit flying through the air var Fruit = Container.expand(function () { var self = Container.call(this); // Fruit types and their properties var fruitTypes = [{ id: 'apple', color: 0xff2d2d, points: 1 }, { id: 'banana', color: 0xfff700, points: 2 }, { id: 'orange', color: 0xffa500, points: 3 }, { id: 'watermelon', color: 0x2ecc40, points: 5 }, { id: 'grape', color: 0x8e44ad, points: 4 }]; // Randomly pick a fruit type var typeIndex = Math.floor(Math.random() * fruitTypes.length); var type = fruitTypes[typeIndex]; self.fruitType = type.id; self.points = type.points; self.sliced = false; self.missed = false; // Attach fruit asset (ellipse for fruit) var fruitAsset = self.attachAsset(type.id, { anchorX: 0.5, anchorY: 0.5, width: 160, height: 160, color: type.color, shape: 'ellipse' }); // Give fruit a random initial rotation fruitAsset.rotation = Math.random() * Math.PI * 2; // Set initial position and velocity (to be set by spawner) self.x = 0; self.y = 0; self.vx = 0; self.vy = 0; self.gravity = 0.35 + Math.random() * 0.1; // For tracking if fruit is out of bounds self.lastY = self.y; // For combo detection self.sliceTick = -1; // Animate fruit (arc trajectory) self.update = function () { if (self.sliced) return; // Don't update if already sliced self.x += self.vx; self.y += self.vy; self.vy += self.gravity; // Spin fruit fruitAsset.rotation += 0.07; // If fruit falls below screen, mark as missed if (!self.missed && self.y > 2732 + 100) { self.missed = true; } }; // Slice the fruit self.slice = function () { if (self.sliced) return; self.sliced = true; // Animate: scale up and fade out tween(self, { scaleX: 1.5, scaleY: 1.5, alpha: 0 }, { duration: 350, easing: tween.easeOut, onFinish: function onFinish() { self.destroy(); } }); }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x222a36 }); /**** * Game Code ****/ // --- GLOBALS --- var fruits = []; var bombs = []; var missedFruits = 0; var maxMissed = 3; var comboWindow = 20; // ticks for combo var lastSliceTick = -100; var comboCount = 0; var backgroundIndex = 0; var backgrounds = [{ id: 'bg1', color: 0x222a36 }, { id: 'bg2', color: 0x1a3d2f }, { id: 'bg3', color: 0x3d1a2f }]; // --- GUI Elements --- // Score text var scoreTxt = new Text2('0', { size: 120, fill: "#fff" }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // Missed fruits indicator (bottom left, red X's) var missedTxt = new Text2('', { size: 90, fill: 0xFF4444 }); missedTxt.anchor.set(0, 1); LK.gui.bottomLeft.addChild(missedTxt); // Combo text (center, fades out) var comboTxt = new Text2('', { size: 180, fill: 0xFFE066 }); comboTxt.anchor.set(0.5, 0.5); comboTxt.alpha = 0; LK.gui.center.addChild(comboTxt); // Background switch button (bottom right) var bgBtn = LK.getAsset('bgBtn', { anchorX: 1, anchorY: 1, width: 180, height: 100, color: 0x8888ff, shape: 'box' }); bgBtn.x = 0; bgBtn.y = 0; LK.gui.bottomRight.addChild(bgBtn); var bgBtnTxt = new Text2('BG', { size: 60, fill: "#fff" }); bgBtnTxt.anchor.set(0.5, 0.5); bgBtnTxt.x = -90; bgBtnTxt.y = -50; LK.gui.bottomRight.addChild(bgBtnTxt); // --- BACKGROUND --- function setBackground(idx) { backgroundIndex = idx % backgrounds.length; game.setBackgroundColor(backgrounds[backgroundIndex].color); } setBackground(0); // --- FRUIT & BOMB SPAWNING --- function spawnFruitOrBomb() { // Randomly decide: 80% fruit, 20% bomb var isBomb = Math.random() < 0.2; var obj; var x = 200 + Math.random() * (2048 - 400); var y = 2732 + 80; var angle = -Math.PI / 2 + (Math.random() - 0.5) * (Math.PI / 3); // Upwards, with some spread var speed = 38 + Math.random() * 10; if (isBomb) { obj = new Bomb(); bombs.push(obj); } else { obj = new Fruit(); fruits.push(obj); } obj.x = x; obj.y = y; obj.vx = Math.cos(angle) * speed; obj.vy = Math.sin(angle) * speed; game.addChild(obj); } // --- GAME LOGIC --- // Slicing logic: track swipe path and check for intersection var swipePath = []; var swipeMaxLength = 8; // Only keep last 8 points function handleSlice(x, y) { // Check fruits for (var i = fruits.length - 1; i >= 0; i--) { var fruit = fruits[i]; if (fruit.sliced) continue; // If swipe is close to fruit center (distance < 120) var dx = fruit.x - x; var dy = fruit.y - y; if (dx * dx + dy * dy < 120 * 120) { fruit.slice(); LK.setScore(LK.getScore() + fruit.points); scoreTxt.setText(LK.getScore()); fruit.sliceTick = LK.ticks; // Combo logic if (lastSliceTick > 0 && LK.ticks - lastSliceTick < comboWindow) { comboCount++; showCombo(comboCount); } else { comboCount = 1; } lastSliceTick = LK.ticks; } } // Check bombs for (var j = bombs.length - 1; j >= 0; j--) { var bomb = bombs[j]; if (bomb.sliced) continue; var dx = bomb.x - x; var dy = bomb.y - y; if (dx * dx + dy * dy < 120 * 120) { bomb.slice(); // Game over LK.effects.flashScreen(0xff0000, 800); LK.showGameOver(); return; } } } // Show combo text function showCombo(count) { if (count < 2) return; comboTxt.setText('Combo x' + count + '!'); comboTxt.alpha = 1; tween(comboTxt, { alpha: 0 }, { duration: 900, easing: tween.linear }); } // Update missed fruits display function updateMissed() { var s = ''; for (var i = 0; i < missedFruits; i++) s += '✗ '; missedTxt.setText(s); } // --- INPUT HANDLING --- // Swiping: track move events, draw path, and slice game.move = function (x, y, obj) { // Don't allow swipes in top left 100x100 if (x < 100 && y < 100) return; // Add to swipe path swipePath.push({ x: x, y: y, tick: LK.ticks }); if (swipePath.length > swipeMaxLength) swipePath.shift(); // For each point in swipe path, check for slicing for (var i = 0; i < swipePath.length; i++) { handleSlice(swipePath[i].x, swipePath[i].y); } }; // On down, start new swipe game.down = function (x, y, obj) { swipePath = [{ x: x, y: y, tick: LK.ticks }]; handleSlice(x, y); }; // On up, clear swipe path game.up = function (x, y, obj) { swipePath = []; }; // Background button: tap to change background bgBtn.down = function (x, y, obj) { setBackground((backgroundIndex + 1) % backgrounds.length); }; // --- GAME UPDATE LOOP --- game.update = function () { // Spawn fruits/bombs every 35-55 ticks if (LK.ticks % (35 + Math.floor(Math.random() * 20)) === 0) { spawnFruitOrBomb(); } // Update fruits for (var i = fruits.length - 1; i >= 0; i--) { var fruit = fruits[i]; // Remove if destroyed if (fruit.destroyed) { fruits.splice(i, 1); continue; } // If missed if (fruit.missed && !fruit.sliced) { fruits.splice(i, 1); missedFruits++; updateMissed(); LK.effects.flashObject(missedTxt, 0xff0000, 400); if (missedFruits >= maxMissed) { LK.effects.flashScreen(0xff0000, 800); LK.showGameOver(); return; } } } // Update bombs for (var j = bombs.length - 1; j >= 0; j--) { var bomb = bombs[j]; if (bomb.destroyed) { bombs.splice(j, 1); continue; } } // Combo reset if (comboCount > 1 && LK.ticks - lastSliceTick > comboWindow) { comboCount = 0; } }; // --- GAME RESET HANDLING --- // On game reset, clear all arrays and reset state function resetGame() { fruits = []; bombs = []; missedFruits = 0; comboCount = 0; lastSliceTick = -100; scoreTxt.setText('0'); comboTxt.setText(''); comboTxt.alpha = 0; updateMissed(); setBackground(0); } resetGame(); // --- END OF GAME CODE ---
===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,403 @@
-/****
+/****
+* Plugins
+****/
+var tween = LK.import("@upit/tween.v1");
+
+/****
+* Classes
+****/
+// Bomb class: Represents a bomb flying through the air
+var Bomb = Container.expand(function () {
+ var self = Container.call(this);
+ self.sliced = false;
+ self.missed = false;
+ // Attach bomb asset (black ellipse)
+ var bombAsset = self.attachAsset('bomb', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ width: 160,
+ height: 160,
+ color: 0x222222,
+ shape: 'ellipse'
+ });
+ // Add a white "fuse" (small rectangle)
+ var fuse = self.attachAsset('fuse', {
+ anchorX: 0.5,
+ anchorY: 1,
+ width: 20,
+ height: 50,
+ color: 0xffffff,
+ shape: 'box',
+ y: -80
+ });
+ // Set initial position and velocity (to be set by spawner)
+ self.x = 0;
+ self.y = 0;
+ self.vx = 0;
+ self.vy = 0;
+ self.gravity = 0.35 + Math.random() * 0.1;
+ self.lastY = self.y;
+ self.update = function () {
+ if (self.sliced) return;
+ self.x += self.vx;
+ self.y += self.vy;
+ self.vy += self.gravity;
+ bombAsset.rotation += 0.09;
+ if (!self.missed && self.y > 2732 + 100) {
+ self.missed = true;
+ }
+ };
+ self.slice = function () {
+ if (self.sliced) return;
+ self.sliced = true;
+ // Animate: flash red and fade out
+ tween(self, {
+ scaleX: 1.7,
+ scaleY: 1.7,
+ alpha: 0
+ }, {
+ duration: 250,
+ easing: tween.easeOut,
+ onFinish: function onFinish() {
+ self.destroy();
+ }
+ });
+ };
+ return self;
+});
+// Fruit class: Represents a fruit flying through the air
+var Fruit = Container.expand(function () {
+ var self = Container.call(this);
+ // Fruit types and their properties
+ var fruitTypes = [{
+ id: 'apple',
+ color: 0xff2d2d,
+ points: 1
+ }, {
+ id: 'banana',
+ color: 0xfff700,
+ points: 2
+ }, {
+ id: 'orange',
+ color: 0xffa500,
+ points: 3
+ }, {
+ id: 'watermelon',
+ color: 0x2ecc40,
+ points: 5
+ }, {
+ id: 'grape',
+ color: 0x8e44ad,
+ points: 4
+ }];
+ // Randomly pick a fruit type
+ var typeIndex = Math.floor(Math.random() * fruitTypes.length);
+ var type = fruitTypes[typeIndex];
+ self.fruitType = type.id;
+ self.points = type.points;
+ self.sliced = false;
+ self.missed = false;
+ // Attach fruit asset (ellipse for fruit)
+ var fruitAsset = self.attachAsset(type.id, {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ width: 160,
+ height: 160,
+ color: type.color,
+ shape: 'ellipse'
+ });
+ // Give fruit a random initial rotation
+ fruitAsset.rotation = Math.random() * Math.PI * 2;
+ // Set initial position and velocity (to be set by spawner)
+ self.x = 0;
+ self.y = 0;
+ self.vx = 0;
+ self.vy = 0;
+ self.gravity = 0.35 + Math.random() * 0.1;
+ // For tracking if fruit is out of bounds
+ self.lastY = self.y;
+ // For combo detection
+ self.sliceTick = -1;
+ // Animate fruit (arc trajectory)
+ self.update = function () {
+ if (self.sliced) return; // Don't update if already sliced
+ self.x += self.vx;
+ self.y += self.vy;
+ self.vy += self.gravity;
+ // Spin fruit
+ fruitAsset.rotation += 0.07;
+ // If fruit falls below screen, mark as missed
+ if (!self.missed && self.y > 2732 + 100) {
+ self.missed = true;
+ }
+ };
+ // Slice the fruit
+ self.slice = function () {
+ if (self.sliced) return;
+ self.sliced = true;
+ // Animate: scale up and fade out
+ tween(self, {
+ scaleX: 1.5,
+ scaleY: 1.5,
+ alpha: 0
+ }, {
+ duration: 350,
+ easing: tween.easeOut,
+ onFinish: function onFinish() {
+ self.destroy();
+ }
+ });
+ };
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0x222a36
+});
+
+/****
+* Game Code
+****/
+// --- GLOBALS ---
+var fruits = [];
+var bombs = [];
+var missedFruits = 0;
+var maxMissed = 3;
+var comboWindow = 20; // ticks for combo
+var lastSliceTick = -100;
+var comboCount = 0;
+var backgroundIndex = 0;
+var backgrounds = [{
+ id: 'bg1',
+ color: 0x222a36
+}, {
+ id: 'bg2',
+ color: 0x1a3d2f
+}, {
+ id: 'bg3',
+ color: 0x3d1a2f
+}];
+// --- GUI Elements ---
+// Score text
+var scoreTxt = new Text2('0', {
+ size: 120,
+ fill: "#fff"
+});
+scoreTxt.anchor.set(0.5, 0);
+LK.gui.top.addChild(scoreTxt);
+// Missed fruits indicator (bottom left, red X's)
+var missedTxt = new Text2('', {
+ size: 90,
+ fill: 0xFF4444
+});
+missedTxt.anchor.set(0, 1);
+LK.gui.bottomLeft.addChild(missedTxt);
+// Combo text (center, fades out)
+var comboTxt = new Text2('', {
+ size: 180,
+ fill: 0xFFE066
+});
+comboTxt.anchor.set(0.5, 0.5);
+comboTxt.alpha = 0;
+LK.gui.center.addChild(comboTxt);
+// Background switch button (bottom right)
+var bgBtn = LK.getAsset('bgBtn', {
+ anchorX: 1,
+ anchorY: 1,
+ width: 180,
+ height: 100,
+ color: 0x8888ff,
+ shape: 'box'
+});
+bgBtn.x = 0;
+bgBtn.y = 0;
+LK.gui.bottomRight.addChild(bgBtn);
+var bgBtnTxt = new Text2('BG', {
+ size: 60,
+ fill: "#fff"
+});
+bgBtnTxt.anchor.set(0.5, 0.5);
+bgBtnTxt.x = -90;
+bgBtnTxt.y = -50;
+LK.gui.bottomRight.addChild(bgBtnTxt);
+// --- BACKGROUND ---
+function setBackground(idx) {
+ backgroundIndex = idx % backgrounds.length;
+ game.setBackgroundColor(backgrounds[backgroundIndex].color);
+}
+setBackground(0);
+// --- FRUIT & BOMB SPAWNING ---
+function spawnFruitOrBomb() {
+ // Randomly decide: 80% fruit, 20% bomb
+ var isBomb = Math.random() < 0.2;
+ var obj;
+ var x = 200 + Math.random() * (2048 - 400);
+ var y = 2732 + 80;
+ var angle = -Math.PI / 2 + (Math.random() - 0.5) * (Math.PI / 3); // Upwards, with some spread
+ var speed = 38 + Math.random() * 10;
+ if (isBomb) {
+ obj = new Bomb();
+ bombs.push(obj);
+ } else {
+ obj = new Fruit();
+ fruits.push(obj);
+ }
+ obj.x = x;
+ obj.y = y;
+ obj.vx = Math.cos(angle) * speed;
+ obj.vy = Math.sin(angle) * speed;
+ game.addChild(obj);
+}
+// --- GAME LOGIC ---
+// Slicing logic: track swipe path and check for intersection
+var swipePath = [];
+var swipeMaxLength = 8; // Only keep last 8 points
+function handleSlice(x, y) {
+ // Check fruits
+ for (var i = fruits.length - 1; i >= 0; i--) {
+ var fruit = fruits[i];
+ if (fruit.sliced) continue;
+ // If swipe is close to fruit center (distance < 120)
+ var dx = fruit.x - x;
+ var dy = fruit.y - y;
+ if (dx * dx + dy * dy < 120 * 120) {
+ fruit.slice();
+ LK.setScore(LK.getScore() + fruit.points);
+ scoreTxt.setText(LK.getScore());
+ fruit.sliceTick = LK.ticks;
+ // Combo logic
+ if (lastSliceTick > 0 && LK.ticks - lastSliceTick < comboWindow) {
+ comboCount++;
+ showCombo(comboCount);
+ } else {
+ comboCount = 1;
+ }
+ lastSliceTick = LK.ticks;
+ }
+ }
+ // Check bombs
+ for (var j = bombs.length - 1; j >= 0; j--) {
+ var bomb = bombs[j];
+ if (bomb.sliced) continue;
+ var dx = bomb.x - x;
+ var dy = bomb.y - y;
+ if (dx * dx + dy * dy < 120 * 120) {
+ bomb.slice();
+ // Game over
+ LK.effects.flashScreen(0xff0000, 800);
+ LK.showGameOver();
+ return;
+ }
+ }
+}
+// Show combo text
+function showCombo(count) {
+ if (count < 2) return;
+ comboTxt.setText('Combo x' + count + '!');
+ comboTxt.alpha = 1;
+ tween(comboTxt, {
+ alpha: 0
+ }, {
+ duration: 900,
+ easing: tween.linear
+ });
+}
+// Update missed fruits display
+function updateMissed() {
+ var s = '';
+ for (var i = 0; i < missedFruits; i++) s += '✗ ';
+ missedTxt.setText(s);
+}
+// --- INPUT HANDLING ---
+// Swiping: track move events, draw path, and slice
+game.move = function (x, y, obj) {
+ // Don't allow swipes in top left 100x100
+ if (x < 100 && y < 100) return;
+ // Add to swipe path
+ swipePath.push({
+ x: x,
+ y: y,
+ tick: LK.ticks
+ });
+ if (swipePath.length > swipeMaxLength) swipePath.shift();
+ // For each point in swipe path, check for slicing
+ for (var i = 0; i < swipePath.length; i++) {
+ handleSlice(swipePath[i].x, swipePath[i].y);
+ }
+};
+// On down, start new swipe
+game.down = function (x, y, obj) {
+ swipePath = [{
+ x: x,
+ y: y,
+ tick: LK.ticks
+ }];
+ handleSlice(x, y);
+};
+// On up, clear swipe path
+game.up = function (x, y, obj) {
+ swipePath = [];
+};
+// Background button: tap to change background
+bgBtn.down = function (x, y, obj) {
+ setBackground((backgroundIndex + 1) % backgrounds.length);
+};
+// --- GAME UPDATE LOOP ---
+game.update = function () {
+ // Spawn fruits/bombs every 35-55 ticks
+ if (LK.ticks % (35 + Math.floor(Math.random() * 20)) === 0) {
+ spawnFruitOrBomb();
+ }
+ // Update fruits
+ for (var i = fruits.length - 1; i >= 0; i--) {
+ var fruit = fruits[i];
+ // Remove if destroyed
+ if (fruit.destroyed) {
+ fruits.splice(i, 1);
+ continue;
+ }
+ // If missed
+ if (fruit.missed && !fruit.sliced) {
+ fruits.splice(i, 1);
+ missedFruits++;
+ updateMissed();
+ LK.effects.flashObject(missedTxt, 0xff0000, 400);
+ if (missedFruits >= maxMissed) {
+ LK.effects.flashScreen(0xff0000, 800);
+ LK.showGameOver();
+ return;
+ }
+ }
+ }
+ // Update bombs
+ for (var j = bombs.length - 1; j >= 0; j--) {
+ var bomb = bombs[j];
+ if (bomb.destroyed) {
+ bombs.splice(j, 1);
+ continue;
+ }
+ }
+ // Combo reset
+ if (comboCount > 1 && LK.ticks - lastSliceTick > comboWindow) {
+ comboCount = 0;
+ }
+};
+// --- GAME RESET HANDLING ---
+// On game reset, clear all arrays and reset state
+function resetGame() {
+ fruits = [];
+ bombs = [];
+ missedFruits = 0;
+ comboCount = 0;
+ lastSliceTick = -100;
+ scoreTxt.setText('0');
+ comboTxt.setText('');
+ comboTxt.alpha = 0;
+ updateMissed();
+ setBackground(0);
+}
+resetGame();
+// --- END OF GAME CODE ---
\ No newline at end of file
bomb. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
a chopping board with a kitchen background. In-Game asset. 2d. High contrast. No shadows
üzerinde by furkan yazan bir yazı. In-Game asset. 2d. High contrast. No shadows
double katana. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
applea. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
exploe. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
red. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
Tap to play button . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat