User prompt
remove the treeLeft and treeRight assets in the game
User prompt
i want right side background asset also left side background asset
User prompt
assign that assets into the game also
User prompt
i want to add trees so that create two assets one is right side of the road and another one is left side of the road
Code edit (1 edits merged)
Please save this source code
User prompt
Neon Runner X
Initial prompt
đšī¸ Game Name: Neon Runner X đ Game Description: Dive into a glowing cyber world and outrun the digital void! In Neon Runner X, you control a high-speed light-avatar racing through infinite neon highways. Dodge pixel-perfect obstacles, switch lanes in split-second reflexes, and survive the ever-changing speed of a collapsing cyber verse. The longer you run, the wilder the world becomes â can you master the perfect run? âĄī¸ Core Game Mechanics: Mechanic Description đââī¸ Auto-Run The player avatar runs forward automatically. Click to Shift Player switches lanes (Left / Right). âŦī¸ Jump Tap or swipe up to leap over gaps. đ°ī¸ Dash / Time Slow Collect "Neon Boost" to slow time or dash forward. đ Collectibles Energy Cores & Neon Bits â used for skins & upgrades. â ī¸ Obstacles Moving walls, neon spikes, void holes, laser grids. đŽ Game Flow: Start Player taps Play. Tutorial overlays: "Swipe to shift, tap to jump, collect Neon Bits!" Core Gameplay Loop Randomly generated cyber highways. Players shift lanes, jump gaps, avoid lasers. Speed increases the longer you survive. "Neon Boost" items temporarily slow the game down for clutch moves. Failure State Crashing into obstacles or falling = game over. Show distance + collected Neon Bits. Quick Restart or Leaderboard prompt. Progression & Rewards Earn Neon Bits per run. Unlock new avatars: Tron-like bikes, cyber foxes, neon gliders. Weekly missions (distance, item collection, no-mistake runs).
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1", { highScore: 0, neonBits: 0 }); /**** * Classes ****/ var NeonBit = Container.expand(function () { var self = Container.call(this); var neonBitGraphics = self.attachAsset('neonBit', { anchorX: 0.5, anchorY: 0.5 }); self.lane = 0; self.speed = 8; self.active = true; self.init = function (lane, y, speed) { self.lane = lane; self.x = LANE_POSITIONS[lane]; self.y = y; self.speed = speed; self.active = true; self.alpha = 1; // Pulsating effect tween(neonBitGraphics, { alpha: 0.5 }, { duration: 500, easing: tween.linear, onFinish: function onFinish() { if (self.active) { tween(neonBitGraphics, { alpha: 1 }, { duration: 500, easing: tween.linear }); } } }); }; self.collect = function () { if (self.active) { self.active = false; LK.getSound('collect').play(); // Animation effect tween(self, { alpha: 0, scaleX: 2, scaleY: 2 }, { duration: 300, easing: tween.easeOut }); // Add to score neonBitsCollected++; storage.neonBits = storage.neonBits + 1; updateScoreDisplay(); } }; self.update = function () { if (self.active) { self.y += self.speed; // Remove when off screen if (self.y > 2732 + neonBitGraphics.height) { self.active = false; } } }; return self; }); var Obstacle = Container.expand(function () { var self = Container.call(this); var obstacleGraphics = self.attachAsset('obstacle', { anchorX: 0.5, anchorY: 0.5 }); self.lane = 0; self.speed = 10; self.active = true; self.init = function (lane, y, speed) { self.lane = lane; self.x = LANE_POSITIONS[lane]; self.y = y; self.speed = speed; self.active = true; self.alpha = 1; }; self.update = function () { if (self.active) { self.y += self.speed; // Remove when off screen if (self.y > 2732 + obstacleGraphics.height) { self.active = false; } } }; return self; }); var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); self.lane = 1; // 0: left, 1: center, 2: right self.jumping = false; self.speed = 15; self.gravity = 0.8; self.jumpPower = -20; self.velocityY = 0; self.alive = true; self.jump = function () { if (!self.jumping && self.alive) { self.jumping = true; self.velocityY = self.jumpPower; LK.getSound('jump').play(); } }; self.changeLane = function (direction) { if (self.alive) { var targetLane = self.lane + direction; if (targetLane >= 0 && targetLane <= 2) { self.lane = targetLane; var targetX = LANE_POSITIONS[self.lane]; tween(self, { x: targetX }, { duration: 200, easing: tween.easeOut }); } } }; self.update = function () { if (self.jumping) { self.velocityY += self.gravity; self.y += self.velocityY; // Ground collision if (self.y >= GROUND_Y - playerGraphics.height / 2) { self.y = GROUND_Y - playerGraphics.height / 2; self.jumping = false; self.velocityY = 0; } } }; self.crash = function () { if (self.alive) { self.alive = false; LK.getSound('crash').play(); LK.effects.flashObject(self, 0xFF0000, 500); tween(self, { alpha: 0.2 }, { duration: 500 }); // Save high score if (score > storage.highScore) { storage.highScore = score; } LK.setTimeout(function () { LK.showGameOver(); }, 1000); } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000022 }); /**** * Game Code ****/ // Game constants var LANE_WIDTH = 400; var LANE_POSITIONS = [2048 / 2 - LANE_WIDTH, 2048 / 2, 2048 / 2 + LANE_WIDTH]; var GROUND_Y = 2400; var SPAWN_Y = -100; var MAX_OBSTACLES = 15; var MAX_NEON_BITS = 10; // Game variables var score = 0; var neonBitsCollected = 0; var distanceTraveled = 0; var gameSpeed = 10; var obstacleFrequency = 100; var nextObstacleIn = obstacleFrequency; var nextNeonBitIn = 50; var isGameStarted = false; // Game UI var scoreText = new Text2('SCORE: 0', { size: 70, fill: 0x00FFFF }); scoreText.anchor.set(1, 0); LK.gui.topRight.addChild(scoreText); var neonBitsText = new Text2('BITS: 0', { size: 70, fill: 0xFFFF00 }); neonBitsText.anchor.set(0, 0); LK.gui.topLeft.addChild(neonBitsText); neonBitsText.x = 120; // Move away from top left corner var highScoreText = new Text2('BEST: ' + storage.highScore, { size: 50, fill: 0xFF66FF }); highScoreText.anchor.set(0.5, 0); LK.gui.top.addChild(highScoreText); // Game background var background = game.addChild(LK.getAsset('background', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2 })); // Left background var backgroundLeft = game.addChild(LK.getAsset('backgroundLeft', { anchorX: 1.0, anchorY: 0.5, x: LANE_POSITIONS[0] - 300, y: 2732 / 2 })); // Right background var backgroundRight = game.addChild(LK.getAsset('backgroundRight', { anchorX: 0.0, anchorY: 0.5, x: LANE_POSITIONS[2] + 300, y: 2732 / 2 })); // Create ground var ground = game.addChild(LK.getAsset('ground', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: GROUND_Y })); // Create lane markers var lanes = []; for (var i = 0; i < 10; i++) { for (var laneIdx = 0; laneIdx < 3; laneIdx++) { var laneMarker = game.addChild(LK.getAsset('lane', { anchorX: 0.5, anchorY: 0.5, x: LANE_POSITIONS[laneIdx], y: i * 600 - 300 })); lanes.push(laneMarker); } } // Create player var player = game.addChild(new Player()); player.x = LANE_POSITIONS[player.lane]; player.y = GROUND_Y - 100; // Create obstacles pool var obstacles = []; for (var i = 0; i < MAX_OBSTACLES; i++) { var obstacle = new Obstacle(); obstacle.active = false; obstacles.push(obstacle); game.addChild(obstacle); } // Create neon bits pool var neonBits = []; for (var i = 0; i < MAX_NEON_BITS; i++) { var neonBit = new NeonBit(); neonBit.active = false; neonBits.push(neonBit); game.addChild(neonBit); } // Game functions function spawnObstacle() { // Find an inactive obstacle from the pool for (var i = 0; i < obstacles.length; i++) { if (!obstacles[i].active) { var lane = Math.floor(Math.random() * 3); obstacles[i].init(lane, SPAWN_Y, gameSpeed); return; } } } function spawnNeonBit() { // Find an inactive neon bit from the pool for (var i = 0; i < neonBits.length; i++) { if (!neonBits[i].active) { var lane = Math.floor(Math.random() * 3); neonBits[i].init(lane, SPAWN_Y, gameSpeed * 0.8); return; } } } function updateScoreDisplay() { scoreText.setText('SCORE: ' + Math.floor(score)); neonBitsText.setText('BITS: ' + neonBitsCollected); highScoreText.setText('BEST: ' + storage.highScore); } function checkCollisions() { if (!player.alive) { return; } // Check obstacle collisions for (var i = 0; i < obstacles.length; i++) { var obstacle = obstacles[i]; if (obstacle.active && player.lane === obstacle.lane && player.y + player.height / 2 > obstacle.y - obstacle.height / 2 && player.y - player.height / 2 < obstacle.y + obstacle.height / 2) { player.crash(); return; } } // Check neon bit collections for (var i = 0; i < neonBits.length; i++) { var bit = neonBits[i]; if (bit.active && player.lane === bit.lane && player.y + player.height / 2 > bit.y - bit.height / 2 && player.y - player.height / 2 < bit.y + bit.height / 2) { bit.collect(); } } } function moveLanes() { for (var i = 0; i < lanes.length; i++) { lanes[i].y += gameSpeed; // Reset lane position when it goes off screen if (lanes[i].y > 2732 + lanes[i].height / 2) { lanes[i].y = -300; } } } function startGame() { if (!isGameStarted) { isGameStarted = true; LK.playMusic('cyberpunk'); } } // Event handlers game.down = function (x, y, obj) { startGame(); // Determine if tap is on left or right side of screen if (x < 2048 / 2) { player.changeLane(-1); // Move left } else { player.changeLane(1); // Move right } }; game.up = function (x, y, obj) { // Optional: Handle jump on release if (y < 2732 / 2) { player.jump(); } }; // Main game loop game.update = function () { if (!isGameStarted) { return; } // Increase game speed over time gameSpeed = 10 + Math.floor(distanceTraveled / 1000); distanceTraveled += gameSpeed; score = distanceTraveled / 100; // Update obstacle spawn frequency obstacleFrequency = Math.max(50, 100 - Math.floor(score / 50) * 5); // Update display if (LK.ticks % 10 === 0) { updateScoreDisplay(); } // Move lane markers moveLanes(); // Spawn obstacles nextObstacleIn--; if (nextObstacleIn <= 0) { spawnObstacle(); nextObstacleIn = obstacleFrequency; } // Spawn neon bits nextNeonBitIn--; if (nextNeonBitIn <= 0) { spawnNeonBit(); nextNeonBitIn = Math.floor(Math.random() * 100) + 50; } // Update obstacles for (var i = 0; i < obstacles.length; i++) { if (obstacles[i].active) { obstacles[i].update(); } } // Update neon bits for (var i = 0; i < neonBits.length; i++) { if (neonBits[i].active) { neonBits[i].update(); } } // Check for collisions checkCollisions(); // Set LK score for leaderboards LK.setScore(Math.floor(score)); };
===================================================================
--- original.js
+++ change.js
@@ -169,66 +169,8 @@
}
};
return self;
});
-var Tree = Container.expand(function () {
- var self = Container.call(this);
- // Create a trunk for the tree
- var trunk = self.addChild(new Container());
- var trunkGraphics = trunk.attachAsset('ground', {
- anchorX: 0.5,
- anchorY: 0.5,
- scaleX: 0.15,
- scaleY: 3,
- tint: 0xAA00FF // Neon purple trunk
- });
- // Create some foliage for the tree
- var foliage = self.addChild(new Container());
- var foliageGraphics = foliage.attachAsset('centerCircle', {
- anchorX: 0.5,
- anchorY: 0.5,
- scaleX: 2.5,
- scaleY: 2.5,
- tint: 0x00FF88 // Neon green foliage
- });
- foliage.y = -trunkGraphics.height * 0.8;
- self.side = "left"; // Default side
- self.active = true;
- self.speed = 10;
- self.init = function (side, y, speed) {
- self.side = side;
- self.y = y;
- self.speed = speed;
- self.active = true;
- self.alpha = 1;
- // Position based on side (left or right of road)
- if (side === "left") {
- self.x = LANE_POSITIONS[0] - 400; // Left of the left lane
- foliageGraphics.tint = 0x00FF88; // Green for left trees
- trunkGraphics.tint = 0xAA00FF; // Purple trunk
- } else {
- self.x = LANE_POSITIONS[2] + 400; // Right of the right lane
- foliageGraphics.tint = 0xFF00AA; // Pink for right trees
- trunkGraphics.tint = 0x00AAFF; // Blue trunk
- }
- // Random scale for variety
- var scale = 0.6 + Math.random() * 0.5;
- self.scale.set(scale, scale);
- // Random rotation to add variety
- trunk.rotation = (Math.random() - 0.5) * 0.2;
- foliage.rotation = (Math.random() - 0.5) * 0.3;
- };
- self.update = function () {
- if (self.active) {
- self.y += self.speed;
- // Remove when off screen
- if (self.y > 2732 + 300) {
- self.active = false;
- }
- }
- };
- return self;
-});
/****
* Initialize Game
****/
@@ -335,27 +277,8 @@
neonBit.active = false;
neonBits.push(neonBit);
game.addChild(neonBit);
}
-// Create trees pool for decoration
-var MAX_TREES = 20;
-var leftTrees = [];
-var rightTrees = [];
-var nextTreeIn = 30;
-// Create left side trees
-for (var i = 0; i < MAX_TREES / 2; i++) {
- var leftTree = new Tree();
- leftTree.active = false;
- leftTrees.push(leftTree);
- game.addChild(leftTree);
-}
-// Create right side trees
-for (var i = 0; i < MAX_TREES / 2; i++) {
- var rightTree = new Tree();
- rightTree.active = false;
- rightTrees.push(rightTree);
- game.addChild(rightTree);
-}
// Game functions
function spawnObstacle() {
// Find an inactive obstacle from the pool
for (var i = 0; i < obstacles.length; i++) {
@@ -375,24 +298,8 @@
return;
}
}
}
-function spawnTrees() {
- // Try to spawn a left side tree
- for (var i = 0; i < leftTrees.length; i++) {
- if (!leftTrees[i].active) {
- leftTrees[i].init("left", SPAWN_Y, gameSpeed * 0.9);
- break;
- }
- }
- // Try to spawn a right side tree
- for (var i = 0; i < rightTrees.length; i++) {
- if (!rightTrees[i].active) {
- rightTrees[i].init("right", SPAWN_Y, gameSpeed * 0.9);
- break;
- }
- }
-}
function updateScoreDisplay() {
scoreText.setText('SCORE: ' + Math.floor(score));
neonBitsText.setText('BITS: ' + neonBitsCollected);
highScoreText.setText('BEST: ' + storage.highScore);
@@ -476,14 +383,8 @@
if (nextNeonBitIn <= 0) {
spawnNeonBit();
nextNeonBitIn = Math.floor(Math.random() * 100) + 50;
}
- // Spawn trees for decoration
- nextTreeIn--;
- if (nextTreeIn <= 0) {
- spawnTrees();
- nextTreeIn = Math.floor(Math.random() * 40) + 20; // More frequent tree spawning
- }
// Update obstacles
for (var i = 0; i < obstacles.length; i++) {
if (obstacles[i].active) {
obstacles[i].update();
@@ -494,19 +395,8 @@
if (neonBits[i].active) {
neonBits[i].update();
}
}
- // Update trees
- for (var i = 0; i < leftTrees.length; i++) {
- if (leftTrees[i].active) {
- leftTrees[i].update();
- }
- }
- for (var i = 0; i < rightTrees.length; i++) {
- if (rightTrees[i].active) {
- rightTrees[i].update();
- }
- }
// Check for collisions
checkCollisions();
// Set LK score for leaderboards
LK.setScore(Math.floor(score));
đĻ Animal-based " a back side view of neon cyber fox, glowing fur, sleek design". Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
A glowing neon energy orb, futuristic collectible, electric blue and violet gradients, soft light emission, metallic core, floating in mid-air over a digital grid, emitting holographic particles, synthwave cyberpunk aesthetic, ultra-high definition, transparent background.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
tree. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
"A straight grassy path with glowing green neon edges, lined with vibrant flowers and futuristic-looking trees on both sides. The background is in a cyberpunk style with soft glowing grass, bioluminescent flowers, and stylized trees with colorful leaves. Bright, clean night setting with a subtle purple-blue sky glow in the distance, suitable for a side-scrolling neon runner game. Stylized, vibrant, 2D art.". Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
"A glowing neon power-up bit in electric golden shaped like a sphere shard. The object should have a vibrant futuristic glow, clearly distinct from red or orange obstacles. The background should be transparent. Style: cyberpunk, suitable for a neon-themed endless runner game.". Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows