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: 48
User prompt
дистанция между кругами должна быть не меньше 500
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: 48
User prompt
круги не могут появляться на расстоянии 500 друг от друга
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
Code edit (1 edits merged)
Please save this source code
User prompt
скорость 50
User prompt
исправить ошибку, когда круг не исчезает
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: 47
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: 48
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: 44
User prompt
исправить ошибку, когда два круга накладываются друг на друга и круг не исчезает
User prompt
к последней проверки добавить, если игрок не нажал по экрану во время того как шар внутри круга, то game over
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of null (reading 'x')' in or related to this line: 'var dx = circle.x - x;' Line Number: 47
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of null (reading 'x')' in or related to this line: 'var dx = circle.x - x;' Line Number: 47
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: 44
User prompt
минимальная расстояния генерации нового круга 300 от текущего
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: 44
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: 44
User prompt
последующий создаваемый круг не может появиться ближе чем диаметр круга
User prompt
добавить прибавление одного очка в связи с последней добавленной проверкой
User prompt
сделать проверку, на наличие шара в круге текущего круга и круг который исчезает
User prompt
исправить ошибку, когда шар перемещается центра круга, но еще не вышел за рамки круга, а выходит gameover
User prompt
пока круг отображается и шар внутри этого отображаемого круга, при нажатии на экран gameover не выходит
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'getItem')' in or related to this line: 'var score = localStorage.getItem('score') || 0;' Line Number: 49
/**** * 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 > 10) { ball.x += dx / distance * 10; ball.y += dy / distance * 10; } else { var oldCircle = circle; circle = generateCircle(); LK.setTimeout(function () { oldCircle.destroy(); }, 300); } }; function generateCircle() { var x = Math.random() * (2048 - 300) + 150; var y = Math.random() * (2732 - 300) + 150; scored = false; return game.addChild(LK.getAsset('Circle', { anchorX: 0.5, anchorY: 0.5, x: x, y: y })); } var score = 0; var scored = false; var circle = generateCircle(); 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); } else if (circle.visible) { LK.showGameOver(); } };
===================================================================
--- original.js
+++ change.js
@@ -39,9 +39,9 @@
x: x,
y: y
}));
}
-var score = typeof localStorage !== 'undefined' ? localStorage.getItem('score') || 0 : 0;
+var score = 0;
var scored = false;
var circle = generateCircle();
var scoreTxt = new Text2('0', {
size: 80,
@@ -56,10 +56,8 @@
if (distance <= 150 && !scored) {
score++;
scored = true;
scoreTxt.setText(score);
- localStorage.setItem('score', score);
- } else {
+ } else if (circle.visible) {
LK.showGameOver();
- localStorage.setItem('score', 0);
}
};
\ No newline at end of file
Песочные часы, черный. 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.