User prompt
прекращать противнику скользить через 2 секунды после начала сколижения
User prompt
если противник выехал за радиус 950 то игроки встают на респаун и начинается игра опять
User prompt
если противник выехал за радиус 950 то победа флеш скрин зеленый и игра начинается заново
Code edit (1 edits merged)
Please save this source code
User prompt
завершить противнику скольжение через 2 секунды, даже если он продолжает поворачивать
Code edit (5 edits merged)
Please save this source code
User prompt
противник может скользить только 2 секунды, потом перестает скользить
Code edit (1 edits merged)
Please save this source code
User prompt
добавить противнику скольжение, такое же как у игрока
User prompt
противник преследует игрока 3 секунды, затем перестает преследование и начинает двигаться по направлению обратному направлению машины 2 секунды, затем все повторяется
User prompt
противник преследует игрока 3 секунды, затем перестает преследование и начинает двигаться по направлению куда повернута машина 2 секунды, затем все повторяется
User prompt
противник преследует игрока 3 секунды, затем перестает преследование и начинает двигаться по направлению 2 секунды, затем все повторяется
User prompt
4 секунды, противник перестает преследование и едет по направлению движения 1 секунду, затем опять начинает преследование на 3 секунды и снова по направлению движения 1 секунду и дальше по аналогии
User prompt
противник преследует игрока каждые 3 секунды, когда противник не преследует, он ездит в случайном направлении, но старается не выезжать за радиус 950 от центра круга
User prompt
противник едет вниз 1.5 секунды
User prompt
развернуть модель машины при преследовании на -90 градусов
User prompt
противник изначально едет вниз, и через 2 секунды начинает преследование
User prompt
противник использует повороты, при изменении направления
User prompt
противник преследует игрока
User prompt
противник может поворачивать
User prompt
противник движется в направлении игрока
Code edit (1 edits merged)
Please save this source code
User prompt
добавить плавное перемещение на 200 пикселей при пересечении машин
User prompt
при пересечении машины плавно отталкиваются друг от друга
User prompt
при пересечении машин, обе машины перемещаются на 200 пикселей назад относительно той точки, где она пересеклись и продолжают движение по направлению
/****
* 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.previousTouchPosition = null;
self.speedX = 0;
self.speedY = 0;
// Move car based on its speed
self.move = function () {
if (self.slidingDuration > 0) {
self.x += self.speedX;
self.y += self.speedY;
self.slidingDuration--;
if (self.slidingDuration === 0) {
self.speedX = Math.sin(self.rotation) * 7;
self.speedY = -Math.cos(self.rotation) * 7;
}
} else {
self.x += self.speedX;
self.y += self.speedY;
}
};
// Prevent the car from moving in the opposite direction when it hits the wall
self.checkBounds = function () {
if (self.x < 0) {
self.x += 200;
} else if (self.x > 2048) {
self.x -= 200;
}
if (self.y < 0) {
self.y += 200;
} else if (self.y > 2732) {
self.y -= 200;
}
};
self.slidingDuration = 0;
self.setDirection = function (direction) {
if (direction === 'left') {
self.rotation -= 0.05;
self.speedX += Math.sin(self.rotation) * 0.05;
self.speedY += -Math.cos(self.rotation) * 0.05;
self.slidingDuration = 20; // Set sliding duration to 0.5 second (30 frames)
} else if (direction === 'right') {
self.rotation += 0.05;
self.speedX += Math.sin(self.rotation) * 0.1;
self.speedY += -Math.cos(self.rotation) * 0.1;
self.slidingDuration = 20; // Set sliding duration to 0.5 second (30 frames)
}
// Limit the speed to prevent the car from sliding too much
if (self.slidingDuration > 0) {
self.speedX = Math.min(Math.max(self.speedX, -7), 7);
self.speedY = Math.min(Math.max(self.speedY, -7), 7);
self.slidingDuration--;
} else {
self.speedX = 0;
self.speedY = 0;
}
};
});
// Enemy class
var Enemy = Container.expand(function () {
var self = Container.call(this);
// Attach an enemy asset
var enemyGraphics = self.attachAsset('enemy1', {
anchorX: 0.5,
anchorY: 0.5
});
self.speedX = 0;
self.speedY = 7;
// Move enemy based on its speed
self.move = function () {
self.x += self.speedX;
self.y += self.speedY;
};
// Prevent the enemy from moving in the opposite direction when it hits the wall
self.checkBounds = function () {
if (self.x < 0) {
self.x += 200;
} else if (self.x > 2048) {
self.x -= 200;
}
if (self.y < 0) {
self.y += 200;
} else if (self.y > 2732) {
self.y -= 200;
}
};
});
/****
* 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 = 2280; // Bottom of the screen
car.speedX = 0;
car.speedY = -7;
cars.push(car);
game.addChildAt(car, game.children.length);
// Create an enemy car
var enemy = new Enemy();
enemy.x = 2048 / 2; // Center of the screen
enemy.y = 450; // Top of the screen
enemy.speedX = 0;
enemy.speedY = 7;
cars.push(enemy);
game.addChildAt(enemy, game.children.length);
// Create a background for the game
var background = LK.getAsset('background', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
y: 2732 / 2
});
game.addChildAt(background, 0);
// Create a circle in the center of the screen
var centerCircle = LK.getAsset('Circle', {
anchorX: 0.5,
// Center anchor x-coordinate
anchorY: 0.5,
// Center anchor y-coordinate
x: 2048 / 2,
// Center of the screen
y: 2732 / 2 // Center of the screen
});
game.addChildAt(centerCircle, 1);
// 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)) {
// On collision, move both cars 200 pixels back in the direction opposite to the point of intersection
var dx = car.x - otherCar.x;
var dy = car.y - otherCar.y;
var distance = Math.sqrt(dx * dx + dy * dy);
car.x += dx / distance * 200;
car.y += dy / distance * 200;
otherCar.x -= dx / distance * 200;
otherCar.y -= dy / distance * 200;
}
});
// Check if the car is outside the circle
var distanceFromCenter = Math.sqrt(Math.pow(car.x - 2048 / 2, 2) + Math.pow(car.y - 2732 / 2, 2));
if (distanceFromCenter > 970) {
LK.showGameOver();
}
});
});
// Add touch event listener to the game
var turnInterval;
var lastTouchPosition;
var isTouching = false; // Add a flag to check if the screen is being touched
var isOutside = false; // Add a flag to check if the mouse is outside the game
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;
// Store the last touch position
lastTouchPosition = touchPosition;
isTouching = true; // Set the flag to true when the screen is being touched
isOutside = false; // Set the flag to false when the mouse enters the game
});
game.on('move', function (obj) {
// Get the position of the touch
var touchPosition = obj.event.getLocalPosition(game);
// Update the last touch position
lastTouchPosition = touchPosition;
// If there is a touch event and the last touch position is to the left of the initial touch position, turn the car to the left
if (!isOutside && isTouching && lastTouchPosition && car.initialTouchPosition) {
if (lastTouchPosition.x < car.initialTouchPosition.x) {
car.setDirection('left');
} else if (lastTouchPosition.x > car.initialTouchPosition.x) {
car.setDirection('right');
}
// Update the initial touch position
car.initialTouchPosition = lastTouchPosition;
} else if (isTouching && !isOutside) {
// If there is no touch event, the car moves straight
car.setDirection('straight');
}
});
game.on('up', function (obj) {
// Reset the last touch position when the touch is released
lastTouchPosition = null;
isTouching = false; // Set the flag to false when the touch is released
isOutside = true; // Set the flag to true when the mouse leaves the game
});
Лава мультяшная вид сверху плоская. 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.