User prompt
Oyun sonu skorunu 1000 indir
User prompt
Oyun sonu skorunu 10000 e yükselt
User prompt
Oyunun sonuna ne kadar kaldığını gösteren bir metin ekle ve distanceni kaldır
User prompt
Skor tablosu 3000 e ulaştıkda oyun sona ulaşsın ve bir kazanma ekranı ekle
User prompt
Engellerin spawnlanma sayını 30% oranında azalt
User prompt
Coin sayacı olsun her coin topladığında +1 olsun
User prompt
Coinlerle engeller arasında mesafe olsun
User prompt
Oyun yeniden başladığında müzik de en başdan başlasın
Code edit (1 edits merged)
Please save this source code
User prompt
Arka planda müzik çalsın
User prompt
Skor tablosu biraz daha yavaş olsun
User prompt
Kenardakı yeşil ekranı kırp
User prompt
Skor tablosu daha yavaş irellesin
User prompt
Engele çarptıkda patlama effekti oluşsun ↪💡 Consider importing and using the following plugins: @upit/tween.v1
Code edit (1 edits merged)
Please save this source code
User prompt
Oyun git gidehızlansın
User prompt
Yeşil ekran yerine asfalt olsun
User prompt
Araba yoldan kenara çıkmasın yanlız yolla gitsin
User prompt
Coinler ve engeller yoldan kenara taşmasın
User prompt
Yol çok daha gerçekçi olsun
User prompt
Yol daha gerçekçi olsun
User prompt
Araba kendi kendine kaymasın
Code edit (1 edits merged)
Please save this source code
User prompt
Road Runner: Obstacle Dodge
Initial prompt
Bana araba oyunu kodla yolda engeller olsun ve sen engele çarptığında oyun bitsin. Coin sistemide olsun oyunda.
/****
* 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.speed = 8;
self.update = function () {
self.y += self.speed;
// Add slight rotation for visual effect
coinGraphics.rotation += 0.1;
};
return self;
});
var ObstacleCar = Container.expand(function () {
var self = Container.call(this);
var carGraphics = self.attachAsset('obstacleCar', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 8;
self.update = function () {
self.y += self.speed;
};
return self;
});
var PlayerCar = Container.expand(function () {
var self = Container.call(this);
var carGraphics = self.attachAsset('playerCar', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 0;
self.maxSpeed = 8;
self.acceleration = 0.3;
self.deceleration = 0.8;
self.update = function () {
// Apply acceleration/deceleration
if (self.speed < self.maxSpeed) {
self.speed += self.acceleration;
}
// Apply friction when not accelerating
if (self.speed > 0) {
self.speed *= self.deceleration;
}
// Move based on speed
self.x += self.speed;
// Keep car within road bounds
if (self.x < 100) {
self.x = 100;
self.speed = 0;
}
if (self.x > 1948) {
self.x = 1948;
self.speed = 0;
}
};
return self;
});
var RoadLine = Container.expand(function () {
var self = Container.call(this);
var lineGraphics = self.attachAsset('roadLine', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 8;
self.update = function () {
self.y += self.speed;
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x27ae60
});
/****
* Game Code
****/
// Game variables
var playerCar;
var obstacles = [];
var coins = [];
var roadLines = [];
var gameSpeed = 8;
var spawnTimer = 0;
var coinSpawnTimer = 0;
var roadLineSpawnTimer = 0;
var distanceScore = 0;
var coinScore = 0;
var dragNode = null;
var gameStarted = false;
// Create road background
var roadBackground = game.addChild(LK.getAsset('road', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366
}));
// Create player car
playerCar = game.addChild(new PlayerCar());
playerCar.x = 1024;
playerCar.y = 2400;
// Create UI elements
var scoreText = new Text2('Score: 0', {
size: 60,
fill: 0xFFFFFF
});
scoreText.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreText);
var distanceText = new Text2('Distance: 0m', {
size: 40,
fill: 0xFFFFFF
});
distanceText.anchor.set(0, 0);
distanceText.x = 150;
distanceText.y = 100;
LK.gui.topLeft.addChild(distanceText);
// Touch controls
function handleMove(x, y, obj) {
if (dragNode && gameStarted) {
var targetX = x;
// Smooth movement toward touch position
var diff = targetX - playerCar.x;
playerCar.speed = diff * 0.1;
}
}
game.move = handleMove;
game.down = function (x, y, obj) {
if (!gameStarted) {
gameStarted = true;
}
dragNode = playerCar;
handleMove(x, y, obj);
};
game.up = function (x, y, obj) {
dragNode = null;
if (playerCar) {
playerCar.speed *= 0.5;
}
};
// Spawn functions
function spawnObstacle() {
var obstacle = new ObstacleCar();
obstacle.x = Math.random() * 1800 + 124; // Random X position within road bounds
obstacle.y = -100;
obstacle.speed = gameSpeed;
obstacles.push(obstacle);
game.addChild(obstacle);
}
function spawnCoin() {
var coin = new Coin();
coin.x = Math.random() * 1800 + 124;
coin.y = -100;
coin.speed = gameSpeed;
coins.push(coin);
game.addChild(coin);
}
function spawnRoadLine() {
var roadLine = new RoadLine();
roadLine.x = 1024;
roadLine.y = -100;
roadLine.speed = gameSpeed;
roadLines.push(roadLine);
game.addChild(roadLine);
}
// Main game loop
game.update = function () {
if (!gameStarted) return;
// Update distance score
distanceScore += gameSpeed / 10;
// Increase game speed gradually
if (LK.ticks % 300 === 0) {
gameSpeed += 0.5;
}
// Spawn obstacles
spawnTimer++;
if (spawnTimer > 60 - gameSpeed * 2) {
spawnObstacle();
spawnTimer = 0;
}
// Spawn coins
coinSpawnTimer++;
if (coinSpawnTimer > 120) {
spawnCoin();
coinSpawnTimer = 0;
}
// Spawn road lines
roadLineSpawnTimer++;
if (roadLineSpawnTimer > 40) {
spawnRoadLine();
roadLineSpawnTimer = 0;
}
// Update and check obstacles
for (var i = obstacles.length - 1; i >= 0; i--) {
var obstacle = obstacles[i];
if (obstacle.lastY === undefined) obstacle.lastY = obstacle.y;
// Remove off-screen obstacles
if (obstacle.lastY < 2800 && obstacle.y >= 2800) {
obstacle.destroy();
obstacles.splice(i, 1);
continue;
}
// Check collision with player
if (obstacle.intersects(playerCar)) {
LK.getSound('crash').play();
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
return;
}
obstacle.lastY = obstacle.y;
}
// Update and check coins
for (var j = coins.length - 1; j >= 0; j--) {
var coin = coins[j];
if (coin.lastY === undefined) coin.lastY = coin.y;
if (coin.lastCollected === undefined) coin.lastCollected = false;
// Remove off-screen coins
if (coin.lastY < 2800 && coin.y >= 2800) {
coin.destroy();
coins.splice(j, 1);
continue;
}
// Check collection
var currentCollected = coin.intersects(playerCar);
if (!coin.lastCollected && currentCollected) {
LK.getSound('collectCoin').play();
coinScore += 10;
LK.setScore(Math.floor(distanceScore) + coinScore);
coin.destroy();
coins.splice(j, 1);
continue;
}
coin.lastY = coin.y;
coin.lastCollected = currentCollected;
}
// Update and remove road lines
for (var k = roadLines.length - 1; k >= 0; k--) {
var roadLine = roadLines[k];
if (roadLine.lastY === undefined) roadLine.lastY = roadLine.y;
if (roadLine.lastY < 2800 && roadLine.y >= 2800) {
roadLine.destroy();
roadLines.splice(k, 1);
continue;
}
roadLine.lastY = roadLine.y;
}
// Update UI
scoreText.setText('Score: ' + (Math.floor(distanceScore) + coinScore));
distanceText.setText('Distance: ' + Math.floor(distanceScore) + 'm');
// Update speeds for all moving objects
for (var l = 0; l < obstacles.length; l++) {
obstacles[l].speed = gameSpeed;
}
for (var m = 0; m < coins.length; m++) {
coins[m].speed = gameSpeed;
}
for (var n = 0; n < roadLines.length; n++) {
roadLines[n].speed = gameSpeed;
}
}; ===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,272 @@
-/****
+/****
+* 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.speed = 8;
+ self.update = function () {
+ self.y += self.speed;
+ // Add slight rotation for visual effect
+ coinGraphics.rotation += 0.1;
+ };
+ return self;
+});
+var ObstacleCar = Container.expand(function () {
+ var self = Container.call(this);
+ var carGraphics = self.attachAsset('obstacleCar', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.speed = 8;
+ self.update = function () {
+ self.y += self.speed;
+ };
+ return self;
+});
+var PlayerCar = Container.expand(function () {
+ var self = Container.call(this);
+ var carGraphics = self.attachAsset('playerCar', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.speed = 0;
+ self.maxSpeed = 8;
+ self.acceleration = 0.3;
+ self.deceleration = 0.8;
+ self.update = function () {
+ // Apply acceleration/deceleration
+ if (self.speed < self.maxSpeed) {
+ self.speed += self.acceleration;
+ }
+ // Apply friction when not accelerating
+ if (self.speed > 0) {
+ self.speed *= self.deceleration;
+ }
+ // Move based on speed
+ self.x += self.speed;
+ // Keep car within road bounds
+ if (self.x < 100) {
+ self.x = 100;
+ self.speed = 0;
+ }
+ if (self.x > 1948) {
+ self.x = 1948;
+ self.speed = 0;
+ }
+ };
+ return self;
+});
+var RoadLine = Container.expand(function () {
+ var self = Container.call(this);
+ var lineGraphics = self.attachAsset('roadLine', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.speed = 8;
+ self.update = function () {
+ self.y += self.speed;
+ };
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0x27ae60
+});
+
+/****
+* Game Code
+****/
+// Game variables
+var playerCar;
+var obstacles = [];
+var coins = [];
+var roadLines = [];
+var gameSpeed = 8;
+var spawnTimer = 0;
+var coinSpawnTimer = 0;
+var roadLineSpawnTimer = 0;
+var distanceScore = 0;
+var coinScore = 0;
+var dragNode = null;
+var gameStarted = false;
+// Create road background
+var roadBackground = game.addChild(LK.getAsset('road', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: 1024,
+ y: 1366
+}));
+// Create player car
+playerCar = game.addChild(new PlayerCar());
+playerCar.x = 1024;
+playerCar.y = 2400;
+// Create UI elements
+var scoreText = new Text2('Score: 0', {
+ size: 60,
+ fill: 0xFFFFFF
+});
+scoreText.anchor.set(0.5, 0);
+LK.gui.top.addChild(scoreText);
+var distanceText = new Text2('Distance: 0m', {
+ size: 40,
+ fill: 0xFFFFFF
+});
+distanceText.anchor.set(0, 0);
+distanceText.x = 150;
+distanceText.y = 100;
+LK.gui.topLeft.addChild(distanceText);
+// Touch controls
+function handleMove(x, y, obj) {
+ if (dragNode && gameStarted) {
+ var targetX = x;
+ // Smooth movement toward touch position
+ var diff = targetX - playerCar.x;
+ playerCar.speed = diff * 0.1;
+ }
+}
+game.move = handleMove;
+game.down = function (x, y, obj) {
+ if (!gameStarted) {
+ gameStarted = true;
+ }
+ dragNode = playerCar;
+ handleMove(x, y, obj);
+};
+game.up = function (x, y, obj) {
+ dragNode = null;
+ if (playerCar) {
+ playerCar.speed *= 0.5;
+ }
+};
+// Spawn functions
+function spawnObstacle() {
+ var obstacle = new ObstacleCar();
+ obstacle.x = Math.random() * 1800 + 124; // Random X position within road bounds
+ obstacle.y = -100;
+ obstacle.speed = gameSpeed;
+ obstacles.push(obstacle);
+ game.addChild(obstacle);
+}
+function spawnCoin() {
+ var coin = new Coin();
+ coin.x = Math.random() * 1800 + 124;
+ coin.y = -100;
+ coin.speed = gameSpeed;
+ coins.push(coin);
+ game.addChild(coin);
+}
+function spawnRoadLine() {
+ var roadLine = new RoadLine();
+ roadLine.x = 1024;
+ roadLine.y = -100;
+ roadLine.speed = gameSpeed;
+ roadLines.push(roadLine);
+ game.addChild(roadLine);
+}
+// Main game loop
+game.update = function () {
+ if (!gameStarted) return;
+ // Update distance score
+ distanceScore += gameSpeed / 10;
+ // Increase game speed gradually
+ if (LK.ticks % 300 === 0) {
+ gameSpeed += 0.5;
+ }
+ // Spawn obstacles
+ spawnTimer++;
+ if (spawnTimer > 60 - gameSpeed * 2) {
+ spawnObstacle();
+ spawnTimer = 0;
+ }
+ // Spawn coins
+ coinSpawnTimer++;
+ if (coinSpawnTimer > 120) {
+ spawnCoin();
+ coinSpawnTimer = 0;
+ }
+ // Spawn road lines
+ roadLineSpawnTimer++;
+ if (roadLineSpawnTimer > 40) {
+ spawnRoadLine();
+ roadLineSpawnTimer = 0;
+ }
+ // Update and check obstacles
+ for (var i = obstacles.length - 1; i >= 0; i--) {
+ var obstacle = obstacles[i];
+ if (obstacle.lastY === undefined) obstacle.lastY = obstacle.y;
+ // Remove off-screen obstacles
+ if (obstacle.lastY < 2800 && obstacle.y >= 2800) {
+ obstacle.destroy();
+ obstacles.splice(i, 1);
+ continue;
+ }
+ // Check collision with player
+ if (obstacle.intersects(playerCar)) {
+ LK.getSound('crash').play();
+ LK.effects.flashScreen(0xff0000, 1000);
+ LK.showGameOver();
+ return;
+ }
+ obstacle.lastY = obstacle.y;
+ }
+ // Update and check coins
+ for (var j = coins.length - 1; j >= 0; j--) {
+ var coin = coins[j];
+ if (coin.lastY === undefined) coin.lastY = coin.y;
+ if (coin.lastCollected === undefined) coin.lastCollected = false;
+ // Remove off-screen coins
+ if (coin.lastY < 2800 && coin.y >= 2800) {
+ coin.destroy();
+ coins.splice(j, 1);
+ continue;
+ }
+ // Check collection
+ var currentCollected = coin.intersects(playerCar);
+ if (!coin.lastCollected && currentCollected) {
+ LK.getSound('collectCoin').play();
+ coinScore += 10;
+ LK.setScore(Math.floor(distanceScore) + coinScore);
+ coin.destroy();
+ coins.splice(j, 1);
+ continue;
+ }
+ coin.lastY = coin.y;
+ coin.lastCollected = currentCollected;
+ }
+ // Update and remove road lines
+ for (var k = roadLines.length - 1; k >= 0; k--) {
+ var roadLine = roadLines[k];
+ if (roadLine.lastY === undefined) roadLine.lastY = roadLine.y;
+ if (roadLine.lastY < 2800 && roadLine.y >= 2800) {
+ roadLine.destroy();
+ roadLines.splice(k, 1);
+ continue;
+ }
+ roadLine.lastY = roadLine.y;
+ }
+ // Update UI
+ scoreText.setText('Score: ' + (Math.floor(distanceScore) + coinScore));
+ distanceText.setText('Distance: ' + Math.floor(distanceScore) + 'm');
+ // Update speeds for all moving objects
+ for (var l = 0; l < obstacles.length; l++) {
+ obstacles[l].speed = gameSpeed;
+ }
+ for (var m = 0; m < coins.length; m++) {
+ coins[m].speed = gameSpeed;
+ }
+ for (var n = 0; n < roadLines.length; n++) {
+ roadLines[n].speed = gameSpeed;
+ }
+};
\ No newline at end of file
Ford mustang. High contrast. No shadows
Gold coins. In-Game asset. 2d. High contrast. No shadows
Minecraf hardcore heart. In-Game asset. 2d. High contrast. No shadows
Arkadan fotoğraflı araba. In-Game asset. 2d. High contrast. No shadows
İksir. In-Game asset. 2d. High contrast. No shadows
Atom bomb. In-Game asset. 2d. High contrast. No shadows