User prompt
Сохранять набранное количество очков
User prompt
Game over появляется когда шар вне радиуса от 0 до 150 текущего и предыдущего круга
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of null (reading 'x')' in or related to this line: 'var dxOld = oldCircle.x - ball.x;' Line Number: 89
User prompt
если нажать на экран, в момент когда шар радиусе 150 текущего и предыдущего круга, то прибавлять очко, иначе gameover
User prompt
если нажать на экран, в момент когда шар диаметра 300 любого круга, то прибавлять очко, иначе gameover
User prompt
если нажать на экран, в момент когда шар радиусе 150 круга, то прибавлять очко, иначе gameover
User prompt
прибавлять одно очко, если нажатие по экрану было в радиусе 150 от центра любого круга
User prompt
исправить ошибку, когда если нажать на экран во время того когда шар не в круге прибавляется очко, вместо game over
User prompt
исправить ошибку, когда SCORE не изменился, хотя было нажатие по экрану во время того как шар был в круге
User prompt
сбрасывать таймер на 3, если изменился показатель SCORE
User prompt
исправить ошибку, когда таймер уже 0, а gameover не появилось
User prompt
исправить ошибку, когда одно очко прибавилось, но таймер не сбросился обратно на 3
User prompt
исправить ошибку, когда очко одно прибавилось, а таймер на 3 не сбросился
User prompt
исправить ошибку, когда таймер остается на 3 секундах, даже если очко не прибавляется
User prompt
добавить таймер с обратным отсчетом при старте игры от 3 до 0, если в течении этого времени не прибавилось очко, то gameover, если очко прибавилось, то таймер опять становится 3
User prompt
если шар пролетел круг и не было нажатие по экрану, то gameover
User prompt
скорость 30
User prompt
cкорость 80
User prompt
сохрянять очки для leaderboard
User prompt
исправить ошибку, когда два круга пересекаются в радиусе и круг не исчезает
User prompt
Please fix the bug: 'Timeout.tick error: Cannot read properties of null (reading 'destroy')' in or related to this line: 'oldCircle.destroy();' Line Number: 35
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'var dx = circle.x - x;' Line Number: 52
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'x')' in or related to this line: 'var dx = circle.x - x;' Line Number: 52
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'x')' in or related to this line: 'var dx = circle.x - x;' Line Number: 52
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'x')' in or related to this line: 'var dx = circle.x - x;' Line Number: 50
/**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x333333 }); /**** * Game Code ****/ var ball = game.addChild(LK.getAsset('ball', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 - 150 })); ball.update = function () { var dx = circle.x - ball.x; var dy = circle.y - ball.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance > 30) { ball.x += dx / distance * 30; ball.y += dy / distance * 30; } else { oldCircle = circle; circle = generateCircle(); if (oldCircle) { LK.setTimeout(function () { if (oldCircle) { oldCircle.destroy(); oldCircle = null; } }, 100); } } }; function generateCircle() { var x = Math.random() * (2048 - 300) + 150; var y = Math.random() * (2732 - 300) + 150; scored = false; var newCircle = game.addChild(LK.getAsset('Circle', { anchorX: 0.5, anchorY: 0.5, x: x, y: y })); if (oldCircle && newCircle.intersects(oldCircle)) { newCircle.destroy(); return generateCircle(); } return newCircle; } var score = 0; var scored = false; var oldCircle = null; var circle = generateCircle(); var countdown = 3; var countdownTxt = new Text2('3', { size: 80, fill: "#ffffff" }); countdownTxt.anchor.set(0, 0); LK.gui.topLeft.addChild(countdownTxt); var countdownTimer = LK.setInterval(function () { countdown--; countdownTxt.setText(countdown); if (countdown <= 0) { LK.clearInterval(countdownTimer); if (!scored) { LK.showGameOver(score); } } }, 1000); var scoreTxt = new Text2('0', { size: 80, fill: "#ffffff" }); scoreTxt.anchor.set(1, 0); LK.gui.topRight.addChild(scoreTxt); game.down = function (x, y, obj) { var dx = circle.x - ball.x; var dy = circle.y - ball.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance <= 150 && !scored) { score++; scored = true; scoreTxt.setText(score); countdown = 3; countdownTxt.setText(countdown); LK.clearInterval(countdownTimer); countdownTimer = LK.setInterval(function () { countdown--; countdownTxt.setText(countdown); if (countdown <= 0) { LK.clearInterval(countdownTimer); if (!scored) { LK.showGameOver(score); } } }, 1000); scored = false; // Reset the scored flag after the countdown timer is reset } else if (distance > 150) { if (oldCircle) { var dxOld = oldCircle.x - ball.x; var dyOld = oldCircle.y - ball.y; var distanceOld = Math.sqrt(dxOld * dxOld + dyOld * dyOld); if (distanceOld <= 150 && !scored) { score++; scored = true; scoreTxt.setText(score); return; } } LK.showGameOver(score); } };
===================================================================
--- original.js
+++ change.js
@@ -97,8 +97,9 @@
LK.showGameOver(score);
}
}
}, 1000);
+ scored = false; // Reset the scored flag after the countdown timer is reset
} else if (distance > 150) {
if (oldCircle) {
var dxOld = oldCircle.x - ball.x;
var dyOld = oldCircle.y - ball.y;
Песочные часы, черный. 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.
Шарик в круге, черный, иконка. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Carrot, черный цвет. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.