User prompt
el piso es continuo y el enemigo solo avanza hacia el jugador
User prompt
el piso esta completo y no hay vacio
User prompt
ahora agrega otro personaje
User prompt
el color del personaje es el original
User prompt
elimina la seleccion de personajes y agrega otro personaje nuevo que se pueda eligir en el menu de inicio
User prompt
elimina los personajes de otros colores
User prompt
otros personajes diferentes
User prompt
doble salto
User prompt
el boton de salto esta visible en todo momento
User prompt
boton de salto que si lo presionas dos veces haces un doble salto
User prompt
tienes un doble salto y bloques que al romperlos te dan un potenciador que te hace invencible por 10 segundos genera obstaculos que sean posibles de pasar para el jugador ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
elimina los muros mas velocidad al saltar
User prompt
la pared solo se puede pisar cuando estas encima de el
User prompt
muros que se pueden pisar menor cantidad de obtaculos se gana el juego a los 10000 metros
Code edit (1 edits merged)
Please save this source code
User prompt
Runner Jump: Endless Adventure
Initial prompt
un juego de correr y saltar obstaculos hoyos enemigos y con un menu de inicio en el que puedes personalizar tu personaje
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var BreakableBlock = Container.expand(function () { var self = Container.call(this); var blockGraphics = self.attachAsset('breakableBlock', { anchorX: 0.5, anchorY: 1.0 }); self.speed = -8; self.update = function () { self.x += self.speed; }; return self; }); var Enemy = Container.expand(function () { var self = Container.call(this); var enemyGraphics = self.attachAsset('enemy', { anchorX: 0.5, anchorY: 1.0 }); self.speed = -8; self.moveSpeed = 2; self.direction = 1; self.baseY = 0; self.update = function () { self.x += self.speed; self.y += self.direction * self.moveSpeed; if (self.y < self.baseY - 40) { self.direction = 1; } else if (self.y > self.baseY + 20) { self.direction = -1; } }; return self; }); var GroundSegment = Container.expand(function () { var self = Container.call(this); var groundGraphics = self.attachAsset('ground', { anchorX: 0, anchorY: 0 }); self.speed = -8; self.update = function () { self.x += self.speed; }; return self; }); var Hole = Container.expand(function () { var self = Container.call(this); var holeGraphics = self.attachAsset('hole', { anchorX: 0, anchorY: 0 }); self.speed = -8; self.update = function () { self.x += self.speed; }; return self; }); var Obstacle = Container.expand(function () { var self = Container.call(this); var obstacleGraphics = self.attachAsset('obstacle', { anchorX: 0.5, anchorY: 1.0 }); self.speed = -8; self.update = function () { self.x += self.speed; }; 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.jumpSpeed = 0; self.gravity = 0.8; self.jumpPower = -18; self.groundY = 0; self.customColor = 0x4CAF50; self.jumpsLeft = 0; self.maxJumps = 2; self.isInvincible = false; self.invincibilityTimer = 0; self.jump = function () { if (self.jumpsLeft > 0) { self.isJumping = true; self.jumpSpeed = self.jumpPower; self.jumpsLeft--; LK.getSound('jump').play(); } }; self.setColor = function (color) { self.customColor = color; playerGraphics.tint = color; }; self.activatePowerUp = function () { self.isInvincible = true; self.invincibilityTimer = 600; // 10 seconds at 60fps playerGraphics.tint = 0xFFFFFF; tween(playerGraphics, { alpha: 0.5 }, { duration: 200, easing: tween.easeInOut }); }; self.update = function () { if (self.isJumping) { self.jumpSpeed += self.gravity; self.y += self.jumpSpeed; var landingY = self.groundY; if (self.y >= landingY) { self.y = landingY; self.isJumping = false; self.jumpSpeed = 0; self.jumpsLeft = self.maxJumps; } } // Handle invincibility if (self.isInvincible) { self.invincibilityTimer--; if (self.invincibilityTimer <= 0) { self.isInvincible = false; playerGraphics.tint = self.customColor; playerGraphics.alpha = 1.0; } } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87CEEB }); /**** * Game Code ****/ var gameState = 'customization'; // 'customization', 'playing', 'gameOver' var player; var groundSegments = []; var holes = []; var enemies = []; var obstacles = []; var breakableBlocks = []; var gameSpeed = 8; var spawnTimer = 0; var distance = 0; var groundY = 2400; // UI Elements var customizeText = new Text2('Customize Your Character', { size: 60, fill: 0xFFFFFF }); customizeText.anchor.set(0.5, 0.5); customizeText.x = 1024; customizeText.y = 800; var startText = new Text2('Tap to Start!', { size: 50, fill: 0xFFFFFF }); startText.anchor.set(0.5, 0.5); startText.x = 1024; startText.y = 1200; var distanceText = new Text2('0m', { size: 60, fill: 0xFFFFFF }); distanceText.anchor.set(0.5, 0); LK.gui.top.addChild(distanceText); var invincibilityText = new Text2('INVINCIBLE!', { size: 40, fill: 0xFFD700 }); invincibilityText.anchor.set(0.5, 0); invincibilityText.x = 1024; invincibilityText.y = 200; invincibilityText.visible = false; LK.gui.addChild(invincibilityText); // Color options for customization var colorOptions = [0x4CAF50, 0xFF5722, 0x2196F3, 0xFF9800, 0x9C27B0, 0xF44336]; var currentColorIndex = 0; var colorButtons = []; // Create color selection buttons for (var i = 0; i < colorOptions.length; i++) { var colorButton = LK.getAsset('player', { anchorX: 0.5, anchorY: 0.5, scaleX: 0.8, scaleY: 0.8 }); colorButton.tint = colorOptions[i]; colorButton.x = 400 + i * 200; colorButton.y = 1000; colorButton.colorIndex = i; colorButtons.push(colorButton); game.addChild(colorButton); } // Initialize player player = new Player(); player.x = 400; player.y = groundY; player.groundY = groundY; game.addChild(player); // Initialize ground segments for (var i = 0; i < 15; i++) { var ground = new GroundSegment(); ground.x = i * 200; ground.y = groundY; groundSegments.push(ground); game.addChild(ground); } function initializeGame() { gameState = 'playing'; distance = 0; gameSpeed = 8; spawnTimer = 0; // Hide customization UI customizeText.visible = false; startText.visible = false; for (var i = 0; i < colorButtons.length; i++) { colorButtons[i].visible = false; } // Clear existing obstacles clearAllObstacles(); // Reset player position player.x = 400; player.y = groundY; player.isJumping = false; player.jumpSpeed = 0; // Reset ground segments for (var i = 0; i < groundSegments.length; i++) { groundSegments[i].x = i * 200; groundSegments[i].speed = -gameSpeed; } } function clearAllObstacles() { for (var i = holes.length - 1; i >= 0; i--) { holes[i].destroy(); holes.splice(i, 1); } for (var i = enemies.length - 1; i >= 0; i--) { enemies[i].destroy(); enemies.splice(i, 1); } for (var i = obstacles.length - 1; i >= 0; i--) { obstacles[i].destroy(); obstacles.splice(i, 1); } for (var i = breakableBlocks.length - 1; i >= 0; i--) { breakableBlocks[i].destroy(); breakableBlocks.splice(i, 1); } } function spawnObstacle() { var rand = Math.random(); var spawnX = 2200; if (rand < 0.2) { // Spawn hole with jump possibility var hole = new Hole(); hole.x = spawnX; hole.y = groundY; hole.speed = -gameSpeed; holes.push(hole); game.addChild(hole); } else if (rand < 0.35) { // Spawn enemy at reachable height var enemy = new Enemy(); enemy.x = spawnX; enemy.y = groundY - 100; enemy.baseY = groundY - 100; enemy.speed = -gameSpeed; enemies.push(enemy); game.addChild(enemy); } else if (rand < 0.5) { // Spawn obstacle at jumpable height var obstacle = new Obstacle(); obstacle.x = spawnX; obstacle.y = groundY - 80; obstacle.speed = -gameSpeed; obstacles.push(obstacle); game.addChild(obstacle); } else if (rand < 0.7) { // Spawn breakable block var block = new BreakableBlock(); block.x = spawnX; block.y = groundY - 60; block.speed = -gameSpeed; breakableBlocks.push(block); game.addChild(block); } } function checkCollisions() { // Check hole collisions for (var i = 0; i < holes.length; i++) { var hole = holes[i]; if (player.x > hole.x && player.x < hole.x + 150 && !player.isJumping && !player.isInvincible) { gameOver(); return; } } // Check enemy collisions for (var i = 0; i < enemies.length; i++) { var enemy = enemies[i]; if (player.intersects(enemy) && !player.isInvincible) { gameOver(); return; } } // Check obstacle collisions for (var i = 0; i < obstacles.length; i++) { var obstacle = obstacles[i]; if (player.intersects(obstacle) && !player.isInvincible) { gameOver(); return; } } // Check breakable block collisions for (var i = breakableBlocks.length - 1; i >= 0; i--) { var block = breakableBlocks[i]; if (player.intersects(block)) { // Break block and activate power-up player.activatePowerUp(); LK.getSound('powerup').play(); block.destroy(); breakableBlocks.splice(i, 1); break; } } } function gameOver() { gameState = 'gameOver'; LK.getSound('hit').play(); LK.showGameOver(); } function updateSpeed() { gameSpeed = 8 + distance / 100; for (var i = 0; i < groundSegments.length; i++) { groundSegments[i].speed = -gameSpeed; } for (var i = 0; i < holes.length; i++) { holes[i].speed = -gameSpeed; } for (var i = 0; i < enemies.length; i++) { enemies[i].speed = -gameSpeed; } for (var i = 0; i < obstacles.length; i++) { obstacles[i].speed = -gameSpeed; } for (var i = 0; i < breakableBlocks.length; i++) { breakableBlocks[i].speed = -gameSpeed; } } game.down = function (x, y, obj) { if (gameState === 'customization') { // Check color button clicks for (var i = 0; i < colorButtons.length; i++) { var button = colorButtons[i]; var buttonBounds = { left: button.x - 40, right: button.x + 40, top: button.y - 40, bottom: button.y + 40 }; if (x >= buttonBounds.left && x <= buttonBounds.right && y >= buttonBounds.top && y <= buttonBounds.bottom) { currentColorIndex = button.colorIndex; player.setColor(colorOptions[currentColorIndex]); return; } } // Check start button if (y > 1100 && y < 1300) { initializeGame(); } } else if (gameState === 'playing') { player.jump(); } }; game.update = function () { if (gameState === 'playing') { distance += gameSpeed / 10; distanceText.setText(Math.floor(distance) + 'm'); // Update speed based on distance updateSpeed(); // Spawn obstacles spawnTimer++; if (spawnTimer >= 120 - Math.min(distance / 15, 50)) { spawnObstacle(); spawnTimer = 0; } // Update ground segments for (var i = 0; i < groundSegments.length; i++) { var ground = groundSegments[i]; if (ground.x < -200) { ground.x = (groundSegments.length - 1) * 200; } } // Update and clean up holes for (var i = holes.length - 1; i >= 0; i--) { var hole = holes[i]; if (hole.x < -200) { hole.destroy(); holes.splice(i, 1); } } // Update and clean up enemies for (var i = enemies.length - 1; i >= 0; i--) { var enemy = enemies[i]; if (enemy.x < -100) { enemy.destroy(); enemies.splice(i, 1); } } // Update and clean up obstacles for (var i = obstacles.length - 1; i >= 0; i--) { var obstacle = obstacles[i]; if (obstacle.x < -100) { obstacle.destroy(); obstacles.splice(i, 1); } } // Update and clean up breakable blocks for (var i = breakableBlocks.length - 1; i >= 0; i--) { var block = breakableBlocks[i]; if (block.x < -100) { block.destroy(); breakableBlocks.splice(i, 1); } } // Update invincibility UI invincibilityText.visible = player.isInvincible; if (player.isInvincible) { invincibilityText.setText('INVINCIBLE! ' + Math.ceil(player.invincibilityTimer / 60) + 's'); } // Check collisions checkCollisions(); // Update score LK.setScore(Math.floor(distance)); // Check win condition if (distance >= 10000) { gameState = 'won'; LK.showYouWin(); return; } } }; // Show customization UI initially game.addChild(customizeText); game.addChild(startText);
===================================================================
--- original.js
+++ change.js
@@ -6,8 +6,20 @@
/****
* Classes
****/
+var BreakableBlock = Container.expand(function () {
+ var self = Container.call(this);
+ var blockGraphics = self.attachAsset('breakableBlock', {
+ anchorX: 0.5,
+ anchorY: 1.0
+ });
+ self.speed = -8;
+ self.update = function () {
+ self.x += self.speed;
+ };
+ return self;
+});
var Enemy = Container.expand(function () {
var self = Container.call(this);
var enemyGraphics = self.attachAsset('enemy', {
anchorX: 0.5,
@@ -72,22 +84,38 @@
});
self.isJumping = false;
self.jumpSpeed = 0;
self.gravity = 0.8;
- self.jumpPower = -25;
+ self.jumpPower = -18;
self.groundY = 0;
self.customColor = 0x4CAF50;
+ self.jumpsLeft = 0;
+ self.maxJumps = 2;
+ self.isInvincible = false;
+ self.invincibilityTimer = 0;
self.jump = function () {
- if (!self.isJumping) {
+ if (self.jumpsLeft > 0) {
self.isJumping = true;
self.jumpSpeed = self.jumpPower;
+ self.jumpsLeft--;
LK.getSound('jump').play();
}
};
self.setColor = function (color) {
self.customColor = color;
playerGraphics.tint = color;
};
+ self.activatePowerUp = function () {
+ self.isInvincible = true;
+ self.invincibilityTimer = 600; // 10 seconds at 60fps
+ playerGraphics.tint = 0xFFFFFF;
+ tween(playerGraphics, {
+ alpha: 0.5
+ }, {
+ duration: 200,
+ easing: tween.easeInOut
+ });
+ };
self.update = function () {
if (self.isJumping) {
self.jumpSpeed += self.gravity;
self.y += self.jumpSpeed;
@@ -95,10 +123,20 @@
if (self.y >= landingY) {
self.y = landingY;
self.isJumping = false;
self.jumpSpeed = 0;
+ self.jumpsLeft = self.maxJumps;
}
}
+ // Handle invincibility
+ if (self.isInvincible) {
+ self.invincibilityTimer--;
+ if (self.invincibilityTimer <= 0) {
+ self.isInvincible = false;
+ playerGraphics.tint = self.customColor;
+ playerGraphics.alpha = 1.0;
+ }
+ }
};
return self;
});
@@ -117,8 +155,9 @@
var groundSegments = [];
var holes = [];
var enemies = [];
var obstacles = [];
+var breakableBlocks = [];
var gameSpeed = 8;
var spawnTimer = 0;
var distance = 0;
var groundY = 2400;
@@ -142,8 +181,17 @@
fill: 0xFFFFFF
});
distanceText.anchor.set(0.5, 0);
LK.gui.top.addChild(distanceText);
+var invincibilityText = new Text2('INVINCIBLE!', {
+ size: 40,
+ fill: 0xFFD700
+});
+invincibilityText.anchor.set(0.5, 0);
+invincibilityText.x = 1024;
+invincibilityText.y = 200;
+invincibilityText.visible = false;
+LK.gui.addChild(invincibilityText);
// Color options for customization
var colorOptions = [0x4CAF50, 0xFF5722, 0x2196F3, 0xFF9800, 0x9C27B0, 0xF44336];
var currentColorIndex = 0;
var colorButtons = [];
@@ -212,64 +260,88 @@
for (var i = obstacles.length - 1; i >= 0; i--) {
obstacles[i].destroy();
obstacles.splice(i, 1);
}
+ for (var i = breakableBlocks.length - 1; i >= 0; i--) {
+ breakableBlocks[i].destroy();
+ breakableBlocks.splice(i, 1);
+ }
}
function spawnObstacle() {
var rand = Math.random();
var spawnX = 2200;
- if (rand < 0.25) {
- // Spawn hole
+ if (rand < 0.2) {
+ // Spawn hole with jump possibility
var hole = new Hole();
hole.x = spawnX;
hole.y = groundY;
hole.speed = -gameSpeed;
holes.push(hole);
game.addChild(hole);
- } else if (rand < 0.45) {
- // Spawn enemy
+ } else if (rand < 0.35) {
+ // Spawn enemy at reachable height
var enemy = new Enemy();
enemy.x = spawnX;
- enemy.y = groundY;
- enemy.baseY = groundY;
+ enemy.y = groundY - 100;
+ enemy.baseY = groundY - 100;
enemy.speed = -gameSpeed;
enemies.push(enemy);
game.addChild(enemy);
- } else if (rand < 0.6) {
- // Spawn obstacle
+ } else if (rand < 0.5) {
+ // Spawn obstacle at jumpable height
var obstacle = new Obstacle();
obstacle.x = spawnX;
- obstacle.y = groundY;
+ obstacle.y = groundY - 80;
obstacle.speed = -gameSpeed;
obstacles.push(obstacle);
game.addChild(obstacle);
+ } else if (rand < 0.7) {
+ // Spawn breakable block
+ var block = new BreakableBlock();
+ block.x = spawnX;
+ block.y = groundY - 60;
+ block.speed = -gameSpeed;
+ breakableBlocks.push(block);
+ game.addChild(block);
}
}
function checkCollisions() {
// Check hole collisions
for (var i = 0; i < holes.length; i++) {
var hole = holes[i];
- if (player.x > hole.x && player.x < hole.x + 150 && !player.isJumping) {
+ if (player.x > hole.x && player.x < hole.x + 150 && !player.isJumping && !player.isInvincible) {
gameOver();
return;
}
}
// Check enemy collisions
for (var i = 0; i < enemies.length; i++) {
var enemy = enemies[i];
- if (player.intersects(enemy)) {
+ if (player.intersects(enemy) && !player.isInvincible) {
gameOver();
return;
}
}
// Check obstacle collisions
for (var i = 0; i < obstacles.length; i++) {
var obstacle = obstacles[i];
- if (player.intersects(obstacle)) {
+ if (player.intersects(obstacle) && !player.isInvincible) {
gameOver();
return;
}
}
+ // Check breakable block collisions
+ for (var i = breakableBlocks.length - 1; i >= 0; i--) {
+ var block = breakableBlocks[i];
+ if (player.intersects(block)) {
+ // Break block and activate power-up
+ player.activatePowerUp();
+ LK.getSound('powerup').play();
+ block.destroy();
+ breakableBlocks.splice(i, 1);
+ break;
+ }
+ }
}
function gameOver() {
gameState = 'gameOver';
LK.getSound('hit').play();
@@ -288,8 +360,11 @@
}
for (var i = 0; i < obstacles.length; i++) {
obstacles[i].speed = -gameSpeed;
}
+ for (var i = 0; i < breakableBlocks.length; i++) {
+ breakableBlocks[i].speed = -gameSpeed;
+ }
}
game.down = function (x, y, obj) {
if (gameState === 'customization') {
// Check color button clicks
@@ -357,8 +432,21 @@
obstacle.destroy();
obstacles.splice(i, 1);
}
}
+ // Update and clean up breakable blocks
+ for (var i = breakableBlocks.length - 1; i >= 0; i--) {
+ var block = breakableBlocks[i];
+ if (block.x < -100) {
+ block.destroy();
+ breakableBlocks.splice(i, 1);
+ }
+ }
+ // Update invincibility UI
+ invincibilityText.visible = player.isInvincible;
+ if (player.isInvincible) {
+ invincibilityText.setText('INVINCIBLE! ' + Math.ceil(player.invincibilityTimer / 60) + 's');
+ }
// Check collisions
checkCollisions();
// Update score
LK.setScore(Math.floor(distance));
un agujero hecho con pixeles. In-Game asset. 2d. High contrast. No shadows
un mounstro grande hecho con pixeles con perspectiva de lado y mas aterrador In-Game asset. 2d. High contrast. No shadows
un suelo de pasto y tierra hecho con pixeles. In-Game asset. 2d. High contrast. No shadows
una pincho grande hecho con pixeles In-Game asset. 2d. High contrast. No shadows
una bala de pistola 9 milimetros hecha con pixeles con perspectiva lateral. In-Game asset. 2d. High contrast. No shadows
un mounstro con alas hecho con pixeles. In-Game asset. 2d. High contrast. No shadows
un puño agarrando un arma hecho con pixeles y de perspectiva lateral. In-Game asset. 2d. High contrast. No shadows
un boton rojo que en medio dice shot hecho con pixeles. In-Game asset. 2d. High contrast. No shadows
un boton cuadrado hecho con pixeles que dice play. In-Game asset. 2d. High contrast. No shadows
un hombre obrero hecho con pixeles de cuerpo completo sosteniendo un arma
un policia de cuerpo completo hecho con pixeles con persepectiva lateral apuntando con un arma I
un hombre de traje hecho con pixeles de cuerpo completo apuntando con un rifle de asalto m4
goku de dragon ball hecho con pixeles de cuepo completo con perspectiva lateral apuntando don un rifle de asalto m4 In-Game asset. 2d. High contrast. No shadows
homero simpson hecho con pixeles de cuerpo completo con perspectiva lateral apuntando con rifle de asalto m4 I
letras hechas con pixeles que dicen shot and jump las letras shot tendran un estilo medieval y tendran un color gris,las letras and color blanco con contorno negro y las letras jump de color amarillo con contorno naranja