Code edit (2 edits merged)
Please save this source code
Code edit (2 edits merged)
Please save this source code
User prompt
после того как противник пересек радиус 950 он останавливается на 1 секунду
Code edit (7 edits merged)
Please save this source code
User prompt
Ускорить поворот игрока на 1
Code edit (7 edits merged)
Please save this source code
User prompt
убрать прибавление одного очка при пересечении противником радиуса 950
Code edit (1 edits merged)
Please save this source code
User prompt
убрать отскок от стен у игрока и противника
Code edit (1 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -43,11 +43,11 @@
};
self.slidingDuration = 0;
self.setDirection = function (direction) {
if (direction === 'left') {
- self.rotation -= 0.07;
- self.speedX += Math.sin(self.rotation) * 0.07;
- self.speedY += -Math.cos(self.rotation) * 0.07;
+ self.rotation -= 0.08;
+ self.speedX += Math.sin(self.rotation) * 0.08;
+ self.speedY += -Math.cos(self.rotation) * 0.08;
self.slidingDuration = 20; // Set sliding duration to 0.5 second (30 frames)
} else if (direction === 'right') {
self.rotation += 0.07;
self.speedX += Math.sin(self.rotation) * 0.07;
@@ -196,9 +196,9 @@
var distance = Math.sqrt(dx * dx + dy * dy);
// Check if the distance is less than the sum of the radii of the two cars
if (distance < car.width / 2 + otherCar.width / 2) {
// On collision, move both cars 200 pixels back in the direction opposite to the point of intersection
- var moveDistance = 60;
+ var moveDistance = 100;
var moveStep = moveDistance / 10; // 60 frames for 1 second of smooth movement
var moveX = dx / distance * moveStep;
var moveY = dy / distance * moveStep;
var moveCounter = 0;
@@ -217,8 +217,13 @@
});
// 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 > 950 && car === enemy && !car.scoreIncremented) {
+ // Increment score by 1 when enemy crosses radius of 950
+ LK.setScore(LK.getScore() + 1);
+ // Update score text
+ scoreTxt.setText(LK.getScore());
+ car.scoreIncremented = true;
// Immediately calculate direction vector from enemy to game center and normalize to move enemy further from game center without pause
var dx = 2048 / 2 - car.x;
var dy = 2732 / 2 - car.y;
var length = Math.sqrt(dx * dx + dy * dy);
@@ -270,9 +275,9 @@
cars[0].speedY = -7;
// Reset player's rotation
cars[0].rotation = 0;
}, 600); // Delay for 0.5 seconds
- } else if (distanceFromCenter > 1970 && car !== enemy) {
+ } else if (distanceFromCenter > 970 && car !== enemy) {
// Shrink player car to 1x1 pixel over 1 second upon crossing radius 970
var shrinkDuration = 40; // 1 second at 60 FPS
var originalWidth = car.width;
var originalHeight = car.height;
Лава мультяшная вид сверху плоская. 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.