User prompt
Oyun cok fazla donuyo bunu düzelt
User prompt
Bazen leri araba dönmüyor bunu düzelt
User prompt
Oyunun ses lerini düzgün calış tır
User prompt
Yön tuşlarını kaldır
User prompt
Ana ekran siyah olsun
User prompt
Yön tuşlarını düzelt
User prompt
Fren sistemi olsun yon tusları ekle
User prompt
Rakiplerin arabalarını varlıklara ekle
User prompt
Bir bitiş ekranı olsun
User prompt
Zananla arabalar art sın oyunun ismi başlama elranının üst6
User prompt
Tablo bir tuşla acılsın
User prompt
Skor cevrim ici olsun sıralama olsun ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Başlatma ekranına online bir skor ekle ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Zorluk kod unu kaldır
User prompt
Zorluğa dokununca zorluk değiş miyor oyun başlamıyo bunu düzelt
User prompt
Başlangıc ekranını düzelt zor luk lar olsun
User prompt
Bir başlama ekranı ekle
User prompt
Sağ sol a dönme hızını artır
User prompt
Rakip araclar farklı olsun
User prompt
Bir bitiş cizgisi ekle
User prompt
Araba lar haraket etsin
User prompt
Barlıklar yerine araba ekle haraket etsin bide sağa sola dönme daha hızlı olsun
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var Car = Container.expand(function () {
var self = Container.call(this);
var carGraphics = self.attachAsset('car', {
anchorX: 0.5,
anchorY: 0.5
});
self.targetX = 1024;
self.speed = 3;
self.hasShield = false;
self.isInvincible = false;
self.shieldTimer = 0;
self.invincibleTimer = 0;
self.update = function () {
if (self.x < self.targetX - 2) {
self.x += self.speed + 2;
} else if (self.x > self.targetX + 2) {
self.x -= self.speed + 2;
}
if (self.hasShield) {
self.shieldTimer--;
if (self.shieldTimer <= 0) {
self.hasShield = false;
carGraphics.tint = 0xffffff;
}
}
if (self.isInvincible) {
self.invincibleTimer--;
carGraphics.alpha = 0.6 + Math.sin(LK.ticks * 0.1) * 0.4;
if (self.invincibleTimer <= 0) {
self.isInvincible = false;
carGraphics.alpha = 1;
}
}
};
return self;
});
var EnemyCar = Container.expand(function () {
var self = Container.call(this);
var enemyGraphics = self.attachAsset('car', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 8;
self.update = function () {
self.y += self.speed;
};
return self;
});
var Invincibility = Container.expand(function () {
var self = Container.call(this);
var invincibilityGraphics = self.attachAsset('invincibility', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 6;
self.update = function () {
self.y += self.speed;
self.alpha = 0.7 + Math.sin(LK.ticks * 0.05) * 0.3;
};
return self;
});
var Shield = Container.expand(function () {
var self = Container.call(this);
var shieldGraphics = self.attachAsset('shield', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 6;
self.rotation = 0;
self.update = function () {
self.y += self.speed;
self.rotation -= 0.05;
};
return self;
});
var SpeedBoost = Container.expand(function () {
var self = Container.call(this);
var boostGraphics = self.attachAsset('speedBoost', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 6;
self.rotation = 0;
self.update = function () {
self.y += self.speed;
self.rotation += 0.05;
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x1a1a1a
});
/****
* Game Code
****/
var asphalt = LK.getAsset('asphalt', {
anchorX: 0.5,
anchorY: 0.5
});
game.addChildAt(asphalt, 0);
asphalt.x = 1024;
asphalt.y = 1366;
var car = game.addChild(new Car());
car.x = 1024;
car.y = 2400;
var obstacles = [];
var powerups = [];
var score = 0;
var distanceTraveled = 0;
var gameSpeed = 8;
var baseSpeed = 8;
var maxSpeed = 15;
var speedIncreaseRate = 0.002;
var spawnRate = 60;
var obstacleSpawnCounter = 0;
var powerupSpawnCounter = 0;
var hasShield = false;
var isInvincible = false;
var dragNode = null;
var scoreTxt = new Text2('Score: 0', {
size: 100,
fill: '#ffffff'
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
var distanceTxt = new Text2('Distance: 0', {
size: 80,
fill: '#ffffff'
});
distanceTxt.anchor.set(0.5, 0);
distanceTxt.y = 100;
LK.gui.top.addChild(distanceTxt);
var speedTxt = new Text2('Speed: 1.0x', {
size: 80,
fill: '#ffffff'
});
speedTxt.anchor.set(0.5, 0);
speedTxt.y = 180;
LK.gui.top.addChild(speedTxt);
function spawnObstacle() {
var newEnemyCar = new EnemyCar();
var randomLane = Math.floor(Math.random() * 3);
newEnemyCar.x = 400 + randomLane * 400;
newEnemyCar.y = -100;
newEnemyCar.speed = gameSpeed;
obstacles.push(newEnemyCar);
game.addChild(newEnemyCar);
}
function spawnPowerup() {
var powerupType = Math.floor(Math.random() * 3);
var newPowerup;
var randomLane = Math.floor(Math.random() * 3);
var randomX = 400 + randomLane * 400;
if (powerupType === 0) {
newPowerup = new SpeedBoost();
} else if (powerupType === 1) {
newPowerup = new Shield();
} else {
newPowerup = new Invincibility();
}
newPowerup.x = randomX;
newPowerup.y = -100;
newPowerup.speed = gameSpeed;
newPowerup.powerupType = powerupType;
powerups.push(newPowerup);
game.addChild(newPowerup);
}
function handleMove(x, y, obj) {
if (dragNode) {
dragNode.targetX = Math.max(300, Math.min(1748, x));
}
}
game.move = handleMove;
game.down = function (x, y, obj) {
dragNode = car;
handleMove(x, y, obj);
};
game.up = function (x, y, obj) {
dragNode = null;
};
game.update = function () {
distanceTraveled += gameSpeed;
gameSpeed = Math.min(maxSpeed, baseSpeed + distanceTraveled * speedIncreaseRate);
for (var i = obstacles.length - 1; i >= 0; i--) {
var obstacle = obstacles[i];
if (obstacle.lastY === undefined) obstacle.lastY = obstacle.y;
obstacle.speed = gameSpeed;
if (obstacle.lastY >= -50 && obstacle.y < -50) {
obstacle.destroy();
obstacles.splice(i, 1);
continue;
}
if (obstacle.lastY <= 2800 && obstacle.y > 2800) {
obstacle.destroy();
obstacles.splice(i, 1);
score += 10;
continue;
}
var isColliding = obstacle.intersects(car);
if (isColliding && !car.isInvincible) {
if (car.hasShield) {
car.hasShield = false;
car.shieldTimer = 0;
carGraphics = car.children[0];
carGraphics.tint = 0xffffff;
obstacle.destroy();
obstacles.splice(i, 1);
LK.getSound('powerup').play();
continue;
} else {
LK.effects.flashScreen(0xff0000, 500);
LK.getSound('collision').play();
LK.showGameOver();
}
}
obstacle.lastY = obstacle.y;
}
for (var j = powerups.length - 1; j >= 0; j--) {
var powerup = powerups[j];
if (powerup.lastY === undefined) powerup.lastY = powerup.y;
powerup.speed = gameSpeed;
if (powerup.lastY >= -50 && powerup.y < -50) {
powerup.destroy();
powerups.splice(j, 1);
continue;
}
if (powerup.lastY <= 2800 && powerup.y > 2800) {
powerup.destroy();
powerups.splice(j, 1);
continue;
}
var isPowerupColliding = powerup.intersects(car);
if (isPowerupColliding) {
LK.getSound('powerup').play();
if (powerup.powerupType === 0) {
LK.getSound('boost').play();
gameSpeed = Math.min(maxSpeed, gameSpeed + 3);
score += 50;
} else if (powerup.powerupType === 1) {
car.hasShield = true;
car.shieldTimer = 300;
var carGraphics = car.children[0];
carGraphics.tint = 0x00ff00;
score += 30;
} else if (powerup.powerupType === 2) {
car.isInvincible = true;
car.invincibleTimer = 240;
score += 40;
}
powerup.destroy();
powerups.splice(j, 1);
}
powerup.lastY = powerup.y;
}
obstacleSpawnCounter++;
if (obstacleSpawnCounter >= Math.max(30, spawnRate - Math.floor(distanceTraveled / 10000))) {
spawnObstacle();
obstacleSpawnCounter = 0;
}
powerupSpawnCounter++;
if (powerupSpawnCounter >= 200) {
spawnPowerup();
powerupSpawnCounter = 0;
}
scoreTxt.setText('Score: ' + score);
distanceTxt.setText('Distance: ' + Math.floor(distanceTraveled / 10));
var speedMultiplier = (gameSpeed / baseSpeed).toFixed(1);
speedTxt.setText('Speed: ' + speedMultiplier + 'x');
};
LK.playMusic('racingMusic', {
loop: true
}); /****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var Car = Container.expand(function () {
var self = Container.call(this);
var carGraphics = self.attachAsset('car', {
anchorX: 0.5,
anchorY: 0.5
});
self.targetX = 1024;
self.speed = 3;
self.hasShield = false;
self.isInvincible = false;
self.shieldTimer = 0;
self.invincibleTimer = 0;
self.update = function () {
if (self.x < self.targetX - 2) {
self.x += self.speed + 2;
} else if (self.x > self.targetX + 2) {
self.x -= self.speed + 2;
}
if (self.hasShield) {
self.shieldTimer--;
if (self.shieldTimer <= 0) {
self.hasShield = false;
carGraphics.tint = 0xffffff;
}
}
if (self.isInvincible) {
self.invincibleTimer--;
carGraphics.alpha = 0.6 + Math.sin(LK.ticks * 0.1) * 0.4;
if (self.invincibleTimer <= 0) {
self.isInvincible = false;
carGraphics.alpha = 1;
}
}
};
return self;
});
var EnemyCar = Container.expand(function () {
var self = Container.call(this);
var enemyGraphics = self.attachAsset('car', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 8;
self.update = function () {
self.y += self.speed;
};
return self;
});
var Invincibility = Container.expand(function () {
var self = Container.call(this);
var invincibilityGraphics = self.attachAsset('invincibility', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 6;
self.update = function () {
self.y += self.speed;
self.alpha = 0.7 + Math.sin(LK.ticks * 0.05) * 0.3;
};
return self;
});
var Shield = Container.expand(function () {
var self = Container.call(this);
var shieldGraphics = self.attachAsset('shield', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 6;
self.rotation = 0;
self.update = function () {
self.y += self.speed;
self.rotation -= 0.05;
};
return self;
});
var SpeedBoost = Container.expand(function () {
var self = Container.call(this);
var boostGraphics = self.attachAsset('speedBoost', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 6;
self.rotation = 0;
self.update = function () {
self.y += self.speed;
self.rotation += 0.05;
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x1a1a1a
});
/****
* Game Code
****/
var asphalt = LK.getAsset('asphalt', {
anchorX: 0.5,
anchorY: 0.5
});
game.addChildAt(asphalt, 0);
asphalt.x = 1024;
asphalt.y = 1366;
var car = game.addChild(new Car());
car.x = 1024;
car.y = 2400;
var obstacles = [];
var powerups = [];
var score = 0;
var distanceTraveled = 0;
var gameSpeed = 8;
var baseSpeed = 8;
var maxSpeed = 15;
var speedIncreaseRate = 0.002;
var spawnRate = 60;
var obstacleSpawnCounter = 0;
var powerupSpawnCounter = 0;
var hasShield = false;
var isInvincible = false;
var dragNode = null;
var scoreTxt = new Text2('Score: 0', {
size: 100,
fill: '#ffffff'
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
var distanceTxt = new Text2('Distance: 0', {
size: 80,
fill: '#ffffff'
});
distanceTxt.anchor.set(0.5, 0);
distanceTxt.y = 100;
LK.gui.top.addChild(distanceTxt);
var speedTxt = new Text2('Speed: 1.0x', {
size: 80,
fill: '#ffffff'
});
speedTxt.anchor.set(0.5, 0);
speedTxt.y = 180;
LK.gui.top.addChild(speedTxt);
function spawnObstacle() {
var newEnemyCar = new EnemyCar();
var randomLane = Math.floor(Math.random() * 3);
newEnemyCar.x = 400 + randomLane * 400;
newEnemyCar.y = -100;
newEnemyCar.speed = gameSpeed;
obstacles.push(newEnemyCar);
game.addChild(newEnemyCar);
}
function spawnPowerup() {
var powerupType = Math.floor(Math.random() * 3);
var newPowerup;
var randomLane = Math.floor(Math.random() * 3);
var randomX = 400 + randomLane * 400;
if (powerupType === 0) {
newPowerup = new SpeedBoost();
} else if (powerupType === 1) {
newPowerup = new Shield();
} else {
newPowerup = new Invincibility();
}
newPowerup.x = randomX;
newPowerup.y = -100;
newPowerup.speed = gameSpeed;
newPowerup.powerupType = powerupType;
powerups.push(newPowerup);
game.addChild(newPowerup);
}
function handleMove(x, y, obj) {
if (dragNode) {
dragNode.targetX = Math.max(300, Math.min(1748, x));
}
}
game.move = handleMove;
game.down = function (x, y, obj) {
dragNode = car;
handleMove(x, y, obj);
};
game.up = function (x, y, obj) {
dragNode = null;
};
game.update = function () {
distanceTraveled += gameSpeed;
gameSpeed = Math.min(maxSpeed, baseSpeed + distanceTraveled * speedIncreaseRate);
for (var i = obstacles.length - 1; i >= 0; i--) {
var obstacle = obstacles[i];
if (obstacle.lastY === undefined) obstacle.lastY = obstacle.y;
obstacle.speed = gameSpeed;
if (obstacle.lastY >= -50 && obstacle.y < -50) {
obstacle.destroy();
obstacles.splice(i, 1);
continue;
}
if (obstacle.lastY <= 2800 && obstacle.y > 2800) {
obstacle.destroy();
obstacles.splice(i, 1);
score += 10;
continue;
}
var isColliding = obstacle.intersects(car);
if (isColliding && !car.isInvincible) {
if (car.hasShield) {
car.hasShield = false;
car.shieldTimer = 0;
carGraphics = car.children[0];
carGraphics.tint = 0xffffff;
obstacle.destroy();
obstacles.splice(i, 1);
LK.getSound('powerup').play();
continue;
} else {
LK.effects.flashScreen(0xff0000, 500);
LK.getSound('collision').play();
LK.showGameOver();
}
}
obstacle.lastY = obstacle.y;
}
for (var j = powerups.length - 1; j >= 0; j--) {
var powerup = powerups[j];
if (powerup.lastY === undefined) powerup.lastY = powerup.y;
powerup.speed = gameSpeed;
if (powerup.lastY >= -50 && powerup.y < -50) {
powerup.destroy();
powerups.splice(j, 1);
continue;
}
if (powerup.lastY <= 2800 && powerup.y > 2800) {
powerup.destroy();
powerups.splice(j, 1);
continue;
}
var isPowerupColliding = powerup.intersects(car);
if (isPowerupColliding) {
LK.getSound('powerup').play();
if (powerup.powerupType === 0) {
LK.getSound('boost').play();
gameSpeed = Math.min(maxSpeed, gameSpeed + 3);
score += 50;
} else if (powerup.powerupType === 1) {
car.hasShield = true;
car.shieldTimer = 300;
var carGraphics = car.children[0];
carGraphics.tint = 0x00ff00;
score += 30;
} else if (powerup.powerupType === 2) {
car.isInvincible = true;
car.invincibleTimer = 240;
score += 40;
}
powerup.destroy();
powerups.splice(j, 1);
}
powerup.lastY = powerup.y;
}
obstacleSpawnCounter++;
if (obstacleSpawnCounter >= Math.max(30, spawnRate - Math.floor(distanceTraveled / 10000))) {
spawnObstacle();
obstacleSpawnCounter = 0;
}
powerupSpawnCounter++;
if (powerupSpawnCounter >= 200) {
spawnPowerup();
powerupSpawnCounter = 0;
}
scoreTxt.setText('Score: ' + score);
distanceTxt.setText('Distance: ' + Math.floor(distanceTraveled / 10));
var speedMultiplier = (gameSpeed / baseSpeed).toFixed(1);
speedTxt.setText('Speed: ' + speedMultiplier + 'x');
};
LK.playMusic('racingMusic', {
loop: true
});
Yol çalışması. In-Game asset. 2d. High contrast. No shadows
Hızlama işareti. In-Game asset. 2d. High contrast. No shadows
Kalkan işareti. In-Game asset. 2d. High contrast. No shadows
Yarış pisti. Düm düz In-Game asset. 2d. High contrast. No shadows
İleri bakan araba. In-Game asset. 2d. High contrast. No shadows
Önüne bakan araba. In-Game asset. 2d. High contrast. No shadows