User prompt
Увеличить скорость машины до 7
User prompt
Если свайпнули влево и продолжают удерживать нажатие на экран, то машина продолжает поворачивать влево, иначе вправо
Code edit (1 edits merged)
Please save this source code
User prompt
Скорость поворота не увеличивается при удержании поворота, скорость всегда одинаковая
Code edit (1 edits merged)
Please save this source code
User prompt
Уменьшить скорость поворота в два раза
User prompt
Сделать проверку на свайп не от центра экрана, а от точки, где было нажатие по экрану
User prompt
Продолжать поворот машины, если после swipe осталось комарик по экрану
User prompt
При нажатии на экран и свайпе влево, машина поворачивает налево, иначе вправо
User prompt
Исправить ошибку, когда не работает swipe
User prompt
Сделать механику движения машины. Сначала машина движется вверх, после свайпа влево, машина поворачивает налево и движется в направлении движения, иначе вправо
User prompt
Увеличить угол поворота
User prompt
При свайпе влево, машина плавно поворачивает налево
User prompt
Добавить фон белый
User prompt
При свайпе влево машина поворачивает налево, иначе вправо
User prompt
Начальное движение машины по вертикали
User prompt
Начальное положение нижний центр экрана
User prompt
Оставить одну машину
User prompt
Удалить появление новых машин
Initial prompt
Машинки
/**** * Classes ****/ // Assets will be automatically created based on usage in the code. // Car class var Car = Container.expand(function () { var self = Container.call(this); // Attach a car asset var carGraphics = self.attachAsset('car', { anchorX: 0.5, anchorY: 0.5 }); self.speedX = 0; self.speedY = 0; // Move car based on its speed self.move = function () { self.x += self.speedX; self.y += self.speedY; }; // Bounce off the edges of the screen self.checkBounds = function () { if (self.x < 0 || self.x > 2048) { self.speedX *= -1; } if (self.y < 0 || self.y > 2732) { self.speedY *= -1; } }; self.setDirection = function () { self.speedX = Math.sin(self.rotation) * 7; self.speedY = -Math.cos(self.rotation) * 7; }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0xFFFFFF // Init game with white background }); /**** * Game Code ****/ // Global variables var cars = []; // Create a single car var car = new Car(); car.x = 2048 / 2; // Center of the screen car.y = 2732; // Bottom of the screen car.speedX = 0; car.speedY = -5; cars.push(car); game.addChild(car); // Handle game logic on each tick LK.on('tick', function () { cars.forEach(function (car) { car.move(); car.checkBounds(); // Check for collisions with other cars cars.forEach(function (otherCar) { if (car !== otherCar && car.intersects(otherCar)) { // Simple collision response by swapping speeds var tempSpeedX = car.speedX; var tempSpeedY = car.speedY; car.speedX = otherCar.speedX; car.speedY = otherCar.speedY; otherCar.speedX = tempSpeedX; otherCar.speedY = tempSpeedY; } }); }); }); // Add touch event listener to the game var turnInterval; game.on('down', function (obj) { // Get the position of the touch var touchPosition = obj.event.getLocalPosition(game); // Store the initial touch position car.initialTouchPosition = touchPosition; }); game.on('move', function (obj) { // Get the position of the touch var touchPosition = obj.event.getLocalPosition(game); // If the touch has moved to the left of the initial touch position, turn the car to the left if (touchPosition.x < car.initialTouchPosition.x) { car.rotation -= 0.06; car.setDirection(); } // If the touch has moved to the right of the initial touch position, turn the car to the right else if (touchPosition.x > car.initialTouchPosition.x) { car.rotation += 0.06; car.setDirection(); } }); game.on('up', function (obj) { // Do nothing when the touch is released });
===================================================================
--- original.js
+++ change.js
@@ -26,10 +26,10 @@
self.speedY *= -1;
}
};
self.setDirection = function () {
- self.speedX = Math.sin(self.rotation) * 5;
- self.speedY = -Math.cos(self.rotation) * 5;
+ self.speedX = Math.sin(self.rotation) * 7;
+ self.speedY = -Math.cos(self.rotation) * 7;
};
});
/****
Лава мультяшная вид сверху плоская. Single Game Texture. In-Game asset. 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.
шины на асфальте после торможения для игры. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.