User prompt
has que la cannonball de vueltas en su propio eje al ser disparada ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
genera un cañon que tire cañonasos cada vez que doy click. la boca del cañon seguira mirando al mouse pero no seguirlo. si la bala del cañon toca una fruta sera como el script de cortarla ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
genera una calle abajo de todo de la pantalla que seria que cuando las frutas toquen la calle, la calle tenga una mancha en el lugar donde toco la calle, dependiendo de la fruta el color de la mancha cambiara ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
crea unas nubes que se mueven para la derecha simulando que las frutas caen de ellas ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
pone de musica de fondo la cancion llamada tropical
User prompt
has que las frutas se corten cuando les das click ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
agrega al codigo que al llegar a 50 cortes, ganes el nivel y que aparezca un boton para ir a otro nivel y que la velocidad aumente del las frutas mientras mas niveles avances, y al llegar a 10 errores pierdes todo y vuelves al inicio ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
crea un juego sobre que frutas caen del cielo y que al dar click en esas frutas, las frutas se corten. y que tenga un contador de frutas contadas, otro de frutas en pantalla y otro de frutas que calleron y no lograste cortar antes de que toque el suelo ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Fruit Ninja Sky
Initial prompt
crea un juego sobre que frutas caen del cielo y que al dar click en esas frutas, las frutas se corten. y que tenga un contador de frutas contadas, otro de frutas en pantalla y otro de frutas que calleron y no lograste cortar antes de que toque el suelo
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Cannon = Container.expand(function () { var self = Container.call(this); // Attach cannon graphics var cannonGraphics = self.attachAsset('cannon', { anchorX: 0.5, anchorY: 0.5 }); // Set cannon position at bottom center self.x = 2048 / 2; self.y = 2732 - 150; // Method to aim cannon towards target position self.aimAt = function (targetX, targetY) { var deltaX = targetX - self.x; var deltaY = targetY - self.y; var angle = Math.atan2(deltaY, deltaX); cannonGraphics.rotation = angle; self.aimAngle = angle; }; // Method to fire cannonball self.fire = function () { var cannonball = new Cannonball(); cannonball.x = self.x; cannonball.y = self.y; // Calculate direction based on cannon aim var speed = 15; cannonball.velocityX = Math.cos(self.aimAngle) * speed; cannonball.velocityY = Math.sin(self.aimAngle) * speed; cannonballs.push(cannonball); game.addChild(cannonball); }; return self; }); var Cannonball = Container.expand(function () { var self = Container.call(this); // Attach cannonball graphics var ballGraphics = self.attachAsset('cannonball', { anchorX: 0.5, anchorY: 0.5 }); // Movement properties self.velocityX = 0; self.velocityY = 0; // Update method called every frame self.update = function () { // Move cannonball self.x += self.velocityX; self.y += self.velocityY; // Rotate cannonball on its own axis ballGraphics.rotation += 0.2; // Check collision with fruits for (var i = fruitsOnScreen.length - 1; i >= 0; i--) { var fruit = fruitsOnScreen[i]; if (self.intersects(fruit) && !fruit.isSliced) { // Slice the fruit fruit.sliceFruit(); // Remove cannonball self.destroy(); for (var j = cannonballs.length - 1; j >= 0; j--) { if (cannonballs[j] === self) { cannonballs.splice(j, 1); break; } } return; } } // Remove cannonball if it goes off screen if (self.x < -50 || self.x > 2048 + 50 || self.y < -50 || self.y > 2732 + 50) { self.destroy(); for (var k = cannonballs.length - 1; k >= 0; k--) { if (cannonballs[k] === self) { cannonballs.splice(k, 1); break; } } } }; return self; }); var Cloud = Container.expand(function () { var self = Container.call(this); // Attach cloud graphics var cloudGraphics = self.attachAsset('cloud', { anchorX: 0.5, anchorY: 0.5 }); // Set random horizontal speed for moving right self.speed = 1 + Math.random() * 2; // Speed between 1-3 // Update method called every frame self.update = function () { // Move cloud to the right self.x += self.speed; // If cloud moves off screen to the right, reset to left side if (self.x > 2048 + 100) { self.x = -100; // Randomize vertical position when resetting self.y = 100 + Math.random() * 300; } }; return self; }); var Fruit = Container.expand(function () { var self = Container.call(this); // Array of fruit types to randomly select from var fruitTypes = ['apple', 'banana', 'orange', 'grape']; self.fruitType = fruitTypes[Math.floor(Math.random() * fruitTypes.length)]; // Attach the fruit graphics var fruitGraphics = self.attachAsset(self.fruitType, { anchorX: 0.5, anchorY: 0.5 }); // Set random falling speed self.speed = 3 + Math.random() * 4; // Speed between 3-7 self.rotationSpeed = (Math.random() - 0.5) * 0.1; // Random rotation // Track if fruit has been sliced self.isSliced = false; self.lastY = undefined; // Update method called every frame self.update = function () { if (!self.isSliced) { // Move fruit down self.y += self.speed; // Rotate fruit slightly fruitGraphics.rotation += self.rotationSpeed; } }; // Handle tap on fruit self.down = function (x, y, obj) { if (!self.isSliced) { self.sliceFruit(); } }; // Slice the fruit with animation self.sliceFruit = function () { self.isSliced = true; fruitsSliced++; // Play slice sound LK.getSound('slice').play(); // Add some visual feedback - brief scale up before shrinking tween(fruitGraphics, { scaleX: 1.3, scaleY: 1.3 }, { duration: 100, easing: tween.easeOut, onFinish: function onFinish() { // After scale up, animate fruit being sliced - scale down and fade out tween(self, { scaleX: 0.1, scaleY: 0.1, alpha: 0 }, { duration: 300, easing: tween.easeOut, onFinish: function onFinish() { self.destroy(); // Remove from fruits array for (var i = fruitsOnScreen.length - 1; i >= 0; i--) { if (fruitsOnScreen[i] === self) { fruitsOnScreen.splice(i, 1); break; } } } }); } }); }; return self; }); var Stain = Container.expand(function () { var self = Container.call(this); // Initialize with fruit type to determine color self.init = function (fruitType, x, y) { var stainColor = 0xFF0000; // Default red var stainSize = 30 + Math.random() * 20; // Random size between 30-50 // Set stain color based on fruit type switch (fruitType) { case 'apple': stainColor = 0xFF6B6B; // Light red break; case 'banana': stainColor = 0xFFEB3B; // Yellow break; case 'orange': stainColor = 0xFF9800; // Orange break; case 'grape': stainColor = 0x9C27B0; // Purple break; } // Create stain graphics var stainGraphics = LK.getAsset('street', { anchorX: 0.5, anchorY: 0.5, scaleX: stainSize / 150, scaleY: 0.3, tint: stainColor }); self.addChild(stainGraphics); self.x = x; self.y = y; // Fade in the stain self.alpha = 0; tween(self, { alpha: 0.7 }, { duration: 300, easing: tween.easeOut }); }; return self; }); /**** * Initialize Game ****/ // Game counters var game = new LK.Game({ backgroundColor: 0x87CEEB // Sky blue background }); /**** * Game Code ****/ // Game counters // Import tween plugin for fruit slice animations // Initialize fruit assets with different colors // Sound effects var fruitsSliced = 0; var fruitsMissed = 0; var fruitsOnScreen = []; var clouds = []; var stains = []; var cannonballs = []; var cannon; var currentLevel = 1; var gameWon = false; var street; var mouseX = 2048 / 2; var mouseY = 2732 / 2; // Spawn timing var spawnTimer = 0; var spawnRate = 120; // Spawn every 120 frames initially (2 seconds at 60fps) // Create UI text elements var slicedText = new Text2('Sliced: 0', { size: 60, fill: 0xFFFFFF }); slicedText.anchor.set(0, 0); slicedText.x = 50; slicedText.y = 150; LK.gui.topLeft.addChild(slicedText); var onScreenText = new Text2('On Screen: 0', { size: 60, fill: 0xFFFFFF }); onScreenText.anchor.set(0, 0); onScreenText.x = 50; onScreenText.y = 230; LK.gui.topLeft.addChild(onScreenText); var missedText = new Text2('Missed: 0', { size: 60, fill: 0xFFFFFF }); missedText.anchor.set(0, 0); missedText.x = 50; missedText.y = 310; LK.gui.topLeft.addChild(missedText); var levelText = new Text2('Level: 1', { size: 60, fill: 0xFFFFFF }); levelText.anchor.set(0, 0); levelText.x = 50; levelText.y = 390; LK.gui.topLeft.addChild(levelText); // Function to spawn new fruit function spawnFruit() { var fruit = new Fruit(); // Random X position across screen width fruit.x = 100 + Math.random() * (2048 - 200); fruit.y = -100; // Start above screen fruit.lastY = fruit.y; fruitsOnScreen.push(fruit); game.addChild(fruit); } // Function to spawn clouds function spawnCloud() { var cloud = new Cloud(); // Random X position starting from left side cloud.x = -100 + Math.random() * 200; // Random Y position in upper area of screen cloud.y = 100 + Math.random() * 300; clouds.push(cloud); game.addChild(cloud); } // Function to handle level progression function levelUp() { currentLevel++; gameWon = true; fruitsSliced = 0; // Reset sliced counter for new level spawnRate = Math.max(20, 120 - (currentLevel - 1) * 10); // Increase speed with each level LK.showYouWin(); } // Function to handle game over function gameOver() { currentLevel = 1; fruitsSliced = 0; fruitsMissed = 0; spawnRate = 120; gameWon = false; // Clear all fruits on screen for (var i = fruitsOnScreen.length - 1; i >= 0; i--) { fruitsOnScreen[i].destroy(); fruitsOnScreen.splice(i, 1); } // Clear all stains from street for (var s = stains.length - 1; s >= 0; s--) { stains[s].destroy(); stains.splice(s, 1); } // Clear all cannonballs for (var b = cannonballs.length - 1; b >= 0; b--) { cannonballs[b].destroy(); cannonballs.splice(b, 1); } LK.showGameOver(); } // Function to update UI counters function updateCounters() { slicedText.setText('Sliced: ' + fruitsSliced); onScreenText.setText('On Screen: ' + fruitsOnScreen.length); missedText.setText('Missed: ' + fruitsMissed); levelText.setText('Level: ' + currentLevel); } // Main game update loop game.update = function () { // Check win condition - 50 fruits sliced if (fruitsSliced >= 50 && !gameWon) { levelUp(); return; } // Check lose condition - 10 misses if (fruitsMissed >= 10) { gameOver(); return; } // Spawn new fruits spawnTimer++; if (spawnTimer >= spawnRate) { spawnFruit(); spawnTimer = 0; // Gradually increase difficulty by reducing spawn rate if (spawnRate > 30) { // Minimum spawn rate of 0.5 seconds spawnRate = Math.max(30, spawnRate - 1); } } // Check fruits for ground collision for (var i = fruitsOnScreen.length - 1; i >= 0; i--) { var fruit = fruitsOnScreen[i]; // Check if fruit hit the street (transition from above to street level) if (fruit.lastY < 2732 - 75 && fruit.y >= 2732 - 75 && !fruit.isSliced) { // Fruit missed - hit the street fruitsMissed++; LK.getSound('miss').play(); // Create stain on street where fruit hit var stain = new Stain(); stain.init(fruit.fruitType, fruit.x, 2732 - 75); stains.push(stain); game.addChild(stain); // Remove fruit from game fruit.destroy(); fruitsOnScreen.splice(i, 1); } // Update lastY for next frame fruit.lastY = fruit.y; } // Update UI counters updateCounters(); }; // Create street at bottom of screen street = game.addChild(LK.getAsset('street', { anchorX: 0.5, anchorY: 1 })); street.x = 2048 / 2; street.y = 2732; // Create cannon cannon = game.addChild(new Cannon()); // Mouse tracking for cannon aiming game.move = function (x, y, obj) { mouseX = x; mouseY = y; cannon.aimAt(mouseX, mouseY); }; // Cannon firing on click game.down = function (x, y, obj) { cannon.fire(); }; // Play background music LK.playMusic('tropical'); // Create initial clouds for (var c = 0; c < 4; c++) { spawnCloud(); } // Initial spawn of a few fruits spawnFruit(); spawnFruit();
===================================================================
--- original.js
+++ change.js
@@ -52,8 +52,10 @@
self.update = function () {
// Move cannonball
self.x += self.velocityX;
self.y += self.velocityY;
+ // Rotate cannonball on its own axis
+ ballGraphics.rotation += 0.2;
// Check collision with fruits
for (var i = fruitsOnScreen.length - 1; i >= 0; i--) {
var fruit = fruitsOnScreen[i];
if (self.intersects(fruit) && !fruit.isSliced) {
@@ -228,12 +230,12 @@
/****
* Game Code
****/
-// Sound effects
-// Initialize fruit assets with different colors
-// Import tween plugin for fruit slice animations
// Game counters
+// Import tween plugin for fruit slice animations
+// Initialize fruit assets with different colors
+// Sound effects
var fruitsSliced = 0;
var fruitsMissed = 0;
var fruitsOnScreen = [];
var clouds = [];
genera una uva en alta definición y con detalle cartoon. In-Game asset. 2d. High contrast. No shadows
banana cartoon stile. In-Game asset. 2d. High contrast. No shadows
crea una naranja estilo cartoon. In-Game asset. 2d. High contrast. No shadows
apple cartoon. In-Game asset. 2d. High contrast. No shadows
nubes. In-Game asset. 2d. High contrast. No shadows
knife. In-Game asset. 2d. High contrast. No shadows
cañon mirando hacia arriba [copia el dibujo menos lo mal dibujado]. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat