User prompt
que el ítem de volar aparezca un poco mas abajo
User prompt
crea un iten que aparezca de desen cuando que haga volar al personaje por 10 segundos ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
que en el mundo 5 el obstacle sea replazado con el assets "volcan" y que este dispare el assets "bola" hacia arriba
User prompt
en el mundo 5, que el obstacle sea replazado por el assets "nieve"
User prompt
que el "estepicursor" se mueva un poco mas rapido
User prompt
cuando cambies de mundo que aparezca el titulo del mundo mas grande por unos segundos ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
en el mundo 4 que el obtacle sea replazado por el assets "estipicursor" y que este se mueva hacia la izquierda lentmente
User prompt
en el mundo 4 que no haya nubes solo 1 solque estara quieto y que sera el assets "sol"
User prompt
puedes hacer que el jugador tenga 3 vidas de corazones? osea puede ser golpeado 3 veces y a la 3 vez pierde ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
puedes hacer un poco mas grandes las palabras del menu
User prompt
perfecto,dale relieve tambien a las palabras del menu
User prompt
dale un relieve a las palabras del titulo y cabial el "sky runner" por "word runner"
User prompt
hay un problema,en el mundo 3 cuando las nubes deberian ser replazadas por burbuja,aun hay nubes
User prompt
puedes dispersar un poco las nubes? osea que aparezcan mas separadas
User prompt
pon que tenga tu record de distancia y mundos ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
ponle relieve a las palabras de "distance" y "mundos"
User prompt
pon un menu de inicio
User prompt
en el mundo 3 "underwater world" las nubes sean replazadas por el assets "burbuja",y que en el mundo 3 tenga un efecto de agua ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
pon que en el mundo 2 "space world" las nubes sean replazadas por el assets "planeta"
User prompt
crea que en el mundo 3 no salga el obstacle pero se replace por el obstacle3 solamente en el mundo 3
User prompt
que el obstacle2 no gire y agrega un contador por cada portal que agarre el personaje que diga "mundos:"
User prompt
perfecto,pon que cuando agarre el portal aparescan obstaculos en el cielo cada cierto tiempo en el mundo 2 solamente,para eso cree el assets "obstacle2"
User prompt
puedes añadir movimiento al obstaculo volteando su sprite ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
reduce el hitbox de todos los obstaculos a 0,3 y eleva el salto del personaje
User prompt
reduce el hitbox del obstaculo a 0,3
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var BolaProjectile = Container.expand(function () {
var self = Container.call(this);
var bolaGraphics = self.attachAsset('bola', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = -8; // Move upward
self.update = function () {
self.y += self.speed; // Move upward (negative Y)
};
return self;
});
var Bubble = Container.expand(function () {
var self = Container.call(this);
var bubbleGraphics = self.attachAsset('burbuja', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 1 + Math.random() * 2;
bubbleGraphics.alpha = 0.6 + Math.random() * 0.3;
var scale = 0.5 + Math.random() * 1.5;
bubbleGraphics.scaleX = scale;
bubbleGraphics.scaleY = scale;
// Add floating animation for bubbles
self.floatOffset = Math.random() * Math.PI * 2;
self.update = function () {
self.x -= self.speed;
// Add gentle floating motion
self.y += Math.sin(LK.ticks * 0.02 + self.floatOffset) * 0.5;
};
return self;
});
var Cloud = Container.expand(function () {
var self = Container.call(this);
var cloudGraphics = self.attachAsset('cloud', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 1 + Math.random() * 2;
cloudGraphics.alpha = 0.6 + Math.random() * 0.3;
var scale = 0.5 + Math.random() * 1.5;
cloudGraphics.scaleX = scale;
cloudGraphics.scaleY = scale * 0.6;
self.update = function () {
self.x -= self.speed;
};
return self;
});
var EstepicursorObstacle = Container.expand(function () {
var self = Container.call(this);
var obstacleGraphics = self.attachAsset('estepicursor', {
anchorX: 0.5,
anchorY: 1
});
// Create smaller hitbox for collision detection (30% of original size)
self.hitbox = new Container();
self.hitbox.width = obstacleGraphics.width * 0.3;
self.hitbox.height = obstacleGraphics.height * 0.3;
self.hitbox.x = -self.hitbox.width * 0.5; // Center the hitbox
self.hitbox.y = -self.hitbox.height; // Align to bottom like the visual
self.addChild(self.hitbox);
// Override intersects method to use hitbox instead of full visual
self.intersects = function (other) {
return self.hitbox.intersects ? self.hitbox.intersects(other) : Container.prototype.intersects.call(self.hitbox, other);
};
self.speed = gameSpeed * 0.5; // Move slowly to the left
self.update = function () {
self.x -= self.speed;
};
return self;
});
var FlyingItem = Container.expand(function () {
var self = Container.call(this);
var itemGraphics = self.attachAsset('over', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = gameSpeed;
// Add floating animation
self.floatOffset = Math.random() * Math.PI * 2;
// Add glow effect
itemGraphics.tint = 0x00FFFF;
self.update = function () {
self.x -= self.speed;
// Add gentle floating motion
self.y += Math.sin(LK.ticks * 0.05 + self.floatOffset) * 1.5;
// Add pulsing glow effect
itemGraphics.alpha = 0.7 + Math.sin(LK.ticks * 0.1) * 0.3;
};
return self;
});
var Ground = Container.expand(function () {
var self = Container.call(this);
var groundGraphics = self.attachAsset('ground', {
anchorX: 0,
anchorY: 0
});
self.speed = gameSpeed;
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
});
// Create smaller hitbox for collision detection (30% of original size)
self.hitbox = new Container();
self.hitbox.width = obstacleGraphics.width * 0.3;
self.hitbox.height = obstacleGraphics.height * 0.3;
self.hitbox.x = -self.hitbox.width * 0.5; // Center the hitbox
self.hitbox.y = -self.hitbox.height; // Align to bottom like the visual
self.addChild(self.hitbox);
// Override intersects method to use hitbox instead of full visual
self.intersects = function (other) {
return self.hitbox.intersects ? self.hitbox.intersects(other) : Container.prototype.intersects.call(self.hitbox, other);
};
self.speed = gameSpeed;
self.update = function () {
self.x -= self.speed;
};
// Start flip animation when obstacle is created
function startFlipAnimation() {
tween(obstacleGraphics, {
scaleX: -1
}, {
duration: 1000,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(obstacleGraphics, {
scaleX: 1
}, {
duration: 1000,
easing: tween.easeInOut,
onFinish: startFlipAnimation
});
}
});
}
// Start the flip animation
startFlipAnimation();
return self;
});
var Obstacle3 = Container.expand(function () {
var self = Container.call(this);
var obstacleGraphics = self.attachAsset('obstacle3', {
anchorX: 0.5,
anchorY: 1
});
// Create smaller hitbox for collision detection (30% of original size)
self.hitbox = new Container();
self.hitbox.width = obstacleGraphics.width * 0.3;
self.hitbox.height = obstacleGraphics.height * 0.3;
self.hitbox.x = -self.hitbox.width * 0.5; // Center the hitbox
self.hitbox.y = -self.hitbox.height; // Align to bottom like the visual
self.addChild(self.hitbox);
// Override intersects method to use hitbox instead of full visual
self.intersects = function (other) {
return self.hitbox.intersects ? self.hitbox.intersects(other) : Container.prototype.intersects.call(self.hitbox, other);
};
self.speed = gameSpeed;
self.update = function () {
self.x -= self.speed;
};
return self;
});
var Planet = Container.expand(function () {
var self = Container.call(this);
var planetGraphics = self.attachAsset('planeta', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 1 + Math.random() * 2;
planetGraphics.alpha = 0.8 + Math.random() * 0.2;
var scale = 0.8 + Math.random() * 1.2;
planetGraphics.scaleX = scale;
planetGraphics.scaleY = scale;
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
});
self.velocityY = 0;
self.isOnGround = false;
self.jumpPower = -40;
self.gravity = 1.2;
self.jumpCount = 0;
self.maxJumps = 2;
self.jump = function () {
if (self.jumpCount < self.maxJumps) {
self.velocityY = self.jumpPower;
self.isOnGround = false;
self.jumpCount++;
LK.getSound('jump').play();
}
};
self.update = function () {
if (isFlying) {
// Flying mode: gentle hovering motion, no gravity
self.y = 800 + Math.sin(LK.ticks * 0.08) * 50;
self.velocityY = 0;
self.isOnGround = false;
self.jumpCount = 0;
// Flying animation
playerGraphics.rotation = Math.sin(LK.ticks * 0.2) * 0.05;
// Add flying glow effect
playerGraphics.tint = 0x00FFFF;
} else {
// Normal mode: apply gravity
playerGraphics.tint = 0xFFFFFF;
self.velocityY += self.gravity;
self.y += self.velocityY;
// Check ground collision
if (self.y >= groundY) {
self.y = groundY;
self.velocityY = 0;
self.isOnGround = true;
self.jumpCount = 0;
}
// Animate running
playerGraphics.rotation = Math.sin(LK.ticks * 0.3) * 0.1;
}
};
return self;
});
var Portal = Container.expand(function () {
var self = Container.call(this);
var portalGraphics = self.attachAsset('portal', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = gameSpeed;
self.used = false;
self.update = function () {
self.x -= self.speed;
// Portal animation
portalGraphics.rotation += 0.1;
portalGraphics.alpha = 0.7 + Math.sin(LK.ticks * 0.15) * 0.3;
};
return self;
});
var SkyObstacle = Container.expand(function () {
var self = Container.call(this);
var obstacleGraphics = self.attachAsset('obstacle2', {
anchorX: 0.5,
anchorY: 0.5
});
// Create smaller hitbox for collision detection (30% of original size)
self.hitbox = new Container();
self.hitbox.width = obstacleGraphics.width * 0.3;
self.hitbox.height = obstacleGraphics.height * 0.3;
self.hitbox.x = -self.hitbox.width * 0.5; // Center the hitbox
self.hitbox.y = -self.hitbox.height * 0.5; // Center the hitbox
self.addChild(self.hitbox);
// Override intersects method to use hitbox instead of full visual
self.intersects = function (other) {
return self.hitbox.intersects ? self.hitbox.intersects(other) : Container.prototype.intersects.call(self.hitbox, other);
};
self.speed = gameSpeed;
self.update = function () {
self.x -= self.speed;
};
return self;
});
var Sun = Container.expand(function () {
var self = Container.call(this);
var sunGraphics = self.attachAsset('sol', {
anchorX: 0.5,
anchorY: 0.5
});
// Sun doesn't move, it's static
sunGraphics.alpha = 0.9;
var scale = 2.0; // Make sun larger
sunGraphics.scaleX = scale;
sunGraphics.scaleY = scale;
// Add gentle glow animation
self.glowOffset = 0;
self.update = function () {
// Add gentle pulsing glow effect
sunGraphics.alpha = 0.8 + Math.sin(LK.ticks * 0.03 + self.glowOffset) * 0.1;
};
return self;
});
var VolcanObstacle = Container.expand(function () {
var self = Container.call(this);
var obstacleGraphics = self.attachAsset('volcan', {
anchorX: 0.5,
anchorY: 1
});
// Create smaller hitbox for collision detection (30% of original size)
self.hitbox = new Container();
self.hitbox.width = obstacleGraphics.width * 0.3;
self.hitbox.height = obstacleGraphics.height * 0.3;
self.hitbox.x = -self.hitbox.width * 0.5; // Center the hitbox
self.hitbox.y = -self.hitbox.height; // Align to bottom like the visual
self.addChild(self.hitbox);
// Override intersects method to use hitbox instead of full visual
self.intersects = function (other) {
return self.hitbox.intersects ? self.hitbox.intersects(other) : Container.prototype.intersects.call(self.hitbox, other);
};
self.speed = gameSpeed;
self.shootTimer = 0;
self.update = function () {
self.x -= self.speed;
// Shoot bola projectiles upward
self.shootTimer++;
if (self.shootTimer > 60) {
// Shoot every second (60 frames)
var bola = new BolaProjectile();
bola.x = self.x;
bola.y = self.y - 50; // Start above the volcano
volcanoProjectiles.push(bola);
game.addChild(bola);
self.shootTimer = 0;
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB
});
/****
* Game Code
****/
// Game variables
var gameSpeed = 8;
var groundY = 2732 - 200;
var player;
var obstacles = [];
var portals = [];
var groundTiles = [];
var distance = 0;
var currentWorld = 0;
var worldTransitioning = false;
var clouds = [];
var planets = [];
var skyObstacles = [];
var bubbles = [];
var volcanoProjectiles = [];
var flyingItems = [];
var isFlying = false;
var flyingTimer = 0;
var flyingDuration = 600; // 10 seconds at 60 FPS
var sun = null; // Static sun for world 4
var worldCounter = 0;
var waterEffect = null;
var playerLives = 3;
var maxLives = 3;
var hearts = [];
var isInvulnerable = false;
var invulnerabilityTime = 2000; // 2 seconds
// Game state variables
var gameState = 'menu'; // 'menu' or 'playing'
var menuContainer = null;
// Record tracking
var bestDistance = storage.bestDistance || 0;
var bestWorlds = storage.bestWorlds || 0;
// World configurations
var worlds = [{
bg: 0x87CEEB,
ground: 0x4A90E2,
obstacle: 0xFF5722
},
// Sky world
{
bg: 0x1A237E,
ground: 0x424242,
obstacle: 0xFF9800
},
// Space world
{
bg: 0x006064,
ground: 0x00838F,
obstacle: 0x4CAF50
},
// Underwater world
{
bg: 0xFF6F00,
ground: 0xD84315,
obstacle: 0x795548
},
// Desert world
{
bg: 0xE3F2FD,
ground: 0x90A4AE,
obstacle: 0x607D8B
},
// Ice world
{
bg: 0x3E2723,
ground: 0xFF5722,
obstacle: 0x212121
} // Lava world
];
// UI
var distanceText = new Text2('Distance: 0', {
size: 60,
fill: 0xFFFFFF,
stroke: 0x000000,
strokeThickness: 4,
dropShadow: true,
dropShadowColor: 0x000000,
dropShadowBlur: 4,
dropShadowAngle: Math.PI / 4,
dropShadowDistance: 3
});
distanceText.anchor.set(0, 0);
distanceText.x = 50;
distanceText.y = 50;
distanceText.visible = false; // Hide initially
LK.gui.topLeft.addChild(distanceText);
var worldText = new Text2('Sky World', {
size: 50,
fill: 0xFFFFFF
});
worldText.anchor.set(0.5, 0);
worldText.visible = false; // Hide initially
LK.gui.top.addChild(worldText);
var worldTitleText = new Text2('', {
size: 120,
fill: 0xFFFFFF,
stroke: 0x000000,
strokeThickness: 5,
dropShadow: true,
dropShadowColor: 0x000000,
dropShadowBlur: 6,
dropShadowAngle: Math.PI / 4,
dropShadowDistance: 4
});
worldTitleText.anchor.set(0.5, 0.5);
worldTitleText.x = 1024;
worldTitleText.y = 1366;
worldTitleText.visible = false;
LK.gui.center.addChild(worldTitleText);
function showWorldTitle(worldName) {
worldTitleText.setText(worldName);
worldTitleText.visible = true;
worldTitleText.alpha = 0;
worldTitleText.scaleX = 0.5;
worldTitleText.scaleY = 0.5;
tween(worldTitleText, {
alpha: 1,
scaleX: 1,
scaleY: 1
}, {
duration: 500,
easing: tween.easeOut,
onFinish: function onFinish() {
LK.setTimeout(function () {
tween(worldTitleText, {
alpha: 0,
scaleX: 0.8,
scaleY: 0.8
}, {
duration: 500,
easing: tween.easeIn,
onFinish: function onFinish() {
worldTitleText.visible = false;
}
});
}, 2000);
}
});
}
var worldCounterText = new Text2('Mundos: 0', {
size: 50,
fill: 0xFFFFFF,
stroke: 0x000000,
strokeThickness: 3,
dropShadow: true,
dropShadowColor: 0x000000,
dropShadowBlur: 3,
dropShadowAngle: Math.PI / 4,
dropShadowDistance: 2
});
worldCounterText.anchor.set(1, 0);
worldCounterText.x = -50;
worldCounterText.y = 50;
worldCounterText.visible = false; // Hide initially
LK.gui.topRight.addChild(worldCounterText);
// Initialize player
player = game.addChild(new Player());
player.x = 300;
player.y = groundY;
player.visible = false; // Hide player initially
// Create hearts UI
function createHeartsUI() {
// Clear existing hearts
for (var i = 0; i < hearts.length; i++) {
hearts[i].destroy();
}
hearts = [];
// Create heart containers
for (var i = 0; i < maxLives; i++) {
var heartContainer = new Container();
var heart = heartContainer.attachAsset('heart', {
anchorX: 0.5,
anchorY: 0.5
});
// Position hearts horizontally
heartContainer.x = 50 + i * 100;
heartContainer.y = 150;
// Show/hide based on current lives
if (i < playerLives) {
heart.alpha = 1.0;
heart.tint = 0xFF0000; // Red for active hearts
} else {
heart.alpha = 0.3;
heart.tint = 0x666666; // Gray for lost hearts
}
LK.gui.topLeft.addChild(heartContainer);
hearts.push(heartContainer);
}
}
// Update hearts display
function updateHeartsUI() {
for (var i = 0; i < hearts.length; i++) {
var heart = hearts[i].children[0];
if (i < playerLives) {
heart.alpha = 1.0;
heart.tint = 0xFF0000; // Red for active hearts
} else {
heart.alpha = 0.3;
heart.tint = 0x666666; // Gray for lost hearts
}
}
}
// Lose a life function
function loseLife() {
if (isInvulnerable || playerLives <= 0) return;
playerLives--;
updateHeartsUI();
// Make player invulnerable temporarily
isInvulnerable = true;
// Flash player red to indicate damage
tween(player.children[0], {
tint: 0xFF0000
}, {
duration: 200,
onFinish: function onFinish() {
tween(player.children[0], {
tint: 0xFFFFFF
}, {
duration: 200
});
}
});
// Remove invulnerability after set time
LK.setTimeout(function () {
isInvulnerable = false;
}, invulnerabilityTime);
// Check if game over
if (playerLives <= 0) {
// Update records before game over
var currentDistance = Math.floor(distance / 10);
if (currentDistance > bestDistance) {
bestDistance = currentDistance;
storage.bestDistance = bestDistance;
}
if (worldCounter > bestWorlds) {
bestWorlds = worldCounter;
storage.bestWorlds = bestWorlds;
}
LK.getSound('crash').play();
LK.effects.flashScreen(0xFF0000, 1000);
LK.showGameOver();
}
}
// Create start menu
function createStartMenu() {
menuContainer = new Container();
// Menu background
var menuBg = LK.getAsset('cloud', {
scaleX: 15,
scaleY: 20,
alpha: 0.3,
tint: 0x000080
});
menuBg.x = 1024;
menuBg.y = 1366;
menuContainer.addChild(menuBg);
// Game title
var titleText = new Text2('WORD RUNNER', {
size: 120,
fill: 0xFFFFFF,
stroke: 0x000000,
strokeThickness: 5,
dropShadow: true,
dropShadowColor: 0x000000,
dropShadowBlur: 6,
dropShadowAngle: Math.PI / 4,
dropShadowDistance: 4
});
titleText.anchor.set(0.5, 0.5);
titleText.x = 1024;
titleText.y = 800;
menuContainer.addChild(titleText);
// Subtitle
var subtitleText = new Text2('Tap to jump and avoid obstacles!', {
size: 80,
fill: 0xCCCCCC,
stroke: 0x000000,
strokeThickness: 3,
dropShadow: true,
dropShadowColor: 0x000000,
dropShadowBlur: 4,
dropShadowAngle: Math.PI / 4,
dropShadowDistance: 3
});
subtitleText.anchor.set(0.5, 0.5);
subtitleText.x = 1024;
subtitleText.y = 950;
menuContainer.addChild(subtitleText);
// Play button
var playButton = LK.getAsset('portal', {
scaleX: 2,
scaleY: 1.5
});
playButton.x = 1024;
playButton.y = 1400;
playButton.anchor.set(0.5, 0.5);
menuContainer.addChild(playButton);
// Play button text
var playText = new Text2('PLAY', {
size: 100,
fill: 0xFFFFFF,
stroke: 0x000000,
strokeThickness: 4,
dropShadow: true,
dropShadowColor: 0x000000,
dropShadowBlur: 5,
dropShadowAngle: Math.PI / 4,
dropShadowDistance: 3
});
playText.anchor.set(0.5, 0.5);
playText.x = 1024;
playText.y = 1400;
menuContainer.addChild(playText);
// Instructions
var instructText = new Text2('Collect portals to travel between worlds!', {
size: 70,
fill: 0xFFFFFF,
stroke: 0x000000,
strokeThickness: 3,
dropShadow: true,
dropShadowColor: 0x000000,
dropShadowBlur: 4,
dropShadowAngle: Math.PI / 4,
dropShadowDistance: 2
});
instructText.anchor.set(0.5, 0.5);
instructText.x = 1024;
instructText.y = 1600;
menuContainer.addChild(instructText);
// Records display
var recordsText = new Text2('RECORDS', {
size: 90,
fill: 0xFFD700,
stroke: 0x000000,
strokeThickness: 4,
dropShadow: true,
dropShadowColor: 0x000000,
dropShadowBlur: 5,
dropShadowAngle: Math.PI / 4,
dropShadowDistance: 3
});
recordsText.anchor.set(0.5, 0.5);
recordsText.x = 1024;
recordsText.y = 1800;
menuContainer.addChild(recordsText);
var bestDistanceText = new Text2('Best Distance: ' + bestDistance, {
size: 70,
fill: 0xFFFFFF,
stroke: 0x000000,
strokeThickness: 3,
dropShadow: true,
dropShadowColor: 0x000000,
dropShadowBlur: 4,
dropShadowAngle: Math.PI / 4,
dropShadowDistance: 2
});
bestDistanceText.anchor.set(0.5, 0.5);
bestDistanceText.x = 1024;
bestDistanceText.y = 1900;
menuContainer.addChild(bestDistanceText);
var bestWorldsText = new Text2('Best Worlds: ' + bestWorlds, {
size: 70,
fill: 0xFFFFFF,
stroke: 0x000000,
strokeThickness: 3,
dropShadow: true,
dropShadowColor: 0x000000,
dropShadowBlur: 4,
dropShadowAngle: Math.PI / 4,
dropShadowDistance: 2
});
bestWorldsText.anchor.set(0.5, 0.5);
bestWorldsText.x = 1024;
bestWorldsText.y = 1980;
menuContainer.addChild(bestWorldsText);
game.addChild(menuContainer);
}
// Start the game
function startGame() {
if (gameState !== 'menu') return;
gameState = 'playing';
// Hide menu
if (menuContainer) {
menuContainer.destroy();
menuContainer = null;
}
// Reset lives
playerLives = maxLives;
isInvulnerable = false;
// Show player
player.visible = true;
// Create and show hearts UI
createHeartsUI();
// Start music
LK.playMusic('electro');
}
// Initialize start menu
createStartMenu();
// Initialize clouds
function createCloud() {
var cloud = new Cloud();
cloud.x = 2048 + Math.random() * 1000;
cloud.y = 200 + Math.random() * 800;
return cloud;
}
// Initialize planets
function createPlanet() {
var planet = new Planet();
planet.x = 2048 + Math.random() * 1000;
planet.y = 200 + Math.random() * 800;
return planet;
}
// Initialize bubbles
function createBubble() {
var bubble = new Bubble();
bubble.x = 2048 + Math.random() * 1000;
bubble.y = 200 + Math.random() * 800;
return bubble;
}
// Create initial clouds
for (var i = 0; i < 5; i++) {
var cloud = game.addChild(createCloud());
clouds.push(cloud);
}
// Create initial planets (hidden initially)
for (var i = 0; i < 5; i++) {
var planet = game.addChild(createPlanet());
planet.visible = false;
planets.push(planet);
}
// Create initial bubbles (hidden initially)
for (var i = 0; i < 5; i++) {
var bubble = game.addChild(createBubble());
bubble.visible = false;
bubbles.push(bubble);
}
// Initialize ground tiles
function createGroundTile(x) {
var tile = new Ground();
tile.x = x;
tile.y = groundY;
// Set speed based on current game progress
var speedMultiplier = 1 + Math.floor(distance / 1000) * 0.3;
tile.speed = gameSpeed * speedMultiplier;
applyWorldTheme(tile, currentWorld);
return tile;
}
function applyWorldTheme(object, worldIndex) {
var world = worlds[worldIndex];
if (object.children && object.children[0]) {
object.children[0].tint = world.ground;
}
}
// Create initial ground
for (var i = 0; i < 4; i++) {
var tile = game.addChild(createGroundTile(i * 2048));
groundTiles.push(tile);
}
// Obstacle spawning
var obstacleTimer = 0;
var portalTimer = 0;
var skyObstacleTimer = 0;
var flyingItemTimer = 0;
function spawnObstacle() {
var obstacle;
// In world 3, spawn Obstacle3 instead of regular Obstacle
if (currentWorld === 2) {
obstacle = new Obstacle3();
} else if (currentWorld === 3) {
// In world 4 (desert world), spawn EstepicursorObstacle
obstacle = new EstepicursorObstacle();
} else if (currentWorld === 4) {
// In world 5 (ice world), spawn VolcanObstacle
obstacle = new VolcanObstacle();
} else {
obstacle = new Obstacle();
}
obstacle.x = 2048 + 100;
obstacle.y = groundY;
// Apply world theme only for regular obstacles (not Obstacle3, EstepicursorObstacle or NieveObstacle)
if (currentWorld !== 2 && currentWorld !== 3 && currentWorld !== 4 && obstacle.children && obstacle.children[0]) {
obstacle.children[0].tint = worlds[currentWorld].obstacle;
}
// Set speed based on current game progress
var speedMultiplier = 1 + Math.floor(distance / 1000) * 0.3;
if (currentWorld === 3) {
// EstepicursorObstacle moves slowly
obstacle.speed = gameSpeed * 0.5 * speedMultiplier;
} else {
obstacle.speed = gameSpeed * speedMultiplier;
}
obstacles.push(obstacle);
game.addChild(obstacle);
}
function spawnPortal() {
var portal = new Portal();
portal.x = 2048 + 200;
portal.y = groundY - 100;
// Set speed based on current game progress
var speedMultiplier = 1 + Math.floor(distance / 1000) * 0.3;
portal.speed = gameSpeed * speedMultiplier;
portals.push(portal);
game.addChild(portal);
}
function spawnSkyObstacle() {
var skyObstacle = new SkyObstacle();
skyObstacle.x = 2048 + 100;
skyObstacle.y = 400 + Math.random() * 800; // Random height in the sky
// Set speed based on current game progress
var speedMultiplier = 1 + Math.floor(distance / 1000) * 0.3;
skyObstacle.speed = gameSpeed * speedMultiplier;
skyObstacles.push(skyObstacle);
game.addChild(skyObstacle);
}
function spawnFlyingItem() {
var flyingItem = new FlyingItem();
flyingItem.x = 2048 + 200;
flyingItem.y = 800 + Math.random() * 400; // Random height in lower middle area
// Set speed based on current game progress
var speedMultiplier = 1 + Math.floor(distance / 1000) * 0.3;
flyingItem.speed = gameSpeed * speedMultiplier;
flyingItems.push(flyingItem);
game.addChild(flyingItem);
}
function createWaterEffect() {
if (waterEffect) {
waterEffect.destroy();
waterEffect = null;
}
// Create a subtle water overlay effect
waterEffect = new Container();
var waterOverlay = LK.getAsset('cloud', {
width: 2048,
height: 2732,
scaleX: 10,
scaleY: 10,
alpha: 0.1,
tint: 0x006064
});
waterEffect.addChild(waterOverlay);
game.addChild(waterEffect);
// Add gentle wave animation
function animateWater() {
if (waterEffect) {
tween(waterOverlay, {
alpha: 0.05
}, {
duration: 2000,
easing: tween.easeInOut,
onFinish: function onFinish() {
if (waterEffect) {
tween(waterOverlay, {
alpha: 0.15
}, {
duration: 2000,
easing: tween.easeInOut,
onFinish: animateWater
});
}
}
});
}
}
animateWater();
}
function changeWorld() {
if (worldTransitioning) {
return;
}
worldTransitioning = true;
currentWorld = (currentWorld + 1) % worlds.length;
// Flash effect
LK.effects.flashScreen(0xFFFFFF, 500);
// Update background
game.setBackgroundColor(worlds[currentWorld].bg);
// Update world text
var worldNames = ['Sky World', 'Space World', 'Underwater World', 'Desert World', 'Ice World', 'Lava World'];
worldText.setText(worldNames[currentWorld]);
// Show large world title
showWorldTitle(worldNames[currentWorld]);
// Handle world-specific elements
if (currentWorld === 1) {
// Space world: Hide clouds and bubbles, show planets
for (var i = 0; i < clouds.length; i++) {
clouds[i].visible = false;
}
for (var i = 0; i < bubbles.length; i++) {
bubbles[i].visible = false;
}
for (var i = 0; i < planets.length; i++) {
planets[i].visible = true;
}
if (waterEffect) {
waterEffect.destroy();
waterEffect = null;
}
} else if (currentWorld === 2) {
// Underwater world: Hide clouds and planets, show bubbles and water effect
for (var i = 0; i < clouds.length; i++) {
clouds[i].visible = false;
}
for (var i = 0; i < planets.length; i++) {
planets[i].visible = false;
}
for (var i = 0; i < bubbles.length; i++) {
bubbles[i].visible = true;
}
createWaterEffect();
} else if (currentWorld === 3) {
// Desert world: Hide clouds, planets and bubbles, show only static sun
for (var i = 0; i < clouds.length; i++) {
clouds[i].visible = false;
}
for (var i = 0; i < planets.length; i++) {
planets[i].visible = false;
}
for (var i = 0; i < bubbles.length; i++) {
bubbles[i].visible = false;
}
if (waterEffect) {
waterEffect.destroy();
waterEffect = null;
}
// Create or show static sun
if (!sun) {
sun = new Sun();
sun.x = 1600; // Position sun in upper right area
sun.y = 400;
game.addChild(sun);
} else {
sun.visible = true;
}
} else {
// Other worlds: Show clouds, hide planets, bubbles and sun
for (var i = 0; i < clouds.length; i++) {
clouds[i].visible = true;
}
for (var i = 0; i < planets.length; i++) {
planets[i].visible = false;
}
for (var i = 0; i < bubbles.length; i++) {
bubbles[i].visible = false;
}
if (sun) {
sun.visible = false;
}
if (waterEffect) {
waterEffect.destroy();
waterEffect = null;
}
}
// Update existing objects
for (var i = 0; i < groundTiles.length; i++) {
applyWorldTheme(groundTiles[i], currentWorld);
}
for (var i = 0; i < obstacles.length; i++) {
if (obstacles[i].children && obstacles[i].children[0]) {
obstacles[i].children[0].tint = worlds[currentWorld].obstacle;
}
}
LK.getSound('portal').play();
LK.setTimeout(function () {
worldTransitioning = false;
}, 500);
}
// Input handling
game.down = function (x, y, obj) {
if (gameState === 'menu') {
startGame();
// Show UI elements
distanceText.visible = true;
worldText.visible = true;
worldCounterText.visible = true;
} else if (gameState === 'playing') {
player.jump();
}
};
// Main game loop
game.update = function () {
// Only update game logic when playing
if (gameState !== 'playing') {
return;
}
// Update distance
distance += gameSpeed;
distanceText.setText('Distance: ' + Math.floor(distance / 10));
LK.setScore(Math.floor(distance / 10));
// Spawn obstacles
obstacleTimer++;
if (obstacleTimer > 150 + Math.random() * 100) {
spawnObstacle();
obstacleTimer = 0;
}
// Spawn portals
portalTimer++;
if (portalTimer > 300 + Math.random() * 200) {
spawnPortal();
portalTimer = 0;
}
// Spawn sky obstacles only in world 2 (Space World)
if (currentWorld === 1) {
skyObstacleTimer++;
if (skyObstacleTimer > 200 + Math.random() * 150) {
spawnSkyObstacle();
skyObstacleTimer = 0;
}
}
// Spawn flying items randomly (rare)
flyingItemTimer++;
if (flyingItemTimer > 800 + Math.random() * 400) {
spawnFlyingItem();
flyingItemTimer = 0;
}
// Update flying timer
if (isFlying) {
flyingTimer--;
if (flyingTimer <= 0) {
isFlying = false;
}
}
// Update and remove off-screen obstacles
for (var i = obstacles.length - 1; i >= 0; i--) {
var obstacle = obstacles[i];
if (obstacle.x < -100) {
obstacle.destroy();
obstacles.splice(i, 1);
continue;
}
// Collision detection
if (player.intersects(obstacle) && !isInvulnerable) {
loseLife();
if (playerLives <= 0) {
return;
}
}
}
// Update and remove off-screen portals
for (var i = portals.length - 1; i >= 0; i--) {
var portal = portals[i];
if (portal.x < -150) {
portal.destroy();
portals.splice(i, 1);
continue;
}
// Portal collision
if (player.intersects(portal) && !portal.used) {
portal.used = true;
worldCounter++;
worldCounterText.setText('Mundos: ' + worldCounter);
changeWorld();
LK.setScore(LK.getScore() + 10);
}
}
// Update and remove off-screen sky obstacles
for (var i = skyObstacles.length - 1; i >= 0; i--) {
var skyObstacle = skyObstacles[i];
if (skyObstacle.x < -100) {
skyObstacle.destroy();
skyObstacles.splice(i, 1);
continue;
}
// Collision detection with sky obstacles
if (player.intersects(skyObstacle) && !isInvulnerable) {
loseLife();
if (playerLives <= 0) {
return;
}
}
}
// Update and remove off-screen flying items
for (var i = flyingItems.length - 1; i >= 0; i--) {
var flyingItem = flyingItems[i];
if (flyingItem.x < -100) {
flyingItem.destroy();
flyingItems.splice(i, 1);
continue;
}
// Flying item collision
if (player.intersects(flyingItem)) {
isFlying = true;
flyingTimer = flyingDuration;
// Visual effect when collecting flying item
tween(flyingItem, {
scaleX: 2,
scaleY: 2,
alpha: 0
}, {
duration: 300,
onFinish: function onFinish() {
flyingItem.destroy();
}
});
flyingItems.splice(i, 1);
}
}
// Update ground tiles
for (var i = groundTiles.length - 1; i >= 0; i--) {
var tile = groundTiles[i];
if (tile.x < -2048) {
// Move tile to the right
tile.x = tile.x + groundTiles.length * 2048;
applyWorldTheme(tile, currentWorld);
}
}
// Check if player fell off screen
if (player.y > 2732 + 100) {
loseLife();
if (playerLives <= 0) {
return;
}
// Reset player position when falling
player.y = groundY;
player.velocityY = 0;
}
// Update clouds
for (var i = clouds.length - 1; i >= 0; i--) {
var cloud = clouds[i];
if (cloud.x < -300) {
cloud.destroy();
clouds.splice(i, 1);
// Spawn new cloud
var newCloud = game.addChild(createCloud());
newCloud.visible = currentWorld !== 1 && currentWorld !== 2 && currentWorld !== 3; // Hide in space, underwater and desert worlds
clouds.push(newCloud);
}
}
// Update planets
for (var i = planets.length - 1; i >= 0; i--) {
var planet = planets[i];
if (planet.x < -300) {
planet.destroy();
planets.splice(i, 1);
// Spawn new planet
var newPlanet = game.addChild(createPlanet());
newPlanet.visible = currentWorld === 1;
planets.push(newPlanet);
}
}
// Update bubbles
for (var i = bubbles.length - 1; i >= 0; i--) {
var bubble = bubbles[i];
if (bubble.x < -300) {
bubble.destroy();
bubbles.splice(i, 1);
// Spawn new bubble
var newBubble = game.addChild(createBubble());
newBubble.visible = currentWorld === 2;
bubbles.push(newBubble);
}
}
// Gradually increase difficulty and speed based on distance
var speedMultiplier = 1 + Math.floor(distance / 1000) * 0.3;
var currentGameSpeed = gameSpeed * speedMultiplier;
if (LK.ticks % 600 === 0) {
gameSpeed += 0.5;
}
// Update speeds for existing objects with current speed multiplier
for (var i = 0; i < obstacles.length; i++) {
// Check if it's an EstepicursorObstacle (world 4)
if (obstacles[i].constructor.name === 'EstepicursorObstacle') {
obstacles[i].speed = currentGameSpeed * 0.5; // Keep slow speed
} else {
obstacles[i].speed = currentGameSpeed;
}
}
for (var i = 0; i < portals.length; i++) {
portals[i].speed = currentGameSpeed;
}
for (var i = 0; i < groundTiles.length; i++) {
groundTiles[i].speed = currentGameSpeed;
}
for (var i = 0; i < clouds.length; i++) {
clouds[i].speed = (1 + Math.random() * 2) * speedMultiplier;
}
for (var i = 0; i < planets.length; i++) {
planets[i].speed = (1 + Math.random() * 2) * speedMultiplier;
}
for (var i = 0; i < bubbles.length; i++) {
bubbles[i].speed = (1 + Math.random() * 2) * speedMultiplier;
}
for (var i = 0; i < skyObstacles.length; i++) {
skyObstacles[i].speed = currentGameSpeed;
}
for (var i = 0; i < flyingItems.length; i++) {
flyingItems[i].speed = currentGameSpeed;
}
// Update and remove volcano projectiles
for (var i = volcanoProjectiles.length - 1; i >= 0; i--) {
var projectile = volcanoProjectiles[i];
if (projectile.y < -100) {
projectile.destroy();
volcanoProjectiles.splice(i, 1);
continue;
}
// Collision detection with player
if (player.intersects(projectile) && !isInvulnerable) {
loseLife();
projectile.destroy();
volcanoProjectiles.splice(i, 1);
if (playerLives <= 0) {
return;
}
}
}
}; ===================================================================
--- original.js
+++ change.js
@@ -862,9 +862,9 @@
}
function spawnFlyingItem() {
var flyingItem = new FlyingItem();
flyingItem.x = 2048 + 200;
- flyingItem.y = 600 + Math.random() * 400; // Random height in middle area
+ flyingItem.y = 800 + Math.random() * 400; // Random height in lower middle area
// Set speed based on current game progress
var speedMultiplier = 1 + Math.floor(distance / 1000) * 0.3;
flyingItem.speed = gameSpeed * speedMultiplier;
flyingItems.push(flyingItem);
portal con manos saliendo de el. In-Game asset. 2d. High contrast. No shadows
piso futurista. In-Game asset. 2d. High contrast. No shadows
modern player of app store icon,only player,in skaetborg. In-Game asset. 2d. High contrast. No shadows
only portal colorido. In-Game asset. 2d. High contrast. No shadows
nube. In-Game asset. 2d. High contrast. No shadows
planeta. In-Game asset. 2d. High contrast. No shadows
pez. In-Game asset. 2d. High contrast. No shadows
burbuja. In-Game asset. 2d. High contrast. No shadows
cohete con ojos y dientes afilados. In-Game asset. 2d. High contrast. No shadows
corazon. In-Game asset. 2d. High contrast. No shadows
sol. In-Game asset. 2d. High contrast. No shadows
bola rodante del desierto. In-Game asset. 2d. High contrast. No shadows
muñeco de nieve. In-Game asset. 2d. High contrast. No shadows
volcan. In-Game asset. 2d. High contrast. No shadows
bola de fuego. In-Game asset. 2d. High contrast. No shadows
icon modern alas. In-Game asset. 2d. High contrast. No shadows
esfera verde. In-Game asset. 2d. High contrast. No shadows
coin. In-Game asset. 2d. High contrast. No shadows
retro pixel ar style 80s
con ropa y pelo de mujer
dulces. In-Game asset. 2d. High contrast. No shadows
paleta. In-Game asset. 2d. High contrast. No shadows
hongo. In-Game asset. 2d. High contrast. No shadows
bus stop. In-Game asset. 2d. High contrast. No shadows
con una medusa en la cabeza y traje de buzo