User prompt
la carretera de fondo sera infinita
User prompt
un menu de inicio con un boton en medio para empezar a jugar con un carro acelerando de fondo ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
el sonido de encendido sonara en el momento en el que se empiece a jugar.
User prompt
un maximo de 7 carros en la pantalla
User prompt
que haya mayor posibilidad de que aparezcan potenciadores
User prompt
poco a poco vayan apareciendo mayor cantidad de vehiculoshaya mayor posibilidad de que aparezca
User prompt
menor cantidad de obstaculos el potenciador esta quieto y al momento de tocar el potenciador tengo una mayor velocidad
User prompt
al tocar el objeto inmediatamente tendre una invencibilidad de 10 segundos
User prompt
el objeto especial es de color amarillo
User prompt
mayor cantidad de obstaculos probabilidad de aparecer un objeto especial que te hara inmortal por 5 segundos ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
menor cantidad de obstaculos tengo 2 vidas y me siguen muchos enemigos
Code edit (1 edits merged)
Please save this source code
User prompt
Speed Runner
Initial prompt
un juego de carreras en el que esquivo obstaculos
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Obstacle = Container.expand(function () { var self = Container.call(this); var obstacleGraphics = self.attachAsset('obstacle', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 8; self.update = function () { self.y += self.speed + gameSpeed; }; return self; }); var PowerUp = Container.expand(function () { var self = Container.call(this); var powerupGraphics = self.attachAsset('powerup', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 8; self.update = function () { // Power-up stays stationary, only rotate for visual effect powerupGraphics.rotation += 0.1; }; return self; }); var TrackLine = Container.expand(function () { var self = Container.call(this); var lineGraphics = self.attachAsset('trackLine', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { self.y += gameSpeed; }; return self; }); var Vehicle = Container.expand(function () { var self = Container.call(this); var vehicleGraphics = self.attachAsset('vehicle', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 0; self.targetX = 0; self.update = function () { // Smooth movement toward target position var dx = self.targetX - self.x; if (Math.abs(dx) > 2) { self.x += dx * 0.15; } else { self.x = self.targetX; } // Keep vehicle within bounds var halfWidth = vehicleGraphics.width / 2; if (self.x - halfWidth < 200) { self.x = 200 + halfWidth; self.targetX = self.x; } if (self.x + halfWidth > 1848) { self.x = 1848 - halfWidth; self.targetX = self.x; } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x2c3e50 }); /**** * Game Code ****/ var gameSpeed = 5; var maxSpeed = 20; var speedIncrement = 0.01; var distanceTraveled = 0; var obstacles = []; var trackLines = []; var powerups = []; var vehicle = null; var dragNode = null; var gameRunning = true; var lives = 2; var maxLives = 2; var speedBoostActive = false; var speedBoostEndTime = 0; var originalSpeed = 5; // Create score display var scoreTxt = new Text2('0', { size: 100, fill: 0xFFFFFF }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // Create speed display var speedTxt = new Text2('Speed: 5', { size: 60, fill: 0xFFFFFF }); speedTxt.anchor.set(0, 0); speedTxt.x = 50; speedTxt.y = 50; LK.gui.topLeft.addChild(speedTxt); // Create lives display var livesTxt = new Text2('Lives: 2', { size: 60, fill: 0xFFFFFF }); livesTxt.anchor.set(1, 0); livesTxt.x = 1998; livesTxt.y = 50; LK.gui.topRight.addChild(livesTxt); // Create vehicle vehicle = game.addChild(new Vehicle()); vehicle.x = 1024; vehicle.y = 2400; vehicle.targetX = vehicle.x; // Create initial track lines function createTrackLines() { // Left boundary line for (var i = 0; i < 20; i++) { var leftLine = new TrackLine(); leftLine.x = 200; leftLine.y = i * 300 - 600; trackLines.push(leftLine); game.addChild(leftLine); } // Right boundary line for (var i = 0; i < 20; i++) { var rightLine = new TrackLine(); rightLine.x = 1848; rightLine.y = i * 300 - 600; trackLines.push(rightLine); game.addChild(rightLine); } // Center dashed line for (var i = 0; i < 30; i++) { var centerLine = new TrackLine(); centerLine.x = 1024; centerLine.y = i * 200 - 600; trackLines.push(centerLine); game.addChild(centerLine); } } createTrackLines(); // Spawn obstacles function spawnObstacle() { if (!gameRunning) return; var obstacle = new Obstacle(); // Random position within track bounds obstacle.x = 300 + Math.random() * 1448; obstacle.y = -100; obstacles.push(obstacle); game.addChild(obstacle); } // Update and clean up power-ups for (var i = powerups.length - 1; i >= 0; i--) { var powerup = powerups[i]; // Check if power-up went off screen if (powerup.y > 2800) { powerup.destroy(); powerups.splice(i, 1); continue; } // Check collision with vehicle if (powerup.intersects(vehicle)) { // Activate speed boost speedBoostActive = true; speedBoostEndTime = LK.ticks + 600; // 10 seconds at 60 FPS originalSpeed = gameSpeed; gameSpeed = Math.min(gameSpeed + 10, maxSpeed); // Increase speed by 10 LK.getSound('powerup').play(); // Flash screen gold LK.effects.flashScreen(0xffd700, 500); // Animate vehicle with golden tint and pulsing effect tween(vehicle, { tint: 0xffd700 }, { duration: 200 }); // Remove the power-up powerup.destroy(); powerups.splice(i, 1); continue; } } // Update and clean up track lines function spawnPowerUp() { if (!gameRunning) return; var powerup = new PowerUp(); // Random position within track bounds powerup.x = 300 + Math.random() * 1448; powerup.y = -100; powerups.push(powerup); game.addChild(powerup); } // Handle touch input function handleMove(x, y, obj) { if (!gameRunning) return; if (dragNode) { // Convert touch position to vehicle target position vehicle.targetX = x; } } game.move = handleMove; game.down = function (x, y, obj) { if (!gameRunning) return; dragNode = vehicle; handleMove(x, y, obj); }; game.up = function (x, y, obj) { dragNode = null; }; // Main game loop game.update = function () { if (!gameRunning) return; // Increase speed over time if (gameSpeed < maxSpeed) { gameSpeed += speedIncrement; } // Update distance traveled distanceTraveled += gameSpeed; // Update score based on distance var score = Math.floor(distanceTraveled / 10); LK.setScore(score); scoreTxt.setText(score); speedTxt.setText('Speed: ' + Math.floor(gameSpeed)); // Check if speed boost expired if (speedBoostActive && LK.ticks > speedBoostEndTime) { speedBoostActive = false; // Restore normal speed (but keep natural progression) gameSpeed = Math.max(originalSpeed, 5 + distanceTraveled / 10000 * speedIncrement); // Stop tween and restore normal vehicle color tween.stop(vehicle); vehicle.tint = 0xffffff; } // Progressive obstacle spawning - gradually increase frequency and probability var baseSpawnRate = Math.max(70 - Math.floor(gameSpeed * 2), 30); // Faster spawn rate var progressMultiplier = Math.min(1 + distanceTraveled / 5000, 3); // Up to 3x more likely over time var spawnProbability = Math.min(0.3 + distanceTraveled / 8000, 0.8); // Start at 30%, increase to 80% if (LK.ticks % baseSpawnRate === 0) { // Multiple obstacle spawning based on progress var numObstacles = Math.floor(progressMultiplier); for (var spawns = 0; spawns < numObstacles; spawns++) { if (Math.random() < spawnProbability) { spawnObstacle(); } } } // Spawn power-ups occasionally (5% chance when spawning obstacles) if (LK.ticks % Math.max(60 - Math.floor(gameSpeed), 30) === 0 && Math.random() < 0.05) { spawnPowerUp(); } // Update and clean up obstacles for (var i = obstacles.length - 1; i >= 0; i--) { var obstacle = obstacles[i]; // Check if obstacle went off screen if (obstacle.y > 2800) { obstacle.destroy(); obstacles.splice(i, 1); continue; } // Check collision with vehicle if (obstacle.intersects(vehicle)) { lives--; livesTxt.setText('Lives: ' + lives); LK.getSound('crash').play(); // Flash screen red LK.effects.flashScreen(0xff0000, 500); // Remove the obstacle that was hit obstacle.destroy(); obstacles.splice(i, 1); // Check if game over if (lives <= 0) { gameRunning = false; LK.setTimeout(function () { LK.showGameOver(); }, 500); return; } continue; } } // Update and clean up track lines for (var i = trackLines.length - 1; i >= 0; i--) { var line = trackLines[i]; // Respawn track lines that went off screen if (line.y > 2800) { line.y = -200; } } };
===================================================================
--- original.js
+++ change.js
@@ -245,11 +245,20 @@
// Stop tween and restore normal vehicle color
tween.stop(vehicle);
vehicle.tint = 0xffffff;
}
- // Spawn obstacles less frequently
- if (LK.ticks % Math.max(90 - Math.floor(gameSpeed), 60) === 0) {
- spawnObstacle();
+ // Progressive obstacle spawning - gradually increase frequency and probability
+ var baseSpawnRate = Math.max(70 - Math.floor(gameSpeed * 2), 30); // Faster spawn rate
+ var progressMultiplier = Math.min(1 + distanceTraveled / 5000, 3); // Up to 3x more likely over time
+ var spawnProbability = Math.min(0.3 + distanceTraveled / 8000, 0.8); // Start at 30%, increase to 80%
+ if (LK.ticks % baseSpawnRate === 0) {
+ // Multiple obstacle spawning based on progress
+ var numObstacles = Math.floor(progressMultiplier);
+ for (var spawns = 0; spawns < numObstacles; spawns++) {
+ if (Math.random() < spawnProbability) {
+ spawnObstacle();
+ }
+ }
}
// Spawn power-ups occasionally (5% chance when spawning obstacles)
if (LK.ticks % Math.max(60 - Math.floor(gameSpeed), 30) === 0 && Math.random() < 0.05) {
spawnPowerUp();
un propulsor turbo de carreras que expulse fuego con perspectiva hacia arriba In-Game asset. 2d. High contrast. No shadows
carretera oscura con perspectiva desde arriba. In-Game asset. 2d. High contrast. No shadows
carro azul deportivo con la perspectiva hacia arriba. In-Game asset. 2d. High contrast. No shadows hecho con pixeles acelerando con perspectiva trasera sin el rastro
un carro rojo deportivo con la perspectiva hacia arriba. In-Game asset. 2d. High contrast. No shadows hecho con pixeles
tres corazones hechos con pixeles. In-Game asset. 2d. High contrast. No shadows
un coche blanco deportivo hecho con pixeles con perspectiva desde arriba de la parte trasera. In-Game asset. 2d. High contrast. No shadows
tira de puas hecho con pixeles. In-Game asset. 2d. High contrast. No shadows
boton rojo hecho con pixeles con la palabra play en medio In-Game asset. 2d. High contrast. No shadows
un auto verde deportivo con perspectiva desde arriba hecho con pixeles. In-Game asset. 2d. High contrast. No shadows con perspectiva trasera
un auto amarillo deportivo con perspectiva desde arriba hecho con pixeles. In-Game asset. 2d. High contrast. No shadows con perspectiva trasera
un auto negro deportivo hecho con pixeles con la perspectiva desde arriba y trasera. In-Game asset. 2d. High contrast. No shadows
agujero de la calle hecho con pixeles. In-Game asset. 2d. High contrast. No shadows
un barril derramando petroleo negro hecho con pixeles In-Game asset. 2d. High contrast. No shadows
coche de policia hecho con pixeles con perspectiva desde arriba In-Game asset. 2d. High contrast. No shadows
motociclista de chaqueta negra hecha con pixeles con perspectiva desde arriba y trasera. In-Game asset. 2d. High contrast. No shadows
auto celeste deportivo con perspectiva desde arriba y trasera hecho con pixeles. In-Game asset. 2d. High contrast. No shadows
letras que dicen speed runner las letras speed tienen un color blanco con contorno negro y las letras runner un color celeste con un contorno azul todo hecho con pixeles y con una cursiva. In-Game asset. 2d. High contrast. No shadows