/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1", { highScore: 0, coins: 0 }); /**** * Classes ****/ var Collectible = Container.expand(function (type) { var self = Container.call(this); self.type = type || 'coin'; var collectibleGraphics = self.attachAsset(self.type, { anchorX: 0.5, anchorY: 0.5 }); self.speed = 10; self.update = function () { self.y += self.speed; // Spin the collectible collectibleGraphics.rotation += 0.05; // Remove collectible when it goes off screen if (self.y > 2732 + collectibleGraphics.height) { self.destroy(); // Find and remove from collectibles array var index = collectibles.indexOf(self); if (index !== -1) { collectibles.splice(index, 1); } } }; return self; }); var PlayerCar = Container.expand(function () { var self = Container.call(this); var carGraphics = self.attachAsset('car', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 15; self.maxSpeed = 25; self.health = 100; self.nitro = 100; self.usingNitro = false; self.dead = false; self.update = function () { if (self.dead) { return; } // Handle nitro usage if (self.usingNitro && self.nitro > 0) { self.nitro -= 1; roadObject.setSpeed(self.maxSpeed); } else { self.usingNitro = false; roadObject.setSpeed(self.speed); } // Regenerate nitro when not using if (!self.usingNitro && self.nitro < 100) { self.nitro += 0.1; } // Update UI updateUI(); }; self.damage = function (amount) { if (self.dead) { return; } self.health -= amount; // Flash red on damage LK.effects.flashObject(self, 0xff0000, 500); if (self.health <= 0) { self.health = 0; self.die(); } // Update UI updateUI(); }; self.repair = function (amount) { if (self.dead) { return; } self.health += amount; if (self.health > 100) { self.health = 100; } // Update UI updateUI(); }; self.die = function () { if (self.dead) { return; } self.dead = true; // Tint car dark tween(carGraphics, { alpha: 0.5 }, { duration: 1000 }); // Game over LK.setTimeout(function () { if (score > storage.highScore) { storage.highScore = score; } LK.showGameOver(); }, 1000); }; self.useNitro = function () { if (self.nitro > 0 && !self.usingNitro) { self.usingNitro = true; LK.getSound('nitroSound').play(); } }; self.stopNitro = function () { self.usingNitro = false; }; return self; }); var Road = Container.expand(function () { var self = Container.call(this); // Road background var roadBg = self.attachAsset('road', { anchorX: 0.5, anchorY: 0, y: 0 }); // Road lines self.lines = []; self.lineSpacing = 300; self.lineSpeed = 15; function createRoadLines() { // Clear existing lines for (var i = 0; i < self.lines.length; i++) { self.lines[i].destroy(); } self.lines = []; // Create new lines for three lanes var linesCount = Math.ceil(2732 / self.lineSpacing) + 1; var laneOffsets = [-200, 0, 200]; // Offsets for three lanes for (var i = 0; i < linesCount; i++) { for (var j = 0; j < laneOffsets.length; j++) { var line = self.attachAsset('roadLine', { anchorX: 0.5, anchorY: 0.5, x: laneOffsets[j], y: i * self.lineSpacing }); self.lines.push(line); } } // Add roadside assets to the edges of the road var roadsideLeft = self.attachAsset('roadSide', { anchorX: 1, anchorY: 0, x: -400, // Position to the left of the road y: 0 }); var roadsideRight = self.attachAsset('roadSide', { anchorX: 0, anchorY: 0, x: 400, // Position to the right of the road y: 0 }); self.addChild(roadsideLeft); self.addChild(roadsideRight); // Add background to the sides of the road var leftBackground = self.attachAsset('background', { anchorX: 1, anchorY: 0, x: -600, // Position further left y: 0 }); var rightBackground = self.attachAsset('background', { anchorX: 0, anchorY: 0, x: 600, // Position further right y: 0 }); self.addChild(leftBackground); self.addChild(rightBackground); } createRoadLines(); self.update = function () { // Update road lines for (var i = 0; i < self.lines.length; i++) { self.lines[i].y += self.lineSpeed; // Reposition line if it goes out of view if (self.lines[i].y > 2732) { // Find the topmost line var topLine = self.lines[0]; for (var j = 1; j < self.lines.length; j++) { if (self.lines[j].y < topLine.y) { topLine = self.lines[j]; } } // Position this line above the topmost line self.lines[i].y = topLine.y - self.lineSpacing; } } }; self.setSpeed = function (speed) { self.lineSpeed = speed; }; return self; }); var StatusBar = Container.expand(function (type) { var self = Container.call(this); self.type = type || 'health'; var barColor = self.type === 'health' ? 0x2ecc71 : 0xf39c12; // Background var barBackground = self.attachAsset('barBg', { anchorX: 0.5, anchorY: 0.5 }); // Actual bar var bar = self.attachAsset(self.type + 'Bar', { anchorX: 0.5, anchorY: 1, // Bottom anchor y: barBackground.height / 2 - 5 // Position at bottom of background with 5px padding }); self.originalHeight = bar.height; self.setValue = function (value) { // Clamp value between 0 and 100 value = Math.max(0, Math.min(100, value)); // Set height based on percentage bar.height = value / 100 * self.originalHeight; }; return self; }); var TrafficCar = Container.expand(function () { var self = Container.call(this); // Randomly choose different colors for traffic cars var carAssets = ['trafficCarGreen', 'trafficCarYellow', 'trafficCarWhite']; var randomAsset = carAssets[Math.floor(Math.random() * carAssets.length)]; var carGraphics = self.attachAsset(randomAsset, { anchorX: 0.5, anchorY: 0.5 }); self.speed = Math.random() * 3 + 5; // Random speed between 5 and 8 self.update = function () { self.y += self.speed; // Remove car when it goes off screen if (self.y > 2732 + carGraphics.height) { self.destroy(); // Find and remove from trafficCars array var index = trafficCars.indexOf(self); if (index !== -1) { trafficCars.splice(index, 1); } } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x95a5a6 // Light gray background }); /**** * Game Code ****/ // Game variables // Game assets will be created by the engine based on usage in code // Green car // Yellow car // White car var roadObject; var player; var trafficCars = []; var collectibles = []; var score = 0; var scoreText; var healthBar; var nitroBar; var gameStarted = false; var instructionsText; var highScoreText; var difficultyTimer; var difficultyLevel = 1; var spawnRateBase = 60; // Initialize game elements function initGame() { // Create road roadObject = new Road(); roadObject.x = 2048 / 2; // Center horizontally game.addChild(roadObject); // Create player player = new PlayerCar(); player.x = 2048 / 2; player.y = 2732 - 300; // Position near bottom game.addChild(player); // Initialize score score = 0; // Create score text scoreText = new Text2(score.toString(), { size: 100, fill: 0xFFFFFF }); scoreText.anchor.set(0.5, 0); LK.gui.top.addChild(scoreText); // Create high score text highScoreText = new Text2("Best: " + storage.highScore, { size: 50, fill: 0xFFFFFF }); highScoreText.anchor.set(0.5, 0); highScoreText.y = 110; LK.gui.top.addChild(highScoreText); // Create instructions text instructionsText = new Text2("Tap to start\nDrag to move your car\nDouble tap for nitro", { size: 80, fill: 0xFFFFFF }); instructionsText.anchor.set(0.5, 0.5); LK.gui.center.addChild(instructionsText); // Create health bar healthBar = new StatusBar('health'); healthBar.x = 80; healthBar.y = 2732 / 2; game.addChild(healthBar); // Create nitro bar nitroBar = new StatusBar('nitro'); nitroBar.x = 2048 - 80; nitroBar.y = 2732 / 2; game.addChild(nitroBar); // Set initial UI values updateUI(); // Play background music LK.playMusic('backgroundMusic', { fade: { start: 0, end: 0.3, duration: 1000 } }); // Start engine sound (looping) LK.getSound('carEngine').play(); } // Update UI elements function updateUI() { // Update score text scoreText.setText(score.toString()); // Update health bar healthBar.setValue(player.health); // Update nitro bar nitroBar.setValue(player.nitro); } // Spawn traffic car function spawnTrafficCar() { var car = new TrafficCar(); var roadWidth = 800; var positionValid = false; var attempts = 0; while (!positionValid && attempts < 10) { var laneOffsets = [-200, 0, 200]; // Offsets for three lanes var randomLane = laneOffsets[Math.floor(Math.random() * laneOffsets.length)]; car.x = 2048 / 2 + randomLane; car.y = -car.height; positionValid = true; for (var i = 0; i < trafficCars.length; i++) { // Check for overlap and ensure a minimum distance between cars if (car.intersects(trafficCars[i]) || Math.abs(car.x - trafficCars[i].x) < 120) { positionValid = false; break; } } attempts++; } if (positionValid) { game.addChild(car); trafficCars.push(car); } } // Spawn collectible function spawnCollectible() { // Determine type of collectible var type = Math.random() < 0.7 ? 'coin' : Math.random() < 0.5 ? 'nitro' : 'repair'; var collectible = new Collectible(type); // Position collectible randomly on the road var roadWidth = 800; var laneOffsets = [-200, 0, 200]; // Offsets for three lanes var randomLane = laneOffsets[Math.floor(Math.random() * laneOffsets.length)]; collectible.x = 2048 / 2 + randomLane; collectible.y = -collectible.height; game.addChild(collectible); collectibles.push(collectible); } // Start the game function startGame() { if (gameStarted) { return; } gameStarted = true; // Hide instructions tween(instructionsText, { alpha: 0 }, { duration: 500 }); // Start increasing difficulty over time difficultyTimer = LK.setInterval(function () { difficultyLevel++; // Increase player speed player.speed = Math.min(player.speed + 1, player.maxSpeed); // Increase player max speed with nitro player.maxSpeed = Math.min(player.maxSpeed + 1, 35); // Update road speed roadObject.setSpeed(player.speed); }, 10000); // Increase difficulty every 10 seconds } // Check for collisions function checkCollisions() { if (!gameStarted || player.dead) { return; } // Check collisions with traffic cars for (var i = trafficCars.length - 1; i >= 0; i--) { if (player.intersects(trafficCars[i])) { // Collision with traffic car LK.getSound('collision').play(); player.damage(20); // Remove car trafficCars[i].destroy(); trafficCars.splice(i, 1); } } // Check collisions with collectibles for (var i = collectibles.length - 1; i >= 0; i--) { if (player.intersects(collectibles[i])) { // Handle collectible based on type var collectible = collectibles[i]; if (collectible.type === 'coin') { score += 10; storage.coins++; LK.getSound('coinCollect').play(); } else if (collectible.type === 'nitro') { player.nitro = 100; LK.getSound('nitroSound').play(); } else if (collectible.type === 'repair') { player.repair(30); LK.getSound('repairCollect').play(); } // Remove collectible collectible.destroy(); collectibles.splice(i, 1); // Update UI updateUI(); } } } // Handle move events function handleMove(x, y, obj) { if (!gameStarted || player.dead) { return; } // Move player if (dragNode) { // Limit movement to road width var roadWidth = 800; var halfRoadWidth = roadWidth / 2; var roadCenterX = 2048 / 2; var minX = roadCenterX - halfRoadWidth + 50; var maxX = roadCenterX + halfRoadWidth - 50; dragNode.x = Math.max(minX, Math.min(maxX, x)); } } // Initialize the game initGame(); // Event handlers var dragNode = null; var lastTapTime = 0; game.down = function (x, y, obj) { // Double tap detection for nitro var currentTime = Date.now(); if (currentTime - lastTapTime < 300) { // Double tap detected player.useNitro(); } lastTapTime = currentTime; // Start game on tap if (!gameStarted) { startGame(); } // Set drag node to player dragNode = player; handleMove(x, y, obj); }; game.move = handleMove; game.up = function (x, y, obj) { dragNode = null; player.stopNitro(); }; // Game update game.update = function () { if (!gameStarted) { return; } // Update score based on time played (distance traveled) if (!player.dead) { score += 1; updateUI(); } // Spawn traffic cars and collectibles based on difficulty var spawnRate = Math.max(spawnRateBase - difficultyLevel * 5, 15); if (LK.ticks % spawnRate === 0) { spawnTrafficCar(); } if (LK.ticks % 180 === 0) { spawnCollectible(); } // Check for collisions checkCollisions(); };
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1", {
highScore: 0,
coins: 0
});
/****
* Classes
****/
var Collectible = Container.expand(function (type) {
var self = Container.call(this);
self.type = type || 'coin';
var collectibleGraphics = self.attachAsset(self.type, {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 10;
self.update = function () {
self.y += self.speed;
// Spin the collectible
collectibleGraphics.rotation += 0.05;
// Remove collectible when it goes off screen
if (self.y > 2732 + collectibleGraphics.height) {
self.destroy();
// Find and remove from collectibles array
var index = collectibles.indexOf(self);
if (index !== -1) {
collectibles.splice(index, 1);
}
}
};
return self;
});
var PlayerCar = Container.expand(function () {
var self = Container.call(this);
var carGraphics = self.attachAsset('car', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 15;
self.maxSpeed = 25;
self.health = 100;
self.nitro = 100;
self.usingNitro = false;
self.dead = false;
self.update = function () {
if (self.dead) {
return;
}
// Handle nitro usage
if (self.usingNitro && self.nitro > 0) {
self.nitro -= 1;
roadObject.setSpeed(self.maxSpeed);
} else {
self.usingNitro = false;
roadObject.setSpeed(self.speed);
}
// Regenerate nitro when not using
if (!self.usingNitro && self.nitro < 100) {
self.nitro += 0.1;
}
// Update UI
updateUI();
};
self.damage = function (amount) {
if (self.dead) {
return;
}
self.health -= amount;
// Flash red on damage
LK.effects.flashObject(self, 0xff0000, 500);
if (self.health <= 0) {
self.health = 0;
self.die();
}
// Update UI
updateUI();
};
self.repair = function (amount) {
if (self.dead) {
return;
}
self.health += amount;
if (self.health > 100) {
self.health = 100;
}
// Update UI
updateUI();
};
self.die = function () {
if (self.dead) {
return;
}
self.dead = true;
// Tint car dark
tween(carGraphics, {
alpha: 0.5
}, {
duration: 1000
});
// Game over
LK.setTimeout(function () {
if (score > storage.highScore) {
storage.highScore = score;
}
LK.showGameOver();
}, 1000);
};
self.useNitro = function () {
if (self.nitro > 0 && !self.usingNitro) {
self.usingNitro = true;
LK.getSound('nitroSound').play();
}
};
self.stopNitro = function () {
self.usingNitro = false;
};
return self;
});
var Road = Container.expand(function () {
var self = Container.call(this);
// Road background
var roadBg = self.attachAsset('road', {
anchorX: 0.5,
anchorY: 0,
y: 0
});
// Road lines
self.lines = [];
self.lineSpacing = 300;
self.lineSpeed = 15;
function createRoadLines() {
// Clear existing lines
for (var i = 0; i < self.lines.length; i++) {
self.lines[i].destroy();
}
self.lines = [];
// Create new lines for three lanes
var linesCount = Math.ceil(2732 / self.lineSpacing) + 1;
var laneOffsets = [-200, 0, 200]; // Offsets for three lanes
for (var i = 0; i < linesCount; i++) {
for (var j = 0; j < laneOffsets.length; j++) {
var line = self.attachAsset('roadLine', {
anchorX: 0.5,
anchorY: 0.5,
x: laneOffsets[j],
y: i * self.lineSpacing
});
self.lines.push(line);
}
}
// Add roadside assets to the edges of the road
var roadsideLeft = self.attachAsset('roadSide', {
anchorX: 1,
anchorY: 0,
x: -400,
// Position to the left of the road
y: 0
});
var roadsideRight = self.attachAsset('roadSide', {
anchorX: 0,
anchorY: 0,
x: 400,
// Position to the right of the road
y: 0
});
self.addChild(roadsideLeft);
self.addChild(roadsideRight);
// Add background to the sides of the road
var leftBackground = self.attachAsset('background', {
anchorX: 1,
anchorY: 0,
x: -600,
// Position further left
y: 0
});
var rightBackground = self.attachAsset('background', {
anchorX: 0,
anchorY: 0,
x: 600,
// Position further right
y: 0
});
self.addChild(leftBackground);
self.addChild(rightBackground);
}
createRoadLines();
self.update = function () {
// Update road lines
for (var i = 0; i < self.lines.length; i++) {
self.lines[i].y += self.lineSpeed;
// Reposition line if it goes out of view
if (self.lines[i].y > 2732) {
// Find the topmost line
var topLine = self.lines[0];
for (var j = 1; j < self.lines.length; j++) {
if (self.lines[j].y < topLine.y) {
topLine = self.lines[j];
}
}
// Position this line above the topmost line
self.lines[i].y = topLine.y - self.lineSpacing;
}
}
};
self.setSpeed = function (speed) {
self.lineSpeed = speed;
};
return self;
});
var StatusBar = Container.expand(function (type) {
var self = Container.call(this);
self.type = type || 'health';
var barColor = self.type === 'health' ? 0x2ecc71 : 0xf39c12;
// Background
var barBackground = self.attachAsset('barBg', {
anchorX: 0.5,
anchorY: 0.5
});
// Actual bar
var bar = self.attachAsset(self.type + 'Bar', {
anchorX: 0.5,
anchorY: 1,
// Bottom anchor
y: barBackground.height / 2 - 5 // Position at bottom of background with 5px padding
});
self.originalHeight = bar.height;
self.setValue = function (value) {
// Clamp value between 0 and 100
value = Math.max(0, Math.min(100, value));
// Set height based on percentage
bar.height = value / 100 * self.originalHeight;
};
return self;
});
var TrafficCar = Container.expand(function () {
var self = Container.call(this);
// Randomly choose different colors for traffic cars
var carAssets = ['trafficCarGreen', 'trafficCarYellow', 'trafficCarWhite'];
var randomAsset = carAssets[Math.floor(Math.random() * carAssets.length)];
var carGraphics = self.attachAsset(randomAsset, {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = Math.random() * 3 + 5; // Random speed between 5 and 8
self.update = function () {
self.y += self.speed;
// Remove car when it goes off screen
if (self.y > 2732 + carGraphics.height) {
self.destroy();
// Find and remove from trafficCars array
var index = trafficCars.indexOf(self);
if (index !== -1) {
trafficCars.splice(index, 1);
}
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x95a5a6 // Light gray background
});
/****
* Game Code
****/
// Game variables
// Game assets will be created by the engine based on usage in code
// Green car
// Yellow car
// White car
var roadObject;
var player;
var trafficCars = [];
var collectibles = [];
var score = 0;
var scoreText;
var healthBar;
var nitroBar;
var gameStarted = false;
var instructionsText;
var highScoreText;
var difficultyTimer;
var difficultyLevel = 1;
var spawnRateBase = 60;
// Initialize game elements
function initGame() {
// Create road
roadObject = new Road();
roadObject.x = 2048 / 2; // Center horizontally
game.addChild(roadObject);
// Create player
player = new PlayerCar();
player.x = 2048 / 2;
player.y = 2732 - 300; // Position near bottom
game.addChild(player);
// Initialize score
score = 0;
// Create score text
scoreText = new Text2(score.toString(), {
size: 100,
fill: 0xFFFFFF
});
scoreText.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreText);
// Create high score text
highScoreText = new Text2("Best: " + storage.highScore, {
size: 50,
fill: 0xFFFFFF
});
highScoreText.anchor.set(0.5, 0);
highScoreText.y = 110;
LK.gui.top.addChild(highScoreText);
// Create instructions text
instructionsText = new Text2("Tap to start\nDrag to move your car\nDouble tap for nitro", {
size: 80,
fill: 0xFFFFFF
});
instructionsText.anchor.set(0.5, 0.5);
LK.gui.center.addChild(instructionsText);
// Create health bar
healthBar = new StatusBar('health');
healthBar.x = 80;
healthBar.y = 2732 / 2;
game.addChild(healthBar);
// Create nitro bar
nitroBar = new StatusBar('nitro');
nitroBar.x = 2048 - 80;
nitroBar.y = 2732 / 2;
game.addChild(nitroBar);
// Set initial UI values
updateUI();
// Play background music
LK.playMusic('backgroundMusic', {
fade: {
start: 0,
end: 0.3,
duration: 1000
}
});
// Start engine sound (looping)
LK.getSound('carEngine').play();
}
// Update UI elements
function updateUI() {
// Update score text
scoreText.setText(score.toString());
// Update health bar
healthBar.setValue(player.health);
// Update nitro bar
nitroBar.setValue(player.nitro);
}
// Spawn traffic car
function spawnTrafficCar() {
var car = new TrafficCar();
var roadWidth = 800;
var positionValid = false;
var attempts = 0;
while (!positionValid && attempts < 10) {
var laneOffsets = [-200, 0, 200]; // Offsets for three lanes
var randomLane = laneOffsets[Math.floor(Math.random() * laneOffsets.length)];
car.x = 2048 / 2 + randomLane;
car.y = -car.height;
positionValid = true;
for (var i = 0; i < trafficCars.length; i++) {
// Check for overlap and ensure a minimum distance between cars
if (car.intersects(trafficCars[i]) || Math.abs(car.x - trafficCars[i].x) < 120) {
positionValid = false;
break;
}
}
attempts++;
}
if (positionValid) {
game.addChild(car);
trafficCars.push(car);
}
}
// Spawn collectible
function spawnCollectible() {
// Determine type of collectible
var type = Math.random() < 0.7 ? 'coin' : Math.random() < 0.5 ? 'nitro' : 'repair';
var collectible = new Collectible(type);
// Position collectible randomly on the road
var roadWidth = 800;
var laneOffsets = [-200, 0, 200]; // Offsets for three lanes
var randomLane = laneOffsets[Math.floor(Math.random() * laneOffsets.length)];
collectible.x = 2048 / 2 + randomLane;
collectible.y = -collectible.height;
game.addChild(collectible);
collectibles.push(collectible);
}
// Start the game
function startGame() {
if (gameStarted) {
return;
}
gameStarted = true;
// Hide instructions
tween(instructionsText, {
alpha: 0
}, {
duration: 500
});
// Start increasing difficulty over time
difficultyTimer = LK.setInterval(function () {
difficultyLevel++;
// Increase player speed
player.speed = Math.min(player.speed + 1, player.maxSpeed);
// Increase player max speed with nitro
player.maxSpeed = Math.min(player.maxSpeed + 1, 35);
// Update road speed
roadObject.setSpeed(player.speed);
}, 10000); // Increase difficulty every 10 seconds
}
// Check for collisions
function checkCollisions() {
if (!gameStarted || player.dead) {
return;
}
// Check collisions with traffic cars
for (var i = trafficCars.length - 1; i >= 0; i--) {
if (player.intersects(trafficCars[i])) {
// Collision with traffic car
LK.getSound('collision').play();
player.damage(20);
// Remove car
trafficCars[i].destroy();
trafficCars.splice(i, 1);
}
}
// Check collisions with collectibles
for (var i = collectibles.length - 1; i >= 0; i--) {
if (player.intersects(collectibles[i])) {
// Handle collectible based on type
var collectible = collectibles[i];
if (collectible.type === 'coin') {
score += 10;
storage.coins++;
LK.getSound('coinCollect').play();
} else if (collectible.type === 'nitro') {
player.nitro = 100;
LK.getSound('nitroSound').play();
} else if (collectible.type === 'repair') {
player.repair(30);
LK.getSound('repairCollect').play();
}
// Remove collectible
collectible.destroy();
collectibles.splice(i, 1);
// Update UI
updateUI();
}
}
}
// Handle move events
function handleMove(x, y, obj) {
if (!gameStarted || player.dead) {
return;
}
// Move player
if (dragNode) {
// Limit movement to road width
var roadWidth = 800;
var halfRoadWidth = roadWidth / 2;
var roadCenterX = 2048 / 2;
var minX = roadCenterX - halfRoadWidth + 50;
var maxX = roadCenterX + halfRoadWidth - 50;
dragNode.x = Math.max(minX, Math.min(maxX, x));
}
}
// Initialize the game
initGame();
// Event handlers
var dragNode = null;
var lastTapTime = 0;
game.down = function (x, y, obj) {
// Double tap detection for nitro
var currentTime = Date.now();
if (currentTime - lastTapTime < 300) {
// Double tap detected
player.useNitro();
}
lastTapTime = currentTime;
// Start game on tap
if (!gameStarted) {
startGame();
}
// Set drag node to player
dragNode = player;
handleMove(x, y, obj);
};
game.move = handleMove;
game.up = function (x, y, obj) {
dragNode = null;
player.stopNitro();
};
// Game update
game.update = function () {
if (!gameStarted) {
return;
}
// Update score based on time played (distance traveled)
if (!player.dead) {
score += 1;
updateUI();
}
// Spawn traffic cars and collectibles based on difficulty
var spawnRate = Math.max(spawnRateBase - difficultyLevel * 5, 15);
if (LK.ticks % spawnRate === 0) {
spawnTrafficCar();
}
if (LK.ticks % 180 === 0) {
spawnCollectible();
}
// Check for collisions
checkCollisions();
};
top down view of arcade racing car with the yellow color. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
top down view of white racing car. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
top down view of green color racing car. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
I need a 2D Nitro Boost asset for my street racing game on the UPIT FRVR platform. Please provide: A Nitro item/power-up icon (e.g., a glowing canister, fuel bottle, or energy orb) An optional nitro flame trail effect (to show speed burst behind the car when nitro is activated) Asset Requirements: Bright, high-energy colors (like blue, orange, or electric white) Should look exciting and clearly indicate a speed power-up Sized appropriately to place on the road for pickup or to attach behind the car when used Style should match a fun and fast-paced 2D racing game. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
I need a 2D coin asset for my street racing game on the UPIT FRVR platform. Please provide: A collectible coin with a shiny, gold appearance Optional details: glow, sparkle, or animation frame for spinning It should be easily visible on the road, with good contrast on desert backgrounds Scalable and loopable for pickup patterns Style: cartoony or arcade-friendly, matching fast-paced racing gameplay. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
black color top down view racing car. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
A 2D bar-style background asset with a sleek frame or container design to display nitro, health, or score bars in a street racing game HUD.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows