/**** * 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)); };
/****
* 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));
};
🦊 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