User prompt
если мяч после броска не двигается в течении секунды, game over
User prompt
если мяч после броска не двигается в течении секунды, game over
User prompt
если мяч не двигается в течении секунды, game over
Code edit (1 edits merged)
Please save this source code
User prompt
сторона вращения мяча меняется в зависимости от направления мяча
User prompt
добавить вращение мяча
User prompt
исправить ошибку, когда ияч застревает наверху
User prompt
исправить ошибку, когда мяч не отскакиевает от пола
Code edit (3 edits merged)
Please save this source code
User prompt
всего может быть 15 отскоков и потом мяч останавливается
User prompt
с каждым отскоком скорость мяча уменьшается на 10 процентов и каждый следующий отскок уменьшает следующий отскок на 20 процентов
User prompt
с каждым отскоком, скорость мяча уменьшается на 10 процентов
User prompt
исправить ошибку, когда мяч не отскакивает от стены, а застревает в нем
Code edit (1 edits merged)
Please save this source code
User prompt
с каждым отскоком, следующий отскок уменьшается на 8 процентов
User prompt
с каждым отскоком скорость мяча уменьшается
User prompt
добавить отсткоки от стен
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
после любого отскока, скорость мяча уменьшается в 1,5 раза
User prompt
добавить физику отскока мяча
User prompt
после отскока, скорость мяча уменьшается в 1.6 раза
User prompt
добавить отскок от стен, потолка и пола
Code edit (1 edits merged)
Please save this source code
User prompt
добавить задний фон
/**** * Classes ****/ // Assets will be automatically created based on usage in the code. // Ball class var Ball = Container.expand(function () { var self = Container.call(this); var ballGraphics = self.attachAsset('ball', { anchorX: 0.5, anchorY: 0.5 }); self.speedX = 0; self.speedY = 0; self.isMoving = false; self.launch = function (speedX, speedY) { self.speedX = speedX; self.speedY = speedY; self.isMoving = true; }; self.bounceCount = 0; // Initialize bounce counter self.update = function () { if (self.isMoving) { self.x += self.speedX; self.y += self.speedY; self.speedY += 0.98; // Gravity effect if (self.bounceCount >= 15) { // Stop the ball after 15 bounces self.speedX = 0; self.speedY = 0; self.isMoving = false; } } }; self.reset = function () { self.x = 400; // Center horizontally self.y = 1800; // Start position near bottom self.speedX = 0; self.speedY = 0; self.isMoving = false; }; }); // Basket class var Basket = Container.expand(function () { var self = Container.call(this); var basketGraphics = self.attachAsset('basket', { anchorX: 0.5, anchorY: 0.5 }); }); // Player class var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.attachAsset('Player', { anchorX: 0.5, anchorY: 0.5 }); }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87CEEB // Light blue background }); /**** * Game Code ****/ var background = game.addChild(LK.getAsset('Background', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2 })); var player = game.addChild(new Player()); player.x = player.width / 2; // Position on the left side of the screen player.y = 2732 - player.height / 2; // Position at the bottom of the screen var ball = game.addChild(new Ball()); ball.x = 400; ball.y = 1800; var baskets = []; var basket = game.addChild(new Basket()); basket.x = 2048 - basket.width / 2; // Position on the right side of the screen basket.y = 2732 / 2; // Center vertically baskets.push(basket); var lastTouchPosition = { x: 0, y: 0 }; game.on('down', function (obj) { var pos = obj.event.getLocalPosition(game); lastTouchPosition.x = pos.x; lastTouchPosition.y = pos.y; }); game.on('up', function (obj) { if (!ball.isMoving) { var pos = obj.event.getLocalPosition(game); var speedX = (pos.x - lastTouchPosition.x) / 10; var speedY = (pos.y - lastTouchPosition.y) / 10; ball.launch(speedX, speedY); } }); LK.on('tick', function () { ball.update(); // Check for collisions with baskets baskets.forEach(function (basket) { if (ball.intersects(basket)) { LK.effects.flashScreen(0x00FF00, 500); // Flash green for success ball.reset(); } }); // Bounce off the walls and ceiling if (ball.x < 0) { ball.x = 0; // Move the ball out of the wall ball.speedX *= -0.9; // Decrease speed by 10% after bouncing ball.speedX *= 0.75; // Decrease the next bounce by 20% ball.bounceCount++; // Increment bounce counter } if (ball.x > 2048) { ball.x = 2048; // Move the ball out of the wall ball.speedX *= -0.9; // Decrease speed by 10% after bouncing ball.speedX *= 0.75; // Decrease the next bounce by 20% ball.bounceCount++; // Increment bounce counter } if (ball.y < 0) { ball.speedY *= -0.9; // Decrease speed by 10% after bouncing ball.speedY *= 0.75; // Decrease the next bounce by 20% ball.bounceCount++; // Increment bounce counter } if (ball.y > 2732) { ball.y = 2732; // Move the ball out of the floor ball.speedY *= -0.9; // Decrease speed by 10% after bouncing ball.speedY *= 0.75; // Decrease the next bounce by 20% ball.bounceCount++; // Increment bounce counter } });
===================================================================
--- original.js
+++ change.js
@@ -127,8 +127,9 @@
ball.speedY *= 0.75; // Decrease the next bounce by 20%
ball.bounceCount++; // Increment bounce counter
}
if (ball.y > 2732) {
+ ball.y = 2732; // Move the ball out of the floor
ball.speedY *= -0.9; // Decrease speed by 10% after bouncing
ball.speedY *= 0.75; // Decrease the next bounce by 20%
ball.bounceCount++; // Increment bounce counter
}
Basket. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Стена белая синия. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
граффити слово Swipe. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Граффити с текстом "after three bounces of the ball, a goal is scored". Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.