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
добавить задний фон
===================================================================
--- original.js
+++ change.js
@@ -105,23 +105,11 @@
var speedY = (pos.y - lastTouchPosition.y) / 10;
ball.launch(speedX, speedY);
}
});
-var stationaryTimer = null;
+var ballStoppedTimer = null;
LK.on('tick', function () {
ball.update();
- if (!ball.isMoving && ball.speedX == 0 && ball.speedY == 0) {
- if (!stationaryTimer) {
- stationaryTimer = LK.setTimeout(function () {
- LK.showGameOver();
- }, 1000);
- }
- } else {
- if (stationaryTimer) {
- LK.clearTimeout(stationaryTimer);
- stationaryTimer = null;
- }
- }
// Check for collisions with baskets
baskets.forEach(function (basket) {
if (ball.intersects(basket)) {
LK.effects.flashScreen(0x00FF00, 500); // Flash green for success
@@ -152,5 +140,21 @@
ball.speedY *= -0.8; // Decrease speed by 10% after bouncing
ball.speedY *= 0.75; // Decrease the next bounce by 20%
ball.bounceCount++; // Increment bounce counter
}
+ // Check if the ball has stopped moving
+ if (ball.speedX === 0 && ball.speedY === 0) {
+ // Start a timer if it's not already started
+ if (!ballStoppedTimer) {
+ ballStoppedTimer = LK.setTimeout(function () {
+ // Trigger game over if the ball has been stopped for 1 second
+ LK.showGameOver();
+ }, 1000);
+ }
+ } else {
+ // Clear the timer if the ball starts moving again
+ if (ballStoppedTimer) {
+ LK.clearTimeout(ballStoppedTimer);
+ ballStoppedTimer = null;
+ }
+ }
});
\ No newline at end of file
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.