User prompt
Agranda la cesta ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Haz que las frutas sean más grandes ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Haz que el fondo sea "cat_damage"
User prompt
Haz que cuando hagas un pastel suene "cake_icon"
User prompt
Añade que cuando crees un pastel aparezca "cake_icon" ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Y que se quede en su lugar,es muy grande
User prompt
Arregla que el suelo se queda abajo
User prompt
Ok,lo puedes hacer,como que nesesitas X frutas para hacer X tarta si tienes 3 cerezas hacer una tarta roja (EJEMPLO)
Code edit (1 edits merged)
Please save this source code
User prompt
Fruit Catcher: Sky Pie
Initial prompt
Tienes que recoger frutas que caen del cielo,¿tu objetivo? No dejar que se caigan y hacer un pie (o pastel)
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Basket = Container.expand(function () { var self = Container.call(this); var basketGraphics = self.attachAsset('basket', { anchorX: 0.5, anchorY: 0.5 }); return self; }); var Fruit = Container.expand(function () { var self = Container.call(this); self.fruitType = 'apple'; self.fallSpeed = 3; self.points = 10; self.init = function (type) { self.fruitType = type; // Set properties based on fruit type switch (type) { case 'apple': self.fruitGraphics = self.attachAsset('apple', { anchorX: 0.5, anchorY: 0.5 }); self.points = 10; break; case 'orange': self.fruitGraphics = self.attachAsset('orange', { anchorX: 0.5, anchorY: 0.5 }); self.points = 15; break; case 'banana': self.fruitGraphics = self.attachAsset('banana', { anchorX: 0.5, anchorY: 0.5 }); self.points = 20; break; case 'cherry': self.fruitGraphics = self.attachAsset('cherry', { anchorX: 0.5, anchorY: 0.5 }); self.points = 25; break; } self.fallSpeed = Math.random() * 2 + 2; // Random speed between 2-4 }; self.update = function () { self.y += self.fallSpeed; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87CEEB }); /**** * Game Code ****/ // Game variables var basket; var fruits = []; var missedFruits = 0; var maxMissedFruits = 5; var fruitSpawnTimer = 0; var fruitSpawnRate = 90; // Spawn every 90 ticks initially var gameSpeed = 1; var level = 1; // Fruit types for random selection var fruitTypes = ['apple', 'orange', 'banana', 'cherry']; // Create ground var ground = game.addChild(LK.getAsset('ground', { anchorX: 0, anchorY: 0, x: 0, y: 2632 })); // Create and position basket basket = game.addChild(new Basket()); basket.x = 1024; // Center horizontally basket.y = 2500; // Near bottom but above ground // Create UI elements var scoreTxt = new Text2('Score: 0', { size: 80, fill: 0xFFFFFF }); scoreTxt.anchor.set(0, 0); LK.gui.topRight.addChild(scoreTxt); var livesTxt = new Text2('Lives: ' + (maxMissedFruits - missedFruits), { size: 80, fill: 0xFFFFFF }); livesTxt.anchor.set(1, 0); LK.gui.topLeft.addChild(livesTxt); var levelTxt = new Text2('Level: ' + level, { size: 60, fill: 0xFFFFFF }); levelTxt.anchor.set(0.5, 0); LK.gui.top.addChild(levelTxt); // Touch controls for basket movement var isDragging = false; game.down = function (x, y, obj) { isDragging = true; basket.x = x; }; game.move = function (x, y, obj) { if (isDragging) { basket.x = Math.max(100, Math.min(1948, x)); // Keep basket within screen bounds } }; game.up = function (x, y, obj) { isDragging = false; }; // Spawn fruit function function spawnFruit() { var fruit = new Fruit(); var randomType = fruitTypes[Math.floor(Math.random() * fruitTypes.length)]; fruit.init(randomType); fruit.x = Math.random() * 1848 + 100; // Random x position within screen bounds fruit.y = -50; // Start above screen fruits.push(fruit); game.addChild(fruit); } // Update difficulty based on score function updateDifficulty() { var newLevel = Math.floor(LK.getScore() / 200) + 1; if (newLevel > level) { level = newLevel; levelTxt.setText('Level: ' + level); // Increase difficulty fruitSpawnRate = Math.max(30, fruitSpawnRate - 10); // Faster spawning, minimum 30 ticks gameSpeed = Math.min(2, 1 + (level - 1) * 0.2); // Increase game speed } } // Main game update loop game.update = function () { // Spawn fruits fruitSpawnTimer++; if (fruitSpawnTimer >= fruitSpawnRate) { spawnFruit(); fruitSpawnTimer = 0; } // Update fruits and check collisions for (var i = fruits.length - 1; i >= 0; i--) { var fruit = fruits[i]; // Check if fruit was caught by basket if (fruit.intersects(basket)) { // Fruit caught! LK.setScore(LK.getScore() + fruit.points); scoreTxt.setText('Score: ' + LK.getScore()); // Flash basket green briefly LK.effects.flashObject(basket, 0x00FF00, 300); LK.getSound('catch').play(); fruit.destroy(); fruits.splice(i, 1); continue; } // Check if fruit hit the ground if (fruit.y > 2580) { // Ground level minus some buffer // Fruit missed! missedFruits++; livesTxt.setText('Lives: ' + (maxMissedFruits - missedFruits)); // Flash screen red briefly LK.effects.flashScreen(0xFF0000, 500); LK.getSound('miss').play(); fruit.destroy(); fruits.splice(i, 1); // Check game over condition if (missedFruits >= maxMissedFruits) { LK.showGameOver(); return; } continue; } // Remove fruits that are way off screen if (fruit.y > 2800) { fruit.destroy(); fruits.splice(i, 1); } } // Update difficulty updateDifficulty(); // Check win condition (optional - could be endless) if (LK.getScore() >= 1000) { LK.showYouWin(); } }; // Start background music LK.playMusic('bgmusic');
===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,204 @@
-/****
+/****
+* Plugins
+****/
+var tween = LK.import("@upit/tween.v1");
+
+/****
+* Classes
+****/
+var Basket = Container.expand(function () {
+ var self = Container.call(this);
+ var basketGraphics = self.attachAsset('basket', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ return self;
+});
+var Fruit = Container.expand(function () {
+ var self = Container.call(this);
+ self.fruitType = 'apple';
+ self.fallSpeed = 3;
+ self.points = 10;
+ self.init = function (type) {
+ self.fruitType = type;
+ // Set properties based on fruit type
+ switch (type) {
+ case 'apple':
+ self.fruitGraphics = self.attachAsset('apple', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.points = 10;
+ break;
+ case 'orange':
+ self.fruitGraphics = self.attachAsset('orange', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.points = 15;
+ break;
+ case 'banana':
+ self.fruitGraphics = self.attachAsset('banana', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.points = 20;
+ break;
+ case 'cherry':
+ self.fruitGraphics = self.attachAsset('cherry', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.points = 25;
+ break;
+ }
+ self.fallSpeed = Math.random() * 2 + 2; // Random speed between 2-4
+ };
+ self.update = function () {
+ self.y += self.fallSpeed;
+ };
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0x87CEEB
+});
+
+/****
+* Game Code
+****/
+// Game variables
+var basket;
+var fruits = [];
+var missedFruits = 0;
+var maxMissedFruits = 5;
+var fruitSpawnTimer = 0;
+var fruitSpawnRate = 90; // Spawn every 90 ticks initially
+var gameSpeed = 1;
+var level = 1;
+// Fruit types for random selection
+var fruitTypes = ['apple', 'orange', 'banana', 'cherry'];
+// Create ground
+var ground = game.addChild(LK.getAsset('ground', {
+ anchorX: 0,
+ anchorY: 0,
+ x: 0,
+ y: 2632
+}));
+// Create and position basket
+basket = game.addChild(new Basket());
+basket.x = 1024; // Center horizontally
+basket.y = 2500; // Near bottom but above ground
+// Create UI elements
+var scoreTxt = new Text2('Score: 0', {
+ size: 80,
+ fill: 0xFFFFFF
+});
+scoreTxt.anchor.set(0, 0);
+LK.gui.topRight.addChild(scoreTxt);
+var livesTxt = new Text2('Lives: ' + (maxMissedFruits - missedFruits), {
+ size: 80,
+ fill: 0xFFFFFF
+});
+livesTxt.anchor.set(1, 0);
+LK.gui.topLeft.addChild(livesTxt);
+var levelTxt = new Text2('Level: ' + level, {
+ size: 60,
+ fill: 0xFFFFFF
+});
+levelTxt.anchor.set(0.5, 0);
+LK.gui.top.addChild(levelTxt);
+// Touch controls for basket movement
+var isDragging = false;
+game.down = function (x, y, obj) {
+ isDragging = true;
+ basket.x = x;
+};
+game.move = function (x, y, obj) {
+ if (isDragging) {
+ basket.x = Math.max(100, Math.min(1948, x)); // Keep basket within screen bounds
+ }
+};
+game.up = function (x, y, obj) {
+ isDragging = false;
+};
+// Spawn fruit function
+function spawnFruit() {
+ var fruit = new Fruit();
+ var randomType = fruitTypes[Math.floor(Math.random() * fruitTypes.length)];
+ fruit.init(randomType);
+ fruit.x = Math.random() * 1848 + 100; // Random x position within screen bounds
+ fruit.y = -50; // Start above screen
+ fruits.push(fruit);
+ game.addChild(fruit);
+}
+// Update difficulty based on score
+function updateDifficulty() {
+ var newLevel = Math.floor(LK.getScore() / 200) + 1;
+ if (newLevel > level) {
+ level = newLevel;
+ levelTxt.setText('Level: ' + level);
+ // Increase difficulty
+ fruitSpawnRate = Math.max(30, fruitSpawnRate - 10); // Faster spawning, minimum 30 ticks
+ gameSpeed = Math.min(2, 1 + (level - 1) * 0.2); // Increase game speed
+ }
+}
+// Main game update loop
+game.update = function () {
+ // Spawn fruits
+ fruitSpawnTimer++;
+ if (fruitSpawnTimer >= fruitSpawnRate) {
+ spawnFruit();
+ fruitSpawnTimer = 0;
+ }
+ // Update fruits and check collisions
+ for (var i = fruits.length - 1; i >= 0; i--) {
+ var fruit = fruits[i];
+ // Check if fruit was caught by basket
+ if (fruit.intersects(basket)) {
+ // Fruit caught!
+ LK.setScore(LK.getScore() + fruit.points);
+ scoreTxt.setText('Score: ' + LK.getScore());
+ // Flash basket green briefly
+ LK.effects.flashObject(basket, 0x00FF00, 300);
+ LK.getSound('catch').play();
+ fruit.destroy();
+ fruits.splice(i, 1);
+ continue;
+ }
+ // Check if fruit hit the ground
+ if (fruit.y > 2580) {
+ // Ground level minus some buffer
+ // Fruit missed!
+ missedFruits++;
+ livesTxt.setText('Lives: ' + (maxMissedFruits - missedFruits));
+ // Flash screen red briefly
+ LK.effects.flashScreen(0xFF0000, 500);
+ LK.getSound('miss').play();
+ fruit.destroy();
+ fruits.splice(i, 1);
+ // Check game over condition
+ if (missedFruits >= maxMissedFruits) {
+ LK.showGameOver();
+ return;
+ }
+ continue;
+ }
+ // Remove fruits that are way off screen
+ if (fruit.y > 2800) {
+ fruit.destroy();
+ fruits.splice(i, 1);
+ }
+ }
+ // Update difficulty
+ updateDifficulty();
+ // Check win condition (optional - could be endless)
+ if (LK.getScore() >= 1000) {
+ LK.showYouWin();
+ }
+};
+// Start background music
+LK.playMusic('bgmusic');
\ No newline at end of file
Banana cute. In-Game asset. 2d. High contrast. No shadows
Manzana cute. In-Game asset. 2d. High contrast. No shadows
Una cereza roja,la fruta que va en la punta del pastel. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
Naranja cute. In-Game asset. 2d. High contrast. No shadows
Pastel :D. In-Game asset. 2d. High contrast. No shadows
Suelo con tierra y cesped. In-Game asset. 2d. High contrast. No shadows
Fondo de pastelería. In-Game asset. 2d. High contrast. No shadows
Chef con una cesta en la mano. In-Game asset. 2d. High contrast. No shadows