User prompt
but increase your size
User prompt
Fruits should be max 45 min 30. the altitude they ascended to.
User prompt
Now slow it down a bit.
User prompt
reduce fruit sizes.
User prompt
enlarge clickable area. But let the fruits not grow, once you press on them, they will split in half.
User prompt
enlarge clickable area.
User prompt
Make it more clickable.
User prompt
It just changes the direction the cut fruits go. Let them go in the exact opposite direction.
User prompt
It just changes the direction the cut fruits go.
User prompt
You did it up, do it in the opposite direction.
User prompt
Let the fruits split in half under pressure and the divided pieces fall down.
User prompt
Increase the size of fruits.
User prompt
Add 10 different fruits
User prompt
min 30 max 45
User prompt
min 30 max 40
User prompt
min 30 max 60
User prompt
Set the minimum and maximum height that the fruits will reach.
Code edit (1 edits merged)
Please save this source code
User prompt
Reduce gravity a little.
User prompt
Increase your jump height slightly.
User prompt
It happened now. Now all you have to do is the gravitational effect of the fruits.
User prompt
Lower the starting point of the fruits, they start quite high in the image.
User prompt
lower it even further
User prompt
y=-2300
User prompt
In the image, the place you placed is quite high up. If you move it down, you will be told to stop.
/**** * Classes ****/ //<Assets used in the game will automatically appear here> //<Write imports for supported plugins here> // Fruit class representing the fruits to be sliced var Fruit = Container.expand(function () { var self = Container.call(this); var fruitGraphics = self.attachAsset('fruit' + Math.ceil(Math.random() * 10), { anchorX: 0.5, anchorY: 0.5, scaleX: 2, scaleY: 2 }); self.speed = Math.random() * 10 + 20; // Set the minimum and maximum height that the fruits will reach self.direction = Math.random() * Math.PI * 2; // Random direction for each fruit // Update function to move the fruit self.update = function () { self.speed -= 0.4; // Decrease speed to simulate gravity self.y -= self.speed; // Make the fruit rise by decreasing its y-coordinate self.rotation += 0.1; // Add rotation to create a rising animation // Check if the fruit is out of bounds if (self.y < 0) { self.destroy(); } }; // Add containsPoint method to check if a point is inside the fruit self.containsPoint = function (point) { var dx = point.x - self.x; var dy = point.y - self.y; return dx * dx + dy * dy <= fruitGraphics.width * 1.5 * (fruitGraphics.width * 1.5) / 4; }; }); // Class for the split fruit pieces var SplitFruit = Container.expand(function () { var self = Container.call(this); var splitFruitGraphics = self.attachAsset('fruit' + Math.ceil(Math.random() * 10), { anchorX: 0.5, anchorY: 0.5, scaleX: 1.5, scaleY: 1.5 }); self.speed = Math.random() * 3 + 5; // Set the speed of the falling pieces self.direction = Math.random() * Math.PI + Math.PI; // Random direction for each piece in the opposite direction // Update function to move the fruit piece self.update = function () { self.speed -= 0.2; // Decrease speed to simulate gravity self.y += self.speed; // Make the piece fall by increasing its y-coordinate self.rotation += 0.1; // Add rotation to create a falling animation // Check if the piece is out of bounds if (self.y > 2732) { self.destroy(); } }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87CEEB // Light blue background to simulate sky }); /**** * Game Code ****/ // Initialize variables var fruits = []; var score = 0; var scoreTxt = new Text2('0', { size: 150, fill: 0xFFFFFF }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // Function to spawn a new fruit function spawnFruit() { var newFruit = new Fruit(); newFruit.x = Math.random() * 2048; newFruit.y = Math.random() * 100 + 2732; // Start from the bottom of the screen fruits.push(newFruit); game.addChild(newFruit); } // Function to handle slicing function sliceFruit(x, y) { for (var i = fruits.length - 1; i >= 0; i--) { if (fruits[i].containsPoint({ x: x, y: y })) { // Create two split fruit pieces when a fruit is sliced var splitFruit1 = new SplitFruit(); splitFruit1.x = fruits[i].x; splitFruit1.y = fruits[i].y; splitFruit1.direction = Math.random() * Math.PI; // Random direction for each piece game.addChild(splitFruit1); var splitFruit2 = new SplitFruit(); splitFruit2.x = fruits[i].x; splitFruit2.y = fruits[i].y; splitFruit2.direction = Math.random() * Math.PI; // Random direction for each piece game.addChild(splitFruit2); fruits[i].destroy(); fruits.splice(i, 1); score += 10; scoreTxt.setText(score); } } } // Set up game events game.down = function (x, y, obj) { sliceFruit(x, y); }; // Update function called every tick game.update = function () { for (var i = fruits.length - 1; i >= 0; i--) { fruits[i].update(); } // Spawn a new fruit every 60 ticks if (LK.ticks % 60 === 0) { spawnFruit(); } // Update the split fruit pieces for (var i = game.children.length - 1; i >= 0; i--) { if (game.children[i] instanceof SplitFruit) { game.children[i].update(); } } };
===================================================================
--- original.js
+++ change.js
@@ -11,9 +11,9 @@
anchorY: 0.5,
scaleX: 2,
scaleY: 2
});
- self.speed = Math.random() * 15 + 30; // Set the minimum and maximum height that the fruits will reach
+ self.speed = Math.random() * 10 + 20; // Set the minimum and maximum height that the fruits will reach
self.direction = Math.random() * Math.PI * 2; // Random direction for each fruit
// Update function to move the fruit
self.update = function () {
self.speed -= 0.4; // Decrease speed to simulate gravity
@@ -39,9 +39,9 @@
anchorY: 0.5,
scaleX: 1.5,
scaleY: 1.5
});
- self.speed = Math.random() * 5 + 10; // Set the speed of the falling pieces
+ self.speed = Math.random() * 3 + 5; // Set the speed of the falling pieces
self.direction = Math.random() * Math.PI + Math.PI; // Random direction for each piece in the opposite direction
// Update function to move the fruit piece
self.update = function () {
self.speed -= 0.2; // Decrease speed to simulate gravity
animation orange. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
animation banana transparent back. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
bomba. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
çilek. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
açık kahve rengi tahta çizikli. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
diagonal white line. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
2d meyve suyu patlaması. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.