Code edit (1 edits merged)
Please save this source code
User prompt
Limpia el código de todo lo que no sea necesario.
User prompt
Baja mucho más no parece haber diferencia.
User prompt
Baja más la parte donde desaparecen las frutas de abajo.
User prompt
Dirección correcta, pero no tanto, un poco menos. Tambien baja un poco la posición donde desaparecen las futas de abajo.
User prompt
Lo estas sbiendo en lugar de bajarlo, hacia el otro lado.
User prompt
Baja mucho más, parece que no cambia.
User prompt
Baja Y la parte donde se separa la parte inferior de la parte superior
User prompt
Aplica el cambio en el código
User prompt
Incrementa otro 30%
User prompt
Incrementa el tamaño de las frutas en la parte superior un 30%
User prompt
Las frutas deben ir incrementando su tamaño, el tamaño parece siempre se mantiene contante. Todavía cuando se corta una fruta solo de duplica el Sprite, necesito que el Sprite se divida en dos, simulando se corto la fruta verticalmente.
User prompt
Incrementa el tamaño de las frutas mientras mas arriba estén en el juego. Que las frutas también roten en la parte de abajo del juego. Cuando se parten las frutas se duplica el Sprite, necesito que el Sprite se parta a la mitad en lugar de aparecer dos Sprites iguales.
User prompt
Borre el asset del Kiwi, lo necesito de vuelta
User prompt
Limpia el codigo de partes que no sean necesarias.
User prompt
Cuando se reinicia el juego por un momento aparecen muchas frutas generadas en la parte inferior.
User prompt
Si reinicia cuando fallo las frutas pero no cuando las corto todas.
User prompt
Please fix the bug: 'TypeError: setTimeout is not a function' in or related to this line: 'frutasFalladasTimeout = setTimeout(function () {' Line Number: 644
Code edit (1 edits merged)
Please save this source code
User prompt
No reinicio la ronda después de los dos segundos.
User prompt
Cuando el contador llegue a 5 espera dos segundos e inicia nuevamente la ronda.
User prompt
Cuando el contador llegue a 5 inicia nuevamente la ronda.
User prompt
Cuando una fruta no sea cortada y se elimine el circulo blanco o la fruta salga de la pantalla tambien hay que contarla.
User prompt
Cambia el contador, que solo sume 1 cuando se corta o se pierde una fruta.
User prompt
Imprime en pantalla un contador de las frutas generadas.
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ // Clase para la fruta entera var Fruit = Container.expand(function () { var self = Container.call(this); // Selección aleatoria de tipo de fruta var fruitTypes = ['fruit_apple', 'fruit_lemon', 'fruit_orange', 'fruit_kiwi', 'fruit_plum']; self.fruitType = fruitTypes[Math.floor(Math.random() * fruitTypes.length)]; // Asset de la fruta self.fruitAsset = self.attachAsset(self.fruitType, { anchorX: 0.5, anchorY: 0.5 }); self.radius = self.fruitAsset.width / 2; // Estado self.isCut = false; self.isActive = true; // Si está en juego // Para saber si ya fue cortada self.cut = function () { if (self.isCut) { return; } self.isCut = true; self.isActive = false; self.visible = false; }; return self; }); // Clase para la fruta cortada (dos mitades) var FruitCut = Container.expand(function () { var self = Container.call(this); // Recibe tipo de fruta, posición base, rotación y escala self.init = function (fruitType, x, y, rotation, scale) { if (typeof rotation === "undefined") { rotation = 0; } if (typeof scale === "undefined") { scale = 1; } // Mitad izquierda var leftAssetId = 'fruit_half_left'; var rightAssetId = 'fruit_half_right'; // Si la fruta es kiwi, usar la imagen original y simular el corte con escalado y recorte if (fruitType === 'fruit_kiwi') { leftAssetId = 'fruit_kiwi'; rightAssetId = 'fruit_kiwi'; // Mitad izquierda (recortada visualmente) self.left = self.attachAsset(leftAssetId, { anchorX: 1, anchorY: 0.5, scaleX: 0.5 * scale, scaleY: scale, x: 0, y: 0 }); // Mitad derecha (recortada visualmente) self.right = self.attachAsset(rightAssetId, { anchorX: 0, anchorY: 0.5, scaleX: 0.5 * scale, scaleY: scale, x: 0, y: 0 }); // Para simular el corte, desplazamos la textura de cada mitad self.left.crop = { x: 0, y: 0, width: 0.5, height: 1 }; self.right.crop = { x: 0.5, y: 0, width: 0.5, height: 1 }; } else { // Para las demás frutas, usar assets de mitades si existen, si no, usar el asset original con escalado self.left = self.attachAsset('fruit_half_left', { anchorX: 1, anchorY: 0.5, scaleX: scale, scaleY: scale, x: 0, y: 0 }); self.right = self.attachAsset('fruit_half_right', { anchorX: 0, anchorY: 0.5, scaleX: scale, scaleY: scale, x: 0, y: 0 }); } self.x = x; self.y = y; self.left.rotation = rotation; self.right.rotation = rotation; self.rotation = rotation; }; // Animación de separación self.animate = function (_onFinish) { tween(self.left, { x: -80, rotation: self.left.rotation - 0.7 }, { duration: 500, easing: tween.cubicOut }); tween(self.right, { x: 80, rotation: self.right.rotation + 0.7 }, { duration: 500, easing: tween.cubicOut, onFinish: function onFinish() { if (_onFinish) { _onFinish(); } } }); }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x222222 }); /**** * Game Code ****/ var scoreTxt = new Text2('0', { size: 120, fill: "#222" }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); var frutasGeneradas = 0; var frutasGeneradasTxt = new Text2('Frutas: 0', { size: 80, fill: "#fff" }); frutasGeneradasTxt.anchor.set(0.5, 0); frutasGeneradasTxt.y = 130; LK.gui.top.addChild(frutasGeneradasTxt); var frutasFalladas = 0; var fruits = []; var fallingFruits = []; var cutFruits = []; var frutasFalladasTimeout = null; var roundBullets = 5; var fruitSpeed = 22; var cutZoneAsset = LK.getAsset('cut_zone', { anchorX: 0.5, anchorY: 0.5 }); var cutZoneRadius = cutZoneAsset.width / 2; cutZoneAsset.destroy(); var canCut = true; var lastTouchTick = -100; function updateScore(val) { LK.setScore(val); scoreTxt.setText(val); } function tryCutFruit(x, y) { if (!canCut) { return; } canCut = false; lastTouchTick = LK.ticks; for (var i = 0; i < fallingFruits.length; i++) { var fruit = fallingFruits[i]; if (!fruit.isActive) { continue; } if (fruit.state === 'cuttable') { var dx = x - fruit.x; var dy = y - fruit.y; var dist = Math.sqrt(dx * dx + dy * dy); if (dist <= fruit.radius * fruit.scaleX) { fruit.cut(); if (fruit.cutZoneCircle) { fruit.cutZoneCircle.destroy(); fruit.cutZoneCircle = null; } LK.getSound('cut').play(); var fruitCut = new FruitCut(); fruitCut.init(fruit.fruitType, fruit.x, fruit.y, fruit.rotation, fruit.scaleX); game.addChild(fruitCut); fruitCut.animate(function () { fruitCut.destroy(); }); cutFruits.push(fruitCut); frutasGeneradas++; frutasGeneradasTxt.setText('Frutas: ' + frutasGeneradas); updateScore(LK.getScore() + 1); return; } } } } game.down = function (x, y, obj) { tryCutFruit(x, y); }; // Main update game.update = function () { // Permitir corte nuevamente tras 6 ticks (~100ms) if (!canCut && LK.ticks - lastTouchTick > 6) { canCut = true; } // --- SISTEMA DE BALAS POR RONDA (5 balas, 1s entre cada una, 7s delay antes de mostrar en pantalla superior) --- if (typeof roundState === "undefined") { // Estados posibles: 'waiting', 'spawning', 'waitingFruits' roundState = 'waiting'; roundBullets = 5; roundFruitsQueue = []; roundFruitsActive = []; roundNextBulletTick = LK.ticks + 30; // primer disparo tras 0.5s roundBulletsFired = 0; roundDelayBetweenRounds = 120; // 2s entre rondas roundDelayTicks = 0; } if (roundState === 'waiting') { // Limpiar arrays de frutas y mitades cortadas de la ronda anterior for (var i = fruits.length - 1; i >= 0; i--) { if (fruits[i]) { fruits[i].destroy(); } } fruits = []; for (var i = fallingFruits.length - 1; i >= 0; i--) { if (fallingFruits[i]) { fallingFruits[i].destroy(); } } fallingFruits = []; for (var i = cutFruits.length - 1; i >= 0; i--) { if (cutFruits[i]) { cutFruits[i].destroy(); } } cutFruits = []; // Limpiar arrays de control de ronda if (typeof roundFruitsQueue !== "undefined") { for (var i = roundFruitsQueue.length - 1; i >= 0; i--) { if (roundFruitsQueue[i] && roundFruitsQueue[i].destroy) { roundFruitsQueue[i].destroy(); } } } roundFruitsQueue = []; if (typeof roundFruitsActive !== "undefined") { for (var i = roundFruitsActive.length - 1; i >= 0; i--) { if (roundFruitsActive[i] && roundFruitsActive[i].destroy) { roundFruitsActive[i].destroy(); } } } roundFruitsActive = []; // Reset meta de ronda roundBulletsFired = 0; roundNextBulletTick = LK.ticks; roundDelayTicks = 0; // Esperar un frame antes de permitir el spawn para evitar generación múltiple if (typeof roundJustReset === "undefined" || !roundJustReset) { roundJustReset = true; return; } else { roundJustReset = false; roundState = 'spawning'; } } if (roundState === 'spawning') { // Disparar una fruta cada 1s hasta 5 if (roundBulletsFired < roundBullets && LK.ticks >= roundNextBulletTick) { // Crear fruta y ponerla en la cola de espera var fruit = new Fruit(); var margin = 180; fruit.x = margin + Math.random() * (2048 - 2 * margin); fruit.y = 2732 + fruit.radius + 10; fruit.startY = fruit.y; fruit.targetY = 2732 / 2 + 420; fruit.state = 'rising'; fruit.ticks = 0; fruit.roundMeta = { // Para tracking de ciclo hasCrossed: false, crossedTick: null, showScheduled: false, showTimeout: null, destroyed: false }; fruits.push(fruit); roundFruitsQueue.push(fruit); game.addChild(fruit); roundBulletsFired++; // El contador de frutas generadas solo se incrementa cuando se corta o se pierde una fruta, no aquí. roundNextBulletTick = LK.ticks + 60; // 1s entre balas } // Cuando todas las balas han sido disparadas y ya no quedan frutas activas, pasar a siguiente estado // (pero solo cuando todas las frutas hayan sido destruidas o salidas de pantalla) var allGone = true; for (var i = 0; i < roundFruitsQueue.length; i++) { if (!roundFruitsQueue[i].roundMeta.destroyed) { allGone = false; break; } } for (var i = 0; i < roundFruitsActive.length; i++) { if (!roundFruitsActive[i].roundMeta.destroyed) { allGone = false; break; } } if (roundBulletsFired >= roundBullets && allGone) { roundState = 'waitingFruits'; roundDelayTicks = 0; } } if (roundState === 'waitingFruits') { // Espera 2s antes de reiniciar la ronda roundDelayTicks++; if (roundDelayTicks >= roundDelayBetweenRounds) { // Limpiar arrays de frutas activas y en cola antes de reiniciar la ronda for (var i = fruits.length - 1; i >= 0; i--) { if (fruits[i]) { fruits[i].destroy(); } } fruits = []; for (var i = fallingFruits.length - 1; i >= 0; i--) { if (fallingFruits[i]) { fallingFruits[i].destroy(); } } fallingFruits = []; for (var i = cutFruits.length - 1; i >= 0; i--) { if (cutFruits[i]) { cutFruits[i].destroy(); } } cutFruits = []; roundFruitsQueue = []; roundFruitsActive = []; roundState = 'waiting'; } } // Mover frutas que suben desde abajo hasta el centro for (var i = fruits.length - 1; i >= 0; i--) { var fruit = fruits[i]; if (fruit.state === 'rising') { fruit.y -= fruitSpeed; fruit.ticks++; // Escalado según altura (más arriba, más grande) var minScale = 1.0; var maxScale = 1.25; var y0 = 2732 + fruit.radius + 10; var y1 = 2732 / 2 + 200; var t = (fruit.y - y1) / (y0 - y1); if (t < 0) { t = 0; } if (t > 1) { t = 1; } var scale = minScale + (maxScale - minScale) * (1 - t); fruit.scaleX = fruit.scaleY = scale; // Rotación en la parte de abajo (solo mientras sube) if (typeof fruit.rotation === "undefined") { fruit.rotation = Math.random() * Math.PI * 2; } if (typeof fruit.rotationSpeed === "undefined") { fruit.rotationSpeed = (Math.random() - 0.5) * 0.08; } fruit.rotation += fruit.rotationSpeed; if (fruit.fruitAsset) { fruit.fruitAsset.rotation = fruit.rotation; } // Cuando cruza la altura objetivo (centro), programar aparición en pantalla superior tras un tiempo proporcional al número de frutas lanzadas if (!fruit.roundMeta.hasCrossed && fruit.y <= fruit.targetY) { fruit.roundMeta.hasCrossed = true; fruit.roundMeta.crossedTick = LK.ticks; fruit.visible = false; // El tiempo de espera es igual a 1s * cantidad de frutas lanzadas en la ronda var fruitsInRound = roundBullets; var appearDelayMs = fruitsInRound * 1000; // 1s por fruta lanzada fruit.roundMeta.showScheduled = true; fruit.roundMeta.showTimeout = LK.setTimeout(function (fruitRef, fruitsArr, iIdx) { return function () { // Si la fruta ya fue destruida antes del tiempo, no hacer nada if (fruitRef.roundMeta.destroyed) { return; } // Eliminar de fruits[] y crear en pantalla superior var fruitType = fruitRef.fruitType; var x = fruitRef.x; // Eliminar fruta oculta fruitRef.destroy(); for (var j = 0; j < fruitsArr.length; j++) { if (fruitsArr[j] === fruitRef) { fruitsArr.splice(j, 1); break; } } // Crear fruta en pantalla superior var fallingFruit = new Fruit(); fallingFruit.fruitType = fruitType; fallingFruit.fruitAsset.destroy(); fallingFruit.fruitAsset = fallingFruit.attachAsset(fruitType, { anchorX: 0.5, anchorY: 0.5 }); fallingFruit.x = x; // Baja la fruta 400px respecto a la posición original (menos que antes) fallingFruit.y = 2732 / 2 + 420 + 400; fallingFruit.startY = fallingFruit.y; fallingFruit.state = 'cuttable'; fallingFruit.ticks = 0; fallingFruit.rotation = Math.random() * Math.PI * 2; fallingFruit.rotationSpeed = (Math.random() - 0.5) * 0.04; fallingFruit.roundMeta = { destroyed: false }; fallingFruits.push(fallingFruit); roundFruitsActive.push(fallingFruit); game.addChild(fallingFruit); }; }(fruit, fruits, i), appearDelayMs); } // Si la fruta está oculta y esperando, no hacer nada más if (fruit.roundMeta.hasCrossed && fruit.roundMeta.showScheduled) { // Si la fruta fue destruida antes de los 7s, cancelar timeout y limpiar if (fruit.roundMeta.destroyed) { if (fruit.roundMeta.showTimeout) { LK.clearTimeout(fruit.roundMeta.showTimeout); fruit.roundMeta.showTimeout = null; } // Eliminar de roundFruitsQueue si está presente if (typeof roundFruitsQueue !== "undefined") { for (var j = roundFruitsQueue.length - 1; j >= 0; j--) { if (roundFruitsQueue[j] === fruit) { roundFruitsQueue.splice(j, 1); break; } } } fruits.splice(i, 1); } continue; } // Si la fruta sale de pantalla antes de cruzar, eliminar y marcar como destruida if (fruit.y < -fruit.radius + 800) { // BAJA MUCHO MÁS el umbral de desaparición inferior fruit.roundMeta.destroyed = true; if (fruit.roundMeta.showTimeout) { LK.clearTimeout(fruit.roundMeta.showTimeout); fruit.roundMeta.showTimeout = null; } // Eliminar de roundFruitsQueue si está presente if (typeof roundFruitsQueue !== "undefined") { for (var j = roundFruitsQueue.length - 1; j >= 0; j--) { if (roundFruitsQueue[j] === fruit) { roundFruitsQueue.splice(j, 1); break; } } } // Aumentar frutasFalladas si la fruta se perdió antes de aparecer frutasFalladas++; frutasGeneradas++; frutasGeneradasTxt.setText('Frutas: ' + frutasGeneradas); fruit.destroy(); fruits.splice(i, 1); } } } // Mover frutas que suben de nuevo y gestionar zona de corte visual for (var i = fallingFruits.length - 1; i >= 0; i--) { var fruit = fallingFruits[i]; if (!fruit.isActive) { continue; } // Escalado según altura (más arriba, más grande) var minScale = 1.0; var maxScale = 1.25 * 1.3 * 1.3; //{45} // 60% más grande en la parte superior var y0 = 2732 / 2 + 420; var y1 = 420; var t = (fruit.y - y1) / (y0 - y1); if (t < 0) { t = 0; } if (t > 1) { t = 1; } var scale = minScale + (maxScale - minScale) * (1 - t); fruit.scaleX = fruit.scaleY = scale; // Rotación suave if (typeof fruit.rotationSpeed !== "undefined") { fruit.rotation += fruit.rotationSpeed; if (fruit.fruitAsset) { fruit.fruitAsset.rotation = fruit.rotation; } } // Movimiento hacia arriba mientras sea cortable o volando hacia arriba if (fruit.state === 'cuttable' || fruit.state === 'flyingup') { fruit.y -= fruitSpeed; } // --- Animación progresiva del círculo de corte --- // El círculo aparece desde el inicio de la subida (cuttable), crece y se difumina progresivamente if (fruit.state === 'cuttable') { // Si no existe el círculo, crearlo if (!fruit.cutZoneCircle) { fruit.cutZoneCircle = LK.getAsset('cut_zone', { anchorX: 0.5, anchorY: 0.5, x: fruit.x, y: fruit.y, alpha: 0.0, scaleX: 0.1, scaleY: 0.1 }); game.addChild(fruit.cutZoneCircle); } // Progresión del círculo: desde que inicia la subida hasta que llega cerca de la parte superior var appearT = (y0 - fruit.y) / (y0 - y1); if (appearT < 0) { appearT = 0; } if (appearT > 1) { appearT = 1; } var maxScaleZone = 0.85; // Más pequeño, para que quede dentro de la fruta var minScaleZone = 0.15; var maxAlpha = 0.38; // Más difuminado var minAlpha = 0.08; var scaleZone = minScaleZone + (maxScaleZone - minScaleZone) * appearT; var alphaZone = minAlpha + (maxAlpha - minAlpha) * appearT; fruit.cutZoneCircle.scaleX = fruit.cutZoneCircle.scaleY = scaleZone; fruit.cutZoneCircle.alpha = alphaZone; fruit.cutZoneCircle.x = fruit.x; fruit.cutZoneCircle.y = fruit.y; // Si la fruta sale por arriba, eliminar círculo y pasar a flyingup if (fruit.y < y1) { // Si el círculo de corte existe y la fruta no fue cortada, contar como fallada if (fruit.cutZoneCircle) { fruit.cutZoneCircle.destroy(); fruit.cutZoneCircle = null; if (fruit.isActive && !fruit.isCut) { frutasFalladas++; frutasGeneradas++; frutasGeneradasTxt.setText('Frutas: ' + frutasGeneradas); } } fruit.state = 'flyingup'; } } else { // Si no está en estado cortable y existe el círculo, destruirlo if (fruit.cutZoneCircle) { fruit.cutZoneCircle.destroy(); fruit.cutZoneCircle = null; } } // Si fue cortada, eliminar círculo visual inmediatamente pero mantener la fruta visible if (!fruit.isActive && fruit.cutZoneCircle) { fruit.cutZoneCircle.destroy(); fruit.cutZoneCircle = null; } // Si está cayendo, animar caída if (fruit.state === 'dropping') { fruit.dropSpeed += 2.5; // gravedad fruit.y += fruit.dropSpeed; // Escalado decreciente al caer fruit.scaleX = fruit.scaleY = Math.max(0.7, fruit.scaleX - 0.01); if (fruit.cutZoneCircle) { fruit.cutZoneCircle.x = fruit.x; fruit.cutZoneCircle.y = fruit.y; } // Si sale de pantalla, marcar como inactivo pero mantener visible if (fruit.y > 2732 + fruit.radius + 20) { if (fruit.cutZoneCircle) { fruit.cutZoneCircle.destroy(); fruit.cutZoneCircle = null; } fruit.isActive = false; } } // Si la fruta sigue subiendo después de la zona de corte y no fue cortada if (fruit.state === 'flyingup') { // Al entrar por primera vez en flyingup, inicia temporizador de espera if (typeof fruit.waitTicks === "undefined") { fruit.waitTicks = 0; } fruit.waitTicks++; // Mantener la fruta visible y estática durante 7 segundos (420 ticks) if (fruit.waitTicks < 420) { // Mantener posición (opcional: podrías hacer que siga subiendo lentamente) // fruit.y -= fruitSpeed * 0.1; } else { // Después de 7 segundos, hacer que suba y desaparezca fruit.y -= fruitSpeed; // Escalado sigue creciendo un poco fruit.scaleX = fruit.scaleY = Math.min(maxScale, fruit.scaleX + 0.01); // Si sale de pantalla por arriba, marcar como inactiva y eliminar círculo de corte si existe if (fruit.y < -fruit.radius - 20) { if (fruit.cutZoneCircle) { fruit.cutZoneCircle.destroy(); fruit.cutZoneCircle = null; } fruit.isActive = false; // Marcar como destruida para el sistema de ronda if (fruit.roundMeta) { fruit.roundMeta.destroyed = true; } // Eliminar de roundFruitsActive si está presente if (typeof roundFruitsActive !== "undefined") { for (var j = roundFruitsActive.length - 1; j >= 0; j--) { if (roundFruitsActive[j] === fruit) { roundFruitsActive.splice(j, 1); break; } } } // Aumentar frutasFalladas y frutasGeneradas solo si la fruta no fue cortada if (!fruit.isCut) { frutasFalladas++; frutasGeneradas++; frutasGeneradasTxt.setText('Frutas: ' + frutasGeneradas); } } } } // Si la fruta ya fue cortada o salió de pantalla, eliminar if (!fruit.isActive || fruit.y > 2732 + fruit.radius + 20 || fruit.y < -fruit.radius - 20) { if (fruit.cutZoneCircle) { fruit.cutZoneCircle.destroy(); fruit.cutZoneCircle = null; } // Marcar como destruida para el sistema de ronda if (fruit.roundMeta) { fruit.roundMeta.destroyed = true; } // Eliminar de roundFruitsActive si está presente if (typeof roundFruitsActive !== "undefined") { for (var j = roundFruitsActive.length - 1; j >= 0; j--) { if (roundFruitsActive[j] === fruit) { roundFruitsActive.splice(j, 1); break; } } } fruit.destroy(); fallingFruits.splice(i, 1); } } // Limpiar mitades cortadas que ya terminaron animación for (var i = cutFruits.length - 1; i >= 0; i--) { var fc = cutFruits[i]; if (!fc.left || !fc.right) { if (fc.destroy) { fc.destroy(); } cutFruits.splice(i, 1); } } // Variable para controlar el timeout (debe estar fuera de la función que chequea frutasFalladas) if (frutasFalladas >= 5 || frutasGeneradas >= 5 && frutasFalladas < 5) { if (!frutasFalladasTimeout) { frutasFalladasTimeout = LK.setTimeout(function () { for (var i = fruits.length - 1; i >= 0; i--) { if (fruits[i]) { fruits[i].destroy(); } } fruits = []; for (var i = fallingFruits.length - 1; i >= 0; i--) { if (fallingFruits[i]) { fallingFruits[i].destroy(); } } fallingFruits = []; for (var i = cutFruits.length - 1; i >= 0; i--) { if (cutFruits[i]) { cutFruits[i].destroy(); } } cutFruits = []; if (typeof roundFruitsQueue !== "undefined") { for (var i = roundFruitsQueue.length - 1; i >= 0; i--) { if (roundFruitsQueue[i] && roundFruitsQueue[i].destroy) { roundFruitsQueue[i].destroy(); } } } roundFruitsQueue = []; if (typeof roundFruitsActive !== "undefined") { for (var i = roundFruitsActive.length - 1; i >= 0; i--) { if (roundFruitsActive[i] && roundFruitsActive[i].destroy) { roundFruitsActive[i].destroy(); } } } roundFruitsActive = []; roundState = 'waiting'; roundBulletsFired = 0; roundNextBulletTick = LK.ticks; roundDelayTicks = 0; frutasFalladas = 0; frutasGeneradas = 0; frutasGeneradasTxt.setText('Frutas: 0'); updateScore(0); frutasFalladasTimeout = null; }, 2000); } return; } }; updateScore(0);
===================================================================
--- original.js
+++ change.js
@@ -36,10 +36,14 @@
var FruitCut = Container.expand(function () {
var self = Container.call(this);
// Recibe tipo de fruta, posición base, rotación y escala
self.init = function (fruitType, x, y, rotation, scale) {
- if (typeof rotation === "undefined") rotation = 0;
- if (typeof scale === "undefined") scale = 1;
+ if (typeof rotation === "undefined") {
+ rotation = 0;
+ }
+ if (typeof scale === "undefined") {
+ scale = 1;
+ }
// Mitad izquierda
var leftAssetId = 'fruit_half_left';
var rightAssetId = 'fruit_half_right';
// Si la fruta es kiwi, usar la imagen original y simular el corte con escalado y recorte
@@ -170,14 +174,18 @@
LK.setScore(val);
scoreTxt.setText(val);
}
function tryCutFruit(x, y) {
- if (!canCut) return;
+ if (!canCut) {
+ return;
+ }
canCut = false;
lastTouchTick = LK.ticks;
for (var i = 0; i < fallingFruits.length; i++) {
var fruit = fallingFruits[i];
- if (!fruit.isActive) continue;
+ if (!fruit.isActive) {
+ continue;
+ }
if (fruit.state === 'cuttable') {
var dx = x - fruit.x;
var dy = y - fruit.y;
var dist = Math.sqrt(dx * dx + dy * dy);
@@ -358,17 +366,25 @@
// Escalado según altura (más arriba, más grande)
var minScale = 1.0;
var maxScale = 1.25;
var y0 = 2732 + fruit.radius + 10;
- var y1 = 2732 / 2 + 420;
+ var y1 = 2732 / 2 + 200;
var t = (fruit.y - y1) / (y0 - y1);
- if (t < 0) t = 0;
- if (t > 1) t = 1;
+ if (t < 0) {
+ t = 0;
+ }
+ if (t > 1) {
+ t = 1;
+ }
var scale = minScale + (maxScale - minScale) * (1 - t);
fruit.scaleX = fruit.scaleY = scale;
// Rotación en la parte de abajo (solo mientras sube)
- if (typeof fruit.rotation === "undefined") fruit.rotation = Math.random() * Math.PI * 2;
- if (typeof fruit.rotationSpeed === "undefined") fruit.rotationSpeed = (Math.random() - 0.5) * 0.08;
+ if (typeof fruit.rotation === "undefined") {
+ fruit.rotation = Math.random() * Math.PI * 2;
+ }
+ if (typeof fruit.rotationSpeed === "undefined") {
+ fruit.rotationSpeed = (Math.random() - 0.5) * 0.08;
+ }
fruit.rotation += fruit.rotationSpeed;
if (fruit.fruitAsset) {
fruit.fruitAsset.rotation = fruit.rotation;
}
@@ -481,10 +497,14 @@
var maxScale = 1.25 * 1.3 * 1.3; //{45} // 60% más grande en la parte superior
var y0 = 2732 / 2 + 420;
var y1 = 420;
var t = (fruit.y - y1) / (y0 - y1);
- if (t < 0) t = 0;
- if (t > 1) t = 1;
+ if (t < 0) {
+ t = 0;
+ }
+ if (t > 1) {
+ t = 1;
+ }
var scale = minScale + (maxScale - minScale) * (1 - t);
fruit.scaleX = fruit.scaleY = scale;
// Rotación suave
if (typeof fruit.rotationSpeed !== "undefined") {
@@ -658,28 +678,38 @@
if (frutasFalladas >= 5 || frutasGeneradas >= 5 && frutasFalladas < 5) {
if (!frutasFalladasTimeout) {
frutasFalladasTimeout = LK.setTimeout(function () {
for (var i = fruits.length - 1; i >= 0; i--) {
- if (fruits[i]) fruits[i].destroy();
+ if (fruits[i]) {
+ fruits[i].destroy();
+ }
}
fruits = [];
for (var i = fallingFruits.length - 1; i >= 0; i--) {
- if (fallingFruits[i]) fallingFruits[i].destroy();
+ if (fallingFruits[i]) {
+ fallingFruits[i].destroy();
+ }
}
fallingFruits = [];
for (var i = cutFruits.length - 1; i >= 0; i--) {
- if (cutFruits[i]) cutFruits[i].destroy();
+ if (cutFruits[i]) {
+ cutFruits[i].destroy();
+ }
}
cutFruits = [];
if (typeof roundFruitsQueue !== "undefined") {
for (var i = roundFruitsQueue.length - 1; i >= 0; i--) {
- if (roundFruitsQueue[i] && roundFruitsQueue[i].destroy) roundFruitsQueue[i].destroy();
+ if (roundFruitsQueue[i] && roundFruitsQueue[i].destroy) {
+ roundFruitsQueue[i].destroy();
+ }
}
}
roundFruitsQueue = [];
if (typeof roundFruitsActive !== "undefined") {
for (var i = roundFruitsActive.length - 1; i >= 0; i--) {
- if (roundFruitsActive[i] && roundFruitsActive[i].destroy) roundFruitsActive[i].destroy();
+ if (roundFruitsActive[i] && roundFruitsActive[i].destroy) {
+ roundFruitsActive[i].destroy();
+ }
}
}
roundFruitsActive = [];
roundState = 'waiting';
Kiwi Fruta con ojos lindos. In-Game asset. 2d. High contrast. No shadows. Cartoon.
Limon Circular Fruta con ojos lindos. In-Game asset. 2d. High contrast. No shadows. Cartoon.
Naranja Circular Fruta con ojos lindos. In-Game asset. 2d. High contrast. No shadows. Cartoon.
Manzana Fruta con ojos lindos. In-Game asset. 2d. High contrast. No shadows. Cartoon.
Ciruela Fruta con ojos lindos. In-Game asset. 2d. High contrast. No shadows. Cartoon.
Manzana Fruta cortada a la mitad. In-Game asset. 2d. High contrast. No shadows. Cartoon.
Kiwi Fruta cortado por la mitad. In-Game asset. 2d. High contrast. No shadows. Cartoon.
Limon Circular Cortado por la mitad. In-Game asset. 2d. High contrast. No shadows. Cartoon.
Naranja Circular Cortada por la mitad. In-Game asset. 2d. High contrast. No shadows. Cartoon.
Ciruela Fruta cortada por la mitad. In-Game asset. 2d. High contrast. No shadows. Cartoon.
Agrega una rueda en la parte trasera del cañon.
En lugar del numero 2 un numero 1
Letars GO! dentro del circulo.
Red cicle thiner but maintan the image size
En lugar del numero 1 un numero 2
Puedes hacer varias imagenes reemplazando el numero 2 por los numeros 3, 4, 5, 6, 7 y 8? Solo debe haber un numero en cada imagen.
En lugar del numero 3 un numero 4
En lugar del numero 4 un numero 5
En lugar del numero 5 un numero 6
En lugar del numero 6 un numero 7
En lugar del numero 1 un numero 8
En lugar del numero 1 un numero 9
En lugar del numero 9 un numero 10
En lugar del numero 1 un numero 11
Boton de juego que diga "START". In-Game asset. 2d. High contrast. No shadows
Boton de juego que diga "RESTART". In-Game asset. 2d. High contrast. No shadows
Boton de juego Azul que diga "MENU". In-Game asset. 2d. High contrast. No shadows
Un fondo colorido y brillante estilo caricatura. La escena es un bosque abierto alegre con colores pastel vibrantes, formas suaves y redondeadas, y un cielo azul claro con nubes esponjosas. El estilo es kawaii, juguetón y fantástico, con líneas suaves y una atmósfera feliz y amigable, perfecto para una introducción divertida y cute de un juego. In-Game asset. 2d. High contrast. No shadows
"Beat the Fruit" titulo para el juego, muestra las letras en grande blancas con un borde negro y sin fondo, con algunas frutitas felices junto a las letras. In-Game asset. 2d. High contrast. No shadows
Barra verde horizontal estilo caricatura.. In-Game asset. 2d. High contrast. No shadows