User prompt
первый круг всегда появляется в центре экрана
User prompt
исправить ошибку, когда не появляется новый круг
User prompt
скорость 10
User prompt
после того как шар попал в центр круга, в случайном месте появляется круг и шар перемещается в центр этого круга
User prompt
шар перемещается со статичной скоростью 5
User prompt
шар перемещается в центр круга
User prompt
добавить круг в центр экрана
Code edit (1 edits merged)
Please save this source code
User prompt
добавить шар в нижний центр
User prompt
задний фон темно серый
User prompt
удалить весь код, оставить только assets
User prompt
Шарик всегда двигается у центру круга
User prompt
После того как шарик достиг центра круга, появляется еще один круг и шарик двигается к центру нового круга
User prompt
Шарик движется в центр круга
User prompt
Добавить circle в центр хкрана
User prompt
Шарик появляется в нижней части экрана
User prompt
Увеличить скорость в 3 раза
User prompt
Шарик двигается по спирали
User prompt
Шарик не может менять направление движение больше чем на 45 градусов
User prompt
Скорость шарика от 3 до 6
User prompt
Скорость шарика от 5 до 8
User prompt
Скорость шарика от 8 до 12
User prompt
Сделать проверку на размер шарика перед отскоком
User prompt
Шарик меняет направление каждые 3 секунды
Initial prompt
Razduplis
/**** * Classes ****/ //<Assets used in the game will automatically appear here> // 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 = 5; self.speedY = 5; self.update = function () { // Calculate the direction vector from the ball to the center of the circle var directionX = circle.x - self.x; var directionY = circle.y - self.y; // Normalize the direction vector var length = Math.sqrt(directionX * directionX + directionY * directionY); directionX /= length; directionY /= length; // Move the ball in the direction of the circle self.x += directionX * self.speedX; self.y += directionY * self.speedY; }; }); // Circle class var Circle = Container.expand(function () { var self = Container.call(this); var circleGraphics = self.attachAsset('Circle', { anchorX: 0.5, anchorY: 0.5 }); }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 //Init game with black background }); /**** * Game Code ****/ // Initialize ball var ball = game.addChild(new Ball()); ball.x = 2048 / 2; ball.y = 2732 - ball.height / 2; // Initialize circle var circle = game.addChild(LK.getAsset('Circle', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2 })); // Update game every tick game.update = function () { ball.update(); // If the ball has reached the center of the circle if (Math.abs(ball.x - circle.x) < 5 && Math.abs(ball.y - circle.y) < 5) { // Remove the old circle circle.destroy(); // Create a new circle at a random position circle = game.addChild(new Circle()); circle.x = Math.random() * 2048; circle.y = Math.random() * 2732; // Make the ball move towards the new circle var directionX = circle.x - ball.x; var directionY = circle.y - ball.y; var length = Math.sqrt(directionX * directionX + directionY * directionY); ball.speedX = directionX / length * 5; ball.speedY = directionY / length * 5; } };
===================================================================
--- original.js
+++ change.js
@@ -12,10 +12,10 @@
self.speedX = 5;
self.speedY = 5;
self.update = function () {
// Calculate the direction vector from the ball to the center of the circle
- var directionX = 2048 / 2 - self.x;
- var directionY = 2732 / 2 - self.y;
+ var directionX = circle.x - self.x;
+ var directionY = circle.y - self.y;
// Normalize the direction vector
var length = Math.sqrt(directionX * directionX + directionY * directionY);
directionX /= length;
directionY /= length;
Песочные часы, черный. 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.