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']; // Pie system variables var fruitInventory = { apple: 0, orange: 0, banana: 0, cherry: 0 }; // Pie recipes - what fruits needed for each pie var pieRecipes = { applePie: { apple: 5, cost: { apple: 5 }, points: 100, color: 0x00FF00 }, cherryPie: { cherry: 3, cost: { cherry: 3 }, points: 150, color: 0xFF0000 }, fruitSalad: { apple: 2, orange: 2, banana: 1, cost: { apple: 2, orange: 2, banana: 1 }, points: 200, color: 0xFFFF00 }, mixedPie: { apple: 1, orange: 1, banana: 1, cherry: 1, cost: { apple: 1, orange: 1, banana: 1, cherry: 1 }, points: 250, color: 0xFF00FF } }; var completedPies = 0; // 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); // Fruit inventory display var inventoryTxt = new Text2('Fruits: A:0 O:0 B:0 C:0', { size: 50, fill: 0xFFFFFF }); inventoryTxt.anchor.set(0, 1); LK.gui.bottomLeft.addChild(inventoryTxt); // Pie counter display var piesTxt = new Text2('Pies Made: 0', { size: 50, fill: 0xFFFF00 }); piesTxt.anchor.set(1, 1); LK.gui.bottomRight.addChild(piesTxt); // Recipe notification area var recipeTxt = new Text2('', { size: 40, fill: 0x00FF00 }); recipeTxt.anchor.set(0.5, 0); recipeTxt.y = 150; LK.gui.top.addChild(recipeTxt); // 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 fruit inventory display function updateInventoryDisplay() { inventoryTxt.setText('Fruits: A:' + fruitInventory.apple + ' O:' + fruitInventory.orange + ' B:' + fruitInventory.banana + ' C:' + fruitInventory.cherry); } // Check if we can make any pies function checkPieRecipes() { for (var pieType in pieRecipes) { var recipe = pieRecipes[pieType]; var canMake = true; // Check if we have enough of each required fruit for (var fruitType in recipe.cost) { if (fruitInventory[fruitType] < recipe.cost[fruitType]) { canMake = false; break; } } if (canMake) { makePie(pieType, recipe); return; // Only make one pie at a time } } } // Make a pie and consume fruits function makePie(pieType, recipe) { // Consume the required fruits for (var fruitType in recipe.cost) { fruitInventory[fruitType] -= recipe.cost[fruitType]; } // Add points and update displays LK.setScore(LK.getScore() + recipe.points); scoreTxt.setText('Score: ' + LK.getScore()); completedPies++; piesTxt.setText('Pies Made: ' + completedPies); // Show pie creation notification var pieNames = { applePie: 'Apple Pie', cherryPie: 'Cherry Pie', fruitSalad: 'Fruit Salad', mixedPie: 'Mixed Pie' }; recipeTxt.setText(pieNames[pieType] + ' Made! +' + recipe.points + ' pts'); recipeTxt.tint = recipe.color; // Flash screen with pie color LK.effects.flashScreen(recipe.color, 800); // Clear notification after 2 seconds LK.setTimeout(function () { recipeTxt.setText(''); }, 2000); updateInventoryDisplay(); } // 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()); // Add fruit to inventory fruitInventory[fruit.fruitType]++; updateInventoryDisplay(); // Check if we can make any pies checkPieRecipes(); // 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 - make 10 pies or reach 2000 points if (completedPies >= 10 || LK.getScore() >= 2000) { LK.showYouWin(); } }; // Start background music LK.playMusic('bgmusic');
===================================================================
--- original.js
+++ change.js
@@ -80,8 +80,61 @@
var gameSpeed = 1;
var level = 1;
// Fruit types for random selection
var fruitTypes = ['apple', 'orange', 'banana', 'cherry'];
+// Pie system variables
+var fruitInventory = {
+ apple: 0,
+ orange: 0,
+ banana: 0,
+ cherry: 0
+};
+// Pie recipes - what fruits needed for each pie
+var pieRecipes = {
+ applePie: {
+ apple: 5,
+ cost: {
+ apple: 5
+ },
+ points: 100,
+ color: 0x00FF00
+ },
+ cherryPie: {
+ cherry: 3,
+ cost: {
+ cherry: 3
+ },
+ points: 150,
+ color: 0xFF0000
+ },
+ fruitSalad: {
+ apple: 2,
+ orange: 2,
+ banana: 1,
+ cost: {
+ apple: 2,
+ orange: 2,
+ banana: 1
+ },
+ points: 200,
+ color: 0xFFFF00
+ },
+ mixedPie: {
+ apple: 1,
+ orange: 1,
+ banana: 1,
+ cherry: 1,
+ cost: {
+ apple: 1,
+ orange: 1,
+ banana: 1,
+ cherry: 1
+ },
+ points: 250,
+ color: 0xFF00FF
+ }
+};
+var completedPies = 0;
// Create ground
var ground = game.addChild(LK.getAsset('ground', {
anchorX: 0,
anchorY: 0,
@@ -110,8 +163,30 @@
fill: 0xFFFFFF
});
levelTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(levelTxt);
+// Fruit inventory display
+var inventoryTxt = new Text2('Fruits: A:0 O:0 B:0 C:0', {
+ size: 50,
+ fill: 0xFFFFFF
+});
+inventoryTxt.anchor.set(0, 1);
+LK.gui.bottomLeft.addChild(inventoryTxt);
+// Pie counter display
+var piesTxt = new Text2('Pies Made: 0', {
+ size: 50,
+ fill: 0xFFFF00
+});
+piesTxt.anchor.set(1, 1);
+LK.gui.bottomRight.addChild(piesTxt);
+// Recipe notification area
+var recipeTxt = new Text2('', {
+ size: 40,
+ fill: 0x00FF00
+});
+recipeTxt.anchor.set(0.5, 0);
+recipeTxt.y = 150;
+LK.gui.top.addChild(recipeTxt);
// Touch controls for basket movement
var isDragging = false;
game.down = function (x, y, obj) {
isDragging = true;
@@ -134,8 +209,58 @@
fruit.y = -50; // Start above screen
fruits.push(fruit);
game.addChild(fruit);
}
+// Update fruit inventory display
+function updateInventoryDisplay() {
+ inventoryTxt.setText('Fruits: A:' + fruitInventory.apple + ' O:' + fruitInventory.orange + ' B:' + fruitInventory.banana + ' C:' + fruitInventory.cherry);
+}
+// Check if we can make any pies
+function checkPieRecipes() {
+ for (var pieType in pieRecipes) {
+ var recipe = pieRecipes[pieType];
+ var canMake = true;
+ // Check if we have enough of each required fruit
+ for (var fruitType in recipe.cost) {
+ if (fruitInventory[fruitType] < recipe.cost[fruitType]) {
+ canMake = false;
+ break;
+ }
+ }
+ if (canMake) {
+ makePie(pieType, recipe);
+ return; // Only make one pie at a time
+ }
+ }
+}
+// Make a pie and consume fruits
+function makePie(pieType, recipe) {
+ // Consume the required fruits
+ for (var fruitType in recipe.cost) {
+ fruitInventory[fruitType] -= recipe.cost[fruitType];
+ }
+ // Add points and update displays
+ LK.setScore(LK.getScore() + recipe.points);
+ scoreTxt.setText('Score: ' + LK.getScore());
+ completedPies++;
+ piesTxt.setText('Pies Made: ' + completedPies);
+ // Show pie creation notification
+ var pieNames = {
+ applePie: 'Apple Pie',
+ cherryPie: 'Cherry Pie',
+ fruitSalad: 'Fruit Salad',
+ mixedPie: 'Mixed Pie'
+ };
+ recipeTxt.setText(pieNames[pieType] + ' Made! +' + recipe.points + ' pts');
+ recipeTxt.tint = recipe.color;
+ // Flash screen with pie color
+ LK.effects.flashScreen(recipe.color, 800);
+ // Clear notification after 2 seconds
+ LK.setTimeout(function () {
+ recipeTxt.setText('');
+ }, 2000);
+ updateInventoryDisplay();
+}
// Update difficulty based on score
function updateDifficulty() {
var newLevel = Math.floor(LK.getScore() / 200) + 1;
if (newLevel > level) {
@@ -161,8 +286,13 @@
if (fruit.intersects(basket)) {
// Fruit caught!
LK.setScore(LK.getScore() + fruit.points);
scoreTxt.setText('Score: ' + LK.getScore());
+ // Add fruit to inventory
+ fruitInventory[fruit.fruitType]++;
+ updateInventoryDisplay();
+ // Check if we can make any pies
+ checkPieRecipes();
// Flash basket green briefly
LK.effects.flashObject(basket, 0x00FF00, 300);
LK.getSound('catch').play();
fruit.destroy();
@@ -194,10 +324,10 @@
}
}
// Update difficulty
updateDifficulty();
- // Check win condition (optional - could be endless)
- if (LK.getScore() >= 1000) {
+ // Check win condition - make 10 pies or reach 2000 points
+ if (completedPies >= 10 || LK.getScore() >= 2000) {
LK.showYouWin();
}
};
// Start background music
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