/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var Cloud = Container.expand(function (x, y) { var self = Container.call(this); var cloudGraphics = self.attachAsset('cloud', { anchorX: 0.5, anchorY: 0.5 }); self.x = x || 2200; self.y = y || 800; self.speed = 2; // Clouds move slower than obstacles self.alpha = 0.6; // Make clouds semi-transparent self.update = function () { self.x -= self.speed; }; return self; }); var GroundTile = Container.expand(function (x) { var self = Container.call(this); var groundGraphics = self.attachAsset('ground', { anchorX: 0, anchorY: 1.0 }); self.x = x || 0; self.y = 2460; self.speed = 0; self.update = function () { // Ground is now stationary }; return self; }); var Obstacle = Container.expand(function (type, x, y) { var self = Container.call(this); self.obstacleType = type || 'barrier'; var assetId = 'obstacle'; if (self.obstacleType === 'gap') assetId = 'gap'; if (self.obstacleType === 'spike') assetId = 'spike'; if (self.obstacleType === 'platform') assetId = 'platform'; var obstacleGraphics = self.attachAsset(assetId, { anchorX: 0.5, anchorY: 1.0 }); self.x = x || 2200; self.y = y || 2400; self.speed = gameSpeed; if (self.obstacleType === 'platform') { self.moveDirection = 1; self.moveRange = 100; self.startY = self.y; } self.update = function () { self.x -= self.speed; if (self.obstacleType === 'platform') { self.y += self.moveDirection * 2; if (self.y > self.startY + self.moveRange || self.y < self.startY - self.moveRange) { self.moveDirection *= -1; } } }; return self; }); var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.attachAsset('player', { anchorX: 0.5, anchorY: 1.0 }); self.isJumping = false; self.isSliding = false; self.velocityY = 0; self.groundY = 2400; self.jumpPower = -25.5; self.gravity = 1.2; self.normalHeight = 80; self.slideHeight = 40; self.jump = function () { if (!self.isJumping && !self.isSliding) { self.isJumping = true; self.velocityY = self.jumpPower; self.x += 30; // Move character forward when jumping LK.getSound('jump').play(); } }; self.slide = function () { if (!self.isJumping && !self.isSliding) { self.isSliding = true; playerGraphics.height = self.slideHeight; LK.getSound('slide').play(); LK.setTimeout(function () { self.isSliding = false; playerGraphics.height = self.normalHeight; }, 600); } }; self.update = function () { if (self.isJumping) { self.velocityY += self.gravity; self.y += self.velocityY; if (self.y >= self.groundY) { self.y = self.groundY; self.velocityY = 0; self.isJumping = false; } } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87CEEB }); /**** * Game Code ****/ var gameSpeed = 8; var gameRunning = false; var distance = 0; var difficultyTimer = 0; var obstacleTimer = 0; var groundTimer = 0; var player; var obstacles = []; var groundTiles = []; var clouds = []; var cloudTimer = 0; var scoreText = new Text2('Distance: 0', { size: 60, fill: 0xFFFFFF }); scoreText.anchor.set(0.5, 0); LK.gui.top.addChild(scoreText); var instructionText = new Text2('Tap to Jump • Swipe Down to Slide', { size: 45, fill: 0xFFFFFF }); instructionText.anchor.set(0.5, 0.5); instructionText.x = 1024; instructionText.y = 1000; game.addChild(instructionText); var startText = new Text2('TAP TO START', { size: 80, fill: 0xFFD700 }); startText.anchor.set(0.5, 0.5); startText.x = 1024; startText.y = 1366; game.addChild(startText); // Initialize player player = game.addChild(new Player()); player.x = 400; player.y = 2400; // Initialize ground for (var i = 0; i < 15; i++) { var groundTile = game.addChild(new GroundTile(i * 200)); groundTiles.push(groundTile); } // High score display var highScore = storage.highScore || 0; var highScoreText = new Text2('Best: ' + highScore, { size: 50, fill: 0xFFFF00 }); highScoreText.anchor.set(1, 0); LK.gui.topRight.addChild(highScoreText); function startGame() { gameRunning = true; gameSpeed = 8; distance = 0; difficultyTimer = 0; obstacleTimer = 0; // Clear existing obstacles for (var i = obstacles.length - 1; i >= 0; i--) { obstacles[i].destroy(); } obstacles = []; // Clear existing clouds for (var i = clouds.length - 1; i >= 0; i--) { clouds[i].destroy(); } clouds = []; cloudTimer = 0; // Hide start text startText.visible = false; instructionText.visible = false; // Reset player position player.x = 400; player.y = 2400; player.isJumping = false; player.isSliding = false; player.velocityY = 0; } function endGame() { gameRunning = false; // Update high score if (distance > highScore) { highScore = distance; storage.highScore = highScore; highScoreText.setText('Best: ' + highScore); } // Play hit sound LK.getSound('hit').play(); // Flash effect LK.effects.flashScreen(0xFF0000, 500); // Show game over LK.showGameOver(); } function generateObstacle() { var obstacleTypes = ['barrier', 'gap', 'spike', 'platform']; var randomType = obstacleTypes[Math.floor(Math.random() * obstacleTypes.length)]; var obstacleX = 2200; var obstacleY = 2400; if (randomType === 'platform') { obstacleY = 2200 + Math.random() * 200; } var obstacle = new Obstacle(randomType, obstacleX, obstacleY); obstacle.speed = gameSpeed; obstacles.push(obstacle); game.addChild(obstacle); } var lastTouchY = 0; var swipeThreshold = 100; game.down = function (x, y, obj) { lastTouchY = y; if (!gameRunning) { startGame(); return; } // Jump on tap player.jump(); }; game.up = function (x, y, obj) { if (!gameRunning) return; var swipeDistance = y - lastTouchY; // Swipe down to slide if (swipeDistance > swipeThreshold) { player.slide(); } }; game.update = function () { if (!gameRunning) return; // Update distance distance += 1; scoreText.setText('Distance: ' + Math.floor(distance / 10)); // Increase difficulty over time difficultyTimer++; if (difficultyTimer % 600 === 0) { // Every 10 seconds gameSpeed += 0.5; } // Increase speed every 100 score points (every 1000 distance units) var currentScore = Math.floor(distance / 10); if (currentScore > 0 && currentScore % 100 === 0) { // Check if we just reached a new 100-point milestone var lastScore = Math.floor((distance - 1) / 10); if (lastScore % 100 !== 0) { gameSpeed += 0.3; // Small speed boost every 100 points } } // Generate obstacles obstacleTimer++; var obstacleInterval = Math.max(60, 120 - Math.floor(distance / 100)); if (obstacleTimer >= obstacleInterval) { obstacleTimer = 0; generateObstacle(); } // Update and manage obstacles for (var i = obstacles.length - 1; i >= 0; i--) { var obstacle = obstacles[i]; obstacle.speed = gameSpeed; if (obstacle.x < -200) { obstacle.destroy(); obstacles.splice(i, 1); continue; } // Collision detection if (player.intersects(obstacle)) { if (obstacle.obstacleType === 'gap') { // Only collide with gap if player is on ground if (!player.isJumping) { endGame(); return; } } else if (obstacle.obstacleType === 'spike') { // Spikes are deadly unless sliding if (!player.isSliding) { endGame(); return; } } else { // Regular obstacles endGame(); return; } } } // Generate clouds for background cloudTimer++; if (cloudTimer >= 180) { // Generate cloud every 3 seconds cloudTimer = 0; var cloudX = 2200; var cloudY = 400 + Math.random() * 800; // Random Y position in upper part of screen var cloud = new Cloud(cloudX, cloudY); clouds.push(cloud); game.addChild(cloud); } // Update and manage clouds for (var i = clouds.length - 1; i >= 0; i--) { var cloud = clouds[i]; if (cloud.x < -300) { cloud.destroy(); clouds.splice(i, 1); } } // Ground tiles are now stationary - no need to update them };
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var Cloud = Container.expand(function (x, y) {
var self = Container.call(this);
var cloudGraphics = self.attachAsset('cloud', {
anchorX: 0.5,
anchorY: 0.5
});
self.x = x || 2200;
self.y = y || 800;
self.speed = 2; // Clouds move slower than obstacles
self.alpha = 0.6; // Make clouds semi-transparent
self.update = function () {
self.x -= self.speed;
};
return self;
});
var GroundTile = Container.expand(function (x) {
var self = Container.call(this);
var groundGraphics = self.attachAsset('ground', {
anchorX: 0,
anchorY: 1.0
});
self.x = x || 0;
self.y = 2460;
self.speed = 0;
self.update = function () {
// Ground is now stationary
};
return self;
});
var Obstacle = Container.expand(function (type, x, y) {
var self = Container.call(this);
self.obstacleType = type || 'barrier';
var assetId = 'obstacle';
if (self.obstacleType === 'gap') assetId = 'gap';
if (self.obstacleType === 'spike') assetId = 'spike';
if (self.obstacleType === 'platform') assetId = 'platform';
var obstacleGraphics = self.attachAsset(assetId, {
anchorX: 0.5,
anchorY: 1.0
});
self.x = x || 2200;
self.y = y || 2400;
self.speed = gameSpeed;
if (self.obstacleType === 'platform') {
self.moveDirection = 1;
self.moveRange = 100;
self.startY = self.y;
}
self.update = function () {
self.x -= self.speed;
if (self.obstacleType === 'platform') {
self.y += self.moveDirection * 2;
if (self.y > self.startY + self.moveRange || self.y < self.startY - self.moveRange) {
self.moveDirection *= -1;
}
}
};
return self;
});
var Player = Container.expand(function () {
var self = Container.call(this);
var playerGraphics = self.attachAsset('player', {
anchorX: 0.5,
anchorY: 1.0
});
self.isJumping = false;
self.isSliding = false;
self.velocityY = 0;
self.groundY = 2400;
self.jumpPower = -25.5;
self.gravity = 1.2;
self.normalHeight = 80;
self.slideHeight = 40;
self.jump = function () {
if (!self.isJumping && !self.isSliding) {
self.isJumping = true;
self.velocityY = self.jumpPower;
self.x += 30; // Move character forward when jumping
LK.getSound('jump').play();
}
};
self.slide = function () {
if (!self.isJumping && !self.isSliding) {
self.isSliding = true;
playerGraphics.height = self.slideHeight;
LK.getSound('slide').play();
LK.setTimeout(function () {
self.isSliding = false;
playerGraphics.height = self.normalHeight;
}, 600);
}
};
self.update = function () {
if (self.isJumping) {
self.velocityY += self.gravity;
self.y += self.velocityY;
if (self.y >= self.groundY) {
self.y = self.groundY;
self.velocityY = 0;
self.isJumping = false;
}
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB
});
/****
* Game Code
****/
var gameSpeed = 8;
var gameRunning = false;
var distance = 0;
var difficultyTimer = 0;
var obstacleTimer = 0;
var groundTimer = 0;
var player;
var obstacles = [];
var groundTiles = [];
var clouds = [];
var cloudTimer = 0;
var scoreText = new Text2('Distance: 0', {
size: 60,
fill: 0xFFFFFF
});
scoreText.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreText);
var instructionText = new Text2('Tap to Jump • Swipe Down to Slide', {
size: 45,
fill: 0xFFFFFF
});
instructionText.anchor.set(0.5, 0.5);
instructionText.x = 1024;
instructionText.y = 1000;
game.addChild(instructionText);
var startText = new Text2('TAP TO START', {
size: 80,
fill: 0xFFD700
});
startText.anchor.set(0.5, 0.5);
startText.x = 1024;
startText.y = 1366;
game.addChild(startText);
// Initialize player
player = game.addChild(new Player());
player.x = 400;
player.y = 2400;
// Initialize ground
for (var i = 0; i < 15; i++) {
var groundTile = game.addChild(new GroundTile(i * 200));
groundTiles.push(groundTile);
}
// High score display
var highScore = storage.highScore || 0;
var highScoreText = new Text2('Best: ' + highScore, {
size: 50,
fill: 0xFFFF00
});
highScoreText.anchor.set(1, 0);
LK.gui.topRight.addChild(highScoreText);
function startGame() {
gameRunning = true;
gameSpeed = 8;
distance = 0;
difficultyTimer = 0;
obstacleTimer = 0;
// Clear existing obstacles
for (var i = obstacles.length - 1; i >= 0; i--) {
obstacles[i].destroy();
}
obstacles = [];
// Clear existing clouds
for (var i = clouds.length - 1; i >= 0; i--) {
clouds[i].destroy();
}
clouds = [];
cloudTimer = 0;
// Hide start text
startText.visible = false;
instructionText.visible = false;
// Reset player position
player.x = 400;
player.y = 2400;
player.isJumping = false;
player.isSliding = false;
player.velocityY = 0;
}
function endGame() {
gameRunning = false;
// Update high score
if (distance > highScore) {
highScore = distance;
storage.highScore = highScore;
highScoreText.setText('Best: ' + highScore);
}
// Play hit sound
LK.getSound('hit').play();
// Flash effect
LK.effects.flashScreen(0xFF0000, 500);
// Show game over
LK.showGameOver();
}
function generateObstacle() {
var obstacleTypes = ['barrier', 'gap', 'spike', 'platform'];
var randomType = obstacleTypes[Math.floor(Math.random() * obstacleTypes.length)];
var obstacleX = 2200;
var obstacleY = 2400;
if (randomType === 'platform') {
obstacleY = 2200 + Math.random() * 200;
}
var obstacle = new Obstacle(randomType, obstacleX, obstacleY);
obstacle.speed = gameSpeed;
obstacles.push(obstacle);
game.addChild(obstacle);
}
var lastTouchY = 0;
var swipeThreshold = 100;
game.down = function (x, y, obj) {
lastTouchY = y;
if (!gameRunning) {
startGame();
return;
}
// Jump on tap
player.jump();
};
game.up = function (x, y, obj) {
if (!gameRunning) return;
var swipeDistance = y - lastTouchY;
// Swipe down to slide
if (swipeDistance > swipeThreshold) {
player.slide();
}
};
game.update = function () {
if (!gameRunning) return;
// Update distance
distance += 1;
scoreText.setText('Distance: ' + Math.floor(distance / 10));
// Increase difficulty over time
difficultyTimer++;
if (difficultyTimer % 600 === 0) {
// Every 10 seconds
gameSpeed += 0.5;
}
// Increase speed every 100 score points (every 1000 distance units)
var currentScore = Math.floor(distance / 10);
if (currentScore > 0 && currentScore % 100 === 0) {
// Check if we just reached a new 100-point milestone
var lastScore = Math.floor((distance - 1) / 10);
if (lastScore % 100 !== 0) {
gameSpeed += 0.3; // Small speed boost every 100 points
}
}
// Generate obstacles
obstacleTimer++;
var obstacleInterval = Math.max(60, 120 - Math.floor(distance / 100));
if (obstacleTimer >= obstacleInterval) {
obstacleTimer = 0;
generateObstacle();
}
// Update and manage obstacles
for (var i = obstacles.length - 1; i >= 0; i--) {
var obstacle = obstacles[i];
obstacle.speed = gameSpeed;
if (obstacle.x < -200) {
obstacle.destroy();
obstacles.splice(i, 1);
continue;
}
// Collision detection
if (player.intersects(obstacle)) {
if (obstacle.obstacleType === 'gap') {
// Only collide with gap if player is on ground
if (!player.isJumping) {
endGame();
return;
}
} else if (obstacle.obstacleType === 'spike') {
// Spikes are deadly unless sliding
if (!player.isSliding) {
endGame();
return;
}
} else {
// Regular obstacles
endGame();
return;
}
}
}
// Generate clouds for background
cloudTimer++;
if (cloudTimer >= 180) {
// Generate cloud every 3 seconds
cloudTimer = 0;
var cloudX = 2200;
var cloudY = 400 + Math.random() * 800; // Random Y position in upper part of screen
var cloud = new Cloud(cloudX, cloudY);
clouds.push(cloud);
game.addChild(cloud);
}
// Update and manage clouds
for (var i = clouds.length - 1; i >= 0; i--) {
var cloud = clouds[i];
if (cloud.x < -300) {
cloud.destroy();
clouds.splice(i, 1);
}
}
// Ground tiles are now stationary - no need to update them
};
Fullscreen modern App Store landscape banner, 16:9, high definition, for a game titled "Parkour Runner Challenge" and with the description "Navigate your character through endless randomly generated parkour obstacles using simple touch controls in this challenging runner game.". No text on banner!
odun. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat