User prompt
Score yazısının yanına kaç score un olduğunu göster
User prompt
Score yazan yeri varlıklarda ki score ile değiştir
User prompt
Score yazan yeri varlıklarda ki score ile değiştir
User prompt
Bana bir araba oyunu yap
User prompt
Hatanın olduyere git
User prompt
Derleme hatası[L16] : Eklentiler yüklenmedi sorununu gider
User prompt
Sorunu gider
Code edit (1 edits merged)
Please save this source code
User prompt
Turbo Lane Rush
Initial prompt
Bana bir araba oyunu yap
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var Coin = Container.expand(function () {
var self = Container.call(this);
var coinGraphics = self.attachAsset('coin', {
anchorX: 0.5,
anchorY: 0.5
});
self.collectAnimationActive = false;
self.update = function () {
if (!self.collectAnimationActive) {
self.y += 4 + gameSpeed;
// Gentle rotation animation
coinGraphics.rotation += 0.1;
}
};
self.collect = function () {
self.collectAnimationActive = true;
tween(self, {
alpha: 0,
scaleX: 1.5,
scaleY: 1.5
}, {
duration: 200,
onFinish: function onFinish() {
self.destroy();
}
});
};
return self;
});
var EnemyCar = Container.expand(function () {
var self = Container.call(this);
// Randomly choose enemy car type
var carTypes = ['enemyCar1', 'enemyCar2', 'enemyCar3'];
var randomType = carTypes[Math.floor(Math.random() * carTypes.length)];
var carGraphics = self.attachAsset(randomType, {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 3 + Math.random() * 2; // Random speed between 3-5
self.update = function () {
self.y += self.speed + gameSpeed;
};
return self;
});
var PlayerCar = Container.expand(function () {
var self = Container.call(this);
var carGraphics = self.attachAsset('playerCar', {
anchorX: 0.5,
anchorY: 0.5
});
self.targetX = 0;
self.speed = 8;
self.update = function () {
// Smooth movement towards target position
var diff = self.targetX - self.x;
if (Math.abs(diff) > 2) {
self.x += diff * 0.15;
} else {
self.x = self.targetX;
}
};
return self;
});
var RoadLine = Container.expand(function () {
var self = Container.call(this);
var lineGraphics = self.attachAsset('roadLine', {
anchorX: 0.5,
anchorY: 0.5
});
self.update = function () {
self.y += 8 + gameSpeed;
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x2c3e50
});
/****
* Game Code
****/
// Game variables
var player;
var enemies = [];
var coins = [];
var roadLines = [];
var gameSpeed = 0;
var speedIncrease = 0.01;
var maxSpeed = 8;
var lanes = [400, 650, 900, 1150, 1400]; // 5 lanes
var spawnTimer = 0;
var enemySpawnRate = 120; // Frames between enemy spawns
var coinSpawnRate = 300; // Frames between coin spawns
var roadLineSpawnRate = 30; // Frames between road line spawns
var distance = 0;
var coinsCollected = 0;
// Create player car
player = game.addChild(new PlayerCar());
player.x = lanes[2]; // Start in middle lane
player.y = 2400; // Near bottom of screen
player.targetX = player.x;
// UI Elements
var scoreText = new Text2('Score: 0', {
size: 60,
fill: 0xFFFFFF
});
scoreText.anchor.set(0, 0);
scoreText.x = 20;
scoreText.y = 120;
LK.gui.topLeft.addChild(scoreText);
var speedText = new Text2('Speed: 0', {
size: 60,
fill: 0xFFFFFF
});
speedText.anchor.set(1, 0);
speedText.x = -20;
speedText.y = 50;
LK.gui.topRight.addChild(speedText);
var coinsText = new Text2('Coins: 0', {
size: 60,
fill: 0xF1C40F
});
coinsText.anchor.set(0.5, 0);
coinsText.x = 0;
coinsText.y = 50;
LK.gui.top.addChild(coinsText);
// Touch controls
var isDragging = false;
var startX = 0;
game.down = function (x, y, obj) {
isDragging = true;
startX = x;
};
game.move = function (x, y, obj) {
if (isDragging) {
var deltaX = x - startX;
var newTargetX = player.targetX + deltaX;
// Constrain to lanes
if (newTargetX < lanes[0]) newTargetX = lanes[0];
if (newTargetX > lanes[lanes.length - 1]) newTargetX = lanes[lanes.length - 1];
player.targetX = newTargetX;
startX = x;
}
};
game.up = function (x, y, obj) {
isDragging = false;
// Snap to nearest lane
var closestLane = lanes[0];
var minDistance = Math.abs(player.x - lanes[0]);
for (var i = 1; i < lanes.length; i++) {
var distance = Math.abs(player.x - lanes[i]);
if (distance < minDistance) {
minDistance = distance;
closestLane = lanes[i];
}
}
player.targetX = closestLane;
};
function spawnEnemy() {
var enemy = new EnemyCar();
var randomLane = lanes[Math.floor(Math.random() * lanes.length)];
enemy.x = randomLane;
enemy.y = -100;
enemies.push(enemy);
game.addChild(enemy);
}
function spawnCoin() {
var coin = new Coin();
var randomLane = lanes[Math.floor(Math.random() * lanes.length)];
coin.x = randomLane;
coin.y = -100;
coins.push(coin);
game.addChild(coin);
}
function spawnRoadLine() {
for (var i = 0; i < lanes.length - 1; i++) {
var roadLine = new RoadLine();
roadLine.x = (lanes[i] + lanes[i + 1]) / 2;
roadLine.y = -50;
roadLines.push(roadLine);
game.addChild(roadLine);
}
}
game.update = function () {
// Increase game speed gradually
if (gameSpeed < maxSpeed) {
gameSpeed += speedIncrease;
}
// Update distance and score
distance += 1 + gameSpeed;
var totalScore = Math.floor(distance / 10) + coinsCollected * 10;
LK.setScore(totalScore);
// Update UI
scoreText.setText('Score: ' + totalScore);
speedText.setText('Speed: ' + Math.floor(gameSpeed));
coinsText.setText('Coins: ' + coinsCollected);
// Spawn timers
spawnTimer++;
// Spawn enemies
if (spawnTimer % Math.max(40, enemySpawnRate - Math.floor(gameSpeed * 8)) === 0) {
spawnEnemy();
}
// Spawn coins
if (spawnTimer % coinSpawnRate === 0) {
spawnCoin();
}
// Spawn road lines
if (spawnTimer % roadLineSpawnRate === 0) {
spawnRoadLine();
}
// Check enemy collisions and cleanup
for (var i = enemies.length - 1; i >= 0; i--) {
var enemy = enemies[i];
// Check collision with player
if (enemy.intersects(player)) {
LK.getSound('crash').play();
LK.effects.flashScreen(0xff0000, 500);
LK.showGameOver();
return;
}
// Remove enemies that are off screen
if (enemy.y > 2800) {
enemy.destroy();
enemies.splice(i, 1);
}
}
// Check coin collection and cleanup
for (var j = coins.length - 1; j >= 0; j--) {
var coin = coins[j];
// Check collection
if (coin.intersects(player) && !coin.collectAnimationActive) {
LK.getSound('collectCoin').play();
coinsCollected++;
coin.collect();
coins.splice(j, 1);
continue;
}
// Remove coins that are off screen
if (coin.y > 2800) {
coin.destroy();
coins.splice(j, 1);
}
}
// Cleanup road lines
for (var k = roadLines.length - 1; k >= 0; k--) {
var roadLine = roadLines[k];
if (roadLine.y > 2800) {
roadLine.destroy();
roadLines.splice(k, 1);
}
}
}; ===================================================================
--- original.js
+++ change.js
Coin. In-Game asset. 2d. High contrast. No shadows
Yol hattı. In-Game asset. 2d. High contrast. No shadows
Score. In-Game asset. 2d. High contrast. No shadows
Şehir. In-Game asset. 2d. High contrast. No shadows
Gaz pedalı. In-Game asset. 2d. High contrast. No shadows
Sağ sola hareket oktuşuşlar. In-Game asset. 2d. High contrast. No shadows
Kuş bakışı ağaç. In-Game asset. 2d. High contrast. No shadows
Çalı. In-Game asset. 2d. High contrast. No shadows
Benzin kutusu. In-Game asset. 2d. High contrast. No shadows
Dökülmüş benzin. In-Game asset. 2d. High contrast. No shadows
Yola koyulmuş kutular. In-Game asset. 2d. High contrast. No shadows
Kuş bakışı Ferrari araba. In-Game asset. 2d. High contrast. No shadows
Kuş bakışı Lamborghini. In-Game asset. 2d. High contrast. No shadows
Kuş bakışı kosiegg. In-Game asset. 2d. High contrast. No shadows
Bugatti kuş bakışı. In-Game asset. 2d. High contrast. No shadows