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 > 50) {
ball.x += dx / distance * 50;
ball.y += dy / distance * 50;
} else {
oldCircle = circle;
circle = generateCircle();
if (oldCircle) {
LK.setTimeout(function () {
if (oldCircle) {
oldCircle.destroy();
oldCircle = null;
}
}, 100);
}
}
};
function generateCircle() {
var x, y;
do {
x = Math.random() * (2048 - 300) + 150;
y = Math.random() * (2732 - 300) + 150;
var dx = circle.x - x;
var dy = circle.y - y;
var distance = Math.sqrt(dx * dx + dy * dy);
} while (distance < 500);
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 oldCircle = null;
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 (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();
}
}; ===================================================================
--- original.js
+++ change.js
@@ -34,10 +34,16 @@
}
}
};
function generateCircle() {
- var x = Math.random() * (2048 - 300) + 150;
- var y = Math.random() * (2732 - 300) + 150;
+ var x, y;
+ do {
+ x = Math.random() * (2048 - 300) + 150;
+ y = Math.random() * (2732 - 300) + 150;
+ var dx = circle.x - x;
+ var dy = circle.y - y;
+ var distance = Math.sqrt(dx * dx + dy * dy);
+ } while (distance < 500);
scored = false;
return game.addChild(LK.getAsset('Circle', {
anchorX: 0.5,
anchorY: 0.5,
Песочные часы, черный. 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.