User prompt
Has una animación a los botones: derecha, izquierda,correr, saltar ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Has que los botones sean más fáciles de tocar osea más grandes la hitbox
User prompt
Agranda los botones y añade el botón de correr
User prompt
Has que cuando el personaje camine la animacion sea mas lenta ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Has una animación para cuando el jugador camina ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Hasme una animación para el jugador de: caída, salto, y estático ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Has que la música suene en el juego
User prompt
Has que cuando el jugador agarre el power up de caída lenta le aparezca un paracaídas más grande que el jugador ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Has que si el personaje va a la derecha se voltee el Sprite a la derecha y si va a la izquierda se voltee hacia la izquierda
User prompt
Please fix the bug: 'ReferenceError: tween is not defined' in or related to this line: 'tween(powerupGraphics, {' Line Number: 223 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Hasme un power up de caída lenta ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Has que el power up de salto tenga una probabilidad del 7% de probabilidad en cada plataforma
User prompt
Añade un power up para que tengas más poder de salto
User prompt
Has que estén ramdomizados las plataformas
User prompt
Has que las plataformas no aparezcan en el mismo lado en todos los niveles
User prompt
Numera las plataformas del uno al 15 y cuando llegues al 15 pases de nivel, hasme que cuando pases de la cámara la camara te siga
User prompt
Has que cuando llegues al la última plataforma pases de nivel
User prompt
Has que cuando llegues al último bloque pases al siguiente nivel
User prompt
Has que el jugador sea más grande y tenga una hitbox más grande
User prompt
Has el nivel más largo
User prompt
Has que camine más rápido
User prompt
Has que salte menos
User prompt
No salta
User prompt
Has que salte más
User prompt
El jugador no puede saltar al parecer salta muy poco
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var ControlButton = Container.expand(function (type) {
var self = Container.call(this);
self.buttonType = type;
self.isPressed = false;
var buttonGraphics;
if (type === 'jump') {
buttonGraphics = self.attachAsset('jumpButton', {
anchorX: 0.5,
anchorY: 0.5
});
} else {
buttonGraphics = self.attachAsset(type === 'left' ? 'leftButton' : 'rightButton', {
anchorX: 0.5,
anchorY: 0.5
});
}
self.down = function (x, y, obj) {
self.isPressed = true;
buttonGraphics.alpha = 0.7;
};
self.up = function (x, y, obj) {
self.isPressed = false;
buttonGraphics.alpha = 1.0;
};
return self;
});
var Platform = Container.expand(function (width, height, number) {
var self = Container.call(this);
self.platformWidth = width || 300;
self.platformHeight = height || 40;
self.platformNumber = number || 0;
var platformGraphics = self.attachAsset('platform', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: self.platformWidth / 300,
scaleY: self.platformHeight / 40
});
// Add number text if platform has a number
if (self.platformNumber > 0) {
var numberText = new Text2(self.platformNumber.toString(), {
size: 30,
fill: 0x000000
});
numberText.anchor.set(0.5, 0.5);
self.addChild(numberText);
}
return self;
});
var Player = Container.expand(function () {
var self = Container.call(this);
var playerGraphics = self.attachAsset('player', {
anchorX: 0.5,
anchorY: 1.0
});
self.velocityX = 0;
self.velocityY = 0;
self.speed = 12;
self.jumpPower = 30;
self.baseJumpPower = 30;
self.powerUpJumpPower = 45;
self.powerUpActive = false;
self.powerUpTimer = 0;
self.slowFallActive = false;
self.slowFallTimer = 0;
self.gravity = 0.8;
self.baseGravity = 0.8;
self.slowFallGravity = 0.25;
self.onGround = false;
self.parachute = null;
self.maxFallSpeed = 15;
self.moveLeft = function () {
self.velocityX = -self.speed;
};
self.moveRight = function () {
self.velocityX = self.speed;
};
self.jump = function () {
if (self.onGround) {
self.velocityY = -self.jumpPower;
self.onGround = false;
}
};
self.stopHorizontalMovement = function () {
self.velocityX = 0;
};
self.collectPowerUp = function () {
self.powerUpActive = true;
self.powerUpTimer = 600; // 10 seconds at 60fps
self.jumpPower = self.powerUpJumpPower;
// Flash player green to show power-up is active
LK.effects.flashObject(self, 0x00ff00, 300);
};
self.collectSlowFallPowerUp = function () {
self.slowFallActive = true;
self.slowFallTimer = 480; // 8 seconds at 60fps
self.gravity = self.slowFallGravity;
// Flash player blue to show slow fall is active
LK.effects.flashObject(self, 0x3498db, 300);
// Add gentle blue tint while active
tween(playerGraphics, {
tint: 0xadd8e6
}, {
duration: 300,
easing: tween.easeOut
});
// Create parachute
self.parachute = LK.getAsset('parachute', {
anchorX: 0.5,
anchorY: 1.0,
alpha: 0
});
self.addChild(self.parachute);
self.parachute.x = 0;
self.parachute.y = -200; // Position above player
// Animate parachute appearing
tween(self.parachute, {
alpha: 0.8,
y: -180
}, {
duration: 500,
easing: tween.easeOut
});
};
self.update = function () {
// Apply gravity
self.velocityY += self.gravity;
// Limit fall speed
if (self.velocityY > self.maxFallSpeed) {
self.velocityY = self.maxFallSpeed;
}
// Update position
self.x += self.velocityX;
self.y += self.velocityY;
// Flip sprite based on movement direction
if (self.velocityX > 0) {
// Moving right - face right (normal)
playerGraphics.scaleX = Math.abs(playerGraphics.scaleX);
} else if (self.velocityX < 0) {
// Moving left - face left (flipped)
playerGraphics.scaleX = -Math.abs(playerGraphics.scaleX);
}
// Keep player within screen bounds horizontally
if (self.x < 90) {
self.x = 90;
}
if (self.x > 1958) {
self.x = 1958;
}
// Handle power-up timer
if (self.powerUpActive) {
self.powerUpTimer--;
if (self.powerUpTimer <= 0) {
self.powerUpActive = false;
self.jumpPower = self.baseJumpPower;
// Flash player red to show power-up expired
LK.effects.flashObject(self, 0xff0000, 200);
}
}
// Handle slow fall timer
if (self.slowFallActive) {
self.slowFallTimer--;
if (self.slowFallTimer <= 0) {
self.slowFallActive = false;
self.gravity = self.baseGravity;
// Flash player red to show slow fall expired and remove tint
LK.effects.flashObject(self, 0xff0000, 200);
tween(playerGraphics, {
tint: 0xffffff
}, {
duration: 300,
easing: tween.easeOut
});
// Remove parachute with animation
if (self.parachute) {
tween(self.parachute, {
alpha: 0,
y: -220
}, {
duration: 300,
easing: tween.easeIn,
onFinish: function onFinish() {
if (self.parachute) {
self.removeChild(self.parachute);
self.parachute = null;
}
}
});
}
}
}
// Reset onGround flag
self.onGround = false;
};
return self;
});
var PowerUp = Container.expand(function () {
var self = Container.call(this);
self.collected = false;
var powerupGraphics = self.attachAsset('powerup', {
anchorX: 0.5,
anchorY: 0.5
});
// Add visual indicator (star symbol)
var starText = new Text2('★', {
size: 30,
fill: 0xFFFFFF
});
starText.anchor.set(0.5, 0.5);
self.addChild(starText);
// Floating animation
self.floatOffset = 0;
self.update = function () {
// Create floating effect
self.floatOffset += 0.1;
powerupGraphics.y = Math.sin(self.floatOffset) * 10;
starText.y = Math.sin(self.floatOffset) * 10;
// Rotate the star
starText.rotation += 0.05;
};
return self;
});
var SlowFallPowerUp = Container.expand(function () {
var self = Container.call(this);
self.collected = false;
var powerupGraphics = self.attachAsset('slowfallpowerup', {
anchorX: 0.5,
anchorY: 0.5
});
// Tint it blue to distinguish from jump power-up
powerupGraphics.tint = 0x3498db;
// Add visual indicator (feather symbol)
var featherText = new Text2('🪶', {
size: 30,
fill: 0xFFFFFF
});
featherText.anchor.set(0.5, 0.5);
self.addChild(featherText);
// Floating animation with slower movement
self.floatOffset = 0;
self.update = function () {
// Create gentle floating effect
self.floatOffset += 0.05;
var floatY = Math.sin(self.floatOffset) * 15;
powerupGraphics.y = floatY;
featherText.y = floatY;
// Gentle rotation
featherText.rotation += 0.02;
// Subtle pulsing effect using tween
if (LK.ticks % 120 === 0) {
tween(powerupGraphics, {
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 600,
easing: tween.easeInOut
});
tween(powerupGraphics, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 600,
easing: tween.easeInOut
});
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87ceeb
});
/****
* Game Code
****/
var currentLevel = 1;
var player = game.addChild(new Player());
player.x = 1024;
player.y = 2500;
var platforms = [];
var powerUps = [];
var slowFallPowerUps = [];
var ground = game.addChild(LK.getAsset('ground', {
anchorX: 0.5,
anchorY: 1.0
}));
ground.x = 1024;
ground.y = 2732;
// Create platforms with numbers 1-15
var platformData = [{
x: 400,
y: 2400,
width: 200,
number: 1
}, {
x: 800,
y: 2200,
width: 250,
number: 2
}, {
x: 1200,
y: 2000,
width: 200,
number: 3
}, {
x: 600,
y: 1800,
width: 300,
number: 4
}, {
x: 1400,
y: 1600,
width: 200,
number: 5
}, {
x: 300,
y: 1400,
width: 250,
number: 6
}, {
x: 1000,
y: 1200,
width: 300,
number: 7
}, {
x: 1600,
y: 1000,
width: 200,
number: 8
}, {
x: 400,
y: 800,
width: 250,
number: 9
}, {
x: 1200,
y: 600,
width: 200,
number: 10
}, {
x: 800,
y: 400,
width: 300,
number: 11
}, {
x: 500,
y: 200,
width: 180,
number: 12
}, {
x: 1400,
y: 100,
width: 220,
number: 13
}, {
x: 200,
y: -100,
width: 250,
number: 14
}, {
x: 1000,
y: -300,
width: 200,
number: 15
}];
function createLevel(levelNumber) {
// Clear existing platforms
for (var i = platforms.length - 1; i >= 0; i--) {
platforms[i].destroy();
}
platforms = [];
// Clear existing power-ups
for (var i = powerUps.length - 1; i >= 0; i--) {
powerUps[i].destroy();
}
powerUps = [];
// Clear existing slow fall power-ups
for (var i = slowFallPowerUps.length - 1; i >= 0; i--) {
slowFallPowerUps[i].destroy();
}
slowFallPowerUps = [];
// Generate new platform layout for each level
var baseY = 2400;
var yStep = 200;
for (var i = 0; i < 15; i++) {
var platformNumber = i + 1;
var platform = game.addChild(new Platform(Math.max(150, 250 - (levelNumber - 1) * 10), 40, platformNumber));
// Completely randomize platform positions
var minX = 200; // Minimum distance from left edge
var maxX = 1848; // Maximum distance from right edge (accounting for platform width)
var randomX = minX + Math.random() * (maxX - minX);
platform.x = randomX;
platform.y = baseY - i * yStep;
platforms.push(platform);
// Spawn power-up randomly on some platforms (7% chance)
if (Math.random() < 0.07 && platformNumber !== 1 && platformNumber !== 15) {
var powerUp = game.addChild(new PowerUp());
powerUp.x = platform.x;
powerUp.y = platform.y - 60; // Position above platform
powerUps.push(powerUp);
}
// Spawn slow fall power-up randomly on some platforms (7% chance)
if (Math.random() < 0.07 && platformNumber !== 1 && platformNumber !== 15) {
var slowFallPowerUp = game.addChild(new SlowFallPowerUp());
slowFallPowerUp.x = platform.x + 50; // Offset slightly to avoid overlap
slowFallPowerUp.y = platform.y - 60; // Position above platform
slowFallPowerUps.push(slowFallPowerUp);
}
}
}
// Create initial level
createLevel(currentLevel);
// Control buttons
var leftButton = LK.gui.bottomLeft.addChild(new ControlButton('left'));
leftButton.x = 80;
leftButton.y = -80;
var rightButton = LK.gui.bottomLeft.addChild(new ControlButton('right'));
rightButton.x = 220;
rightButton.y = -80;
var jumpButton = LK.gui.bottomRight.addChild(new ControlButton('jump'));
jumpButton.x = -80;
jumpButton.y = -80;
// Control button labels
var leftLabel = new Text2('←', {
size: 60,
fill: 0xFFFFFF
});
leftLabel.anchor.set(0.5, 0.5);
leftButton.addChild(leftLabel);
var rightLabel = new Text2('→', {
size: 60,
fill: 0xFFFFFF
});
rightLabel.anchor.set(0.5, 0.5);
rightButton.addChild(rightLabel);
var jumpLabel = new Text2('↑', {
size: 60,
fill: 0xFFFFFF
});
jumpLabel.anchor.set(0.5, 0.5);
jumpButton.addChild(jumpLabel);
// Level display
var levelText = new Text2('Level ' + currentLevel, {
size: 80,
fill: 0xFFFFFF
});
levelText.anchor.set(0.5, 0);
LK.gui.top.addChild(levelText);
levelText.y = 120; // Position below the top menu
// Power-up status display
var powerUpText = new Text2('', {
size: 40,
fill: 0xf39c12
});
powerUpText.anchor.set(0.5, 0);
LK.gui.top.addChild(powerUpText);
powerUpText.y = 200;
// Slow fall status display
var slowFallText = new Text2('', {
size: 40,
fill: 0x3498db
});
slowFallText.anchor.set(0.5, 0);
LK.gui.top.addChild(slowFallText);
slowFallText.y = 250;
function checkCollisions() {
var playerBottom = player.y;
var playerTop = player.y - 180;
var playerLeft = player.x - 90;
var playerRight = player.x + 90;
// Check ground collision
if (playerBottom >= ground.y - 50) {
if (player.velocityY > 0) {
player.y = ground.y - 50;
player.velocityY = 0;
player.onGround = true;
}
}
// Check platform collisions
for (var i = 0; i < platforms.length; i++) {
var platform = platforms[i];
var platformLeft = platform.x - platform.platformWidth / 2;
var platformRight = platform.x + platform.platformWidth / 2;
var platformTop = platform.y - platform.platformHeight / 2;
var platformBottom = platform.y + platform.platformHeight / 2;
// Check if player is horizontally aligned with platform
if (playerRight > platformLeft && playerLeft < platformRight) {
// Check if player is falling onto platform from above
if (player.velocityY > 0 && playerBottom >= platformTop && playerTop < platformTop) {
player.y = platformTop;
player.velocityY = 0;
player.onGround = true;
}
}
}
// Check power-up collisions
for (var i = powerUps.length - 1; i >= 0; i--) {
var powerUp = powerUps[i];
if (!powerUp.collected) {
var powerUpLeft = powerUp.x - 20;
var powerUpRight = powerUp.x + 20;
var powerUpTop = powerUp.y - 20;
var powerUpBottom = powerUp.y + 20;
// Check if player intersects with power-up
if (playerRight > powerUpLeft && playerLeft < powerUpRight && playerBottom > powerUpTop && playerTop < powerUpBottom) {
powerUp.collected = true;
player.collectPowerUp();
powerUp.destroy();
powerUps.splice(i, 1);
}
}
}
// Check slow fall power-up collisions
for (var i = slowFallPowerUps.length - 1; i >= 0; i--) {
var slowFallPowerUp = slowFallPowerUps[i];
if (!slowFallPowerUp.collected) {
var slowFallLeft = slowFallPowerUp.x - 20;
var slowFallRight = slowFallPowerUp.x + 20;
var slowFallTop = slowFallPowerUp.y - 20;
var slowFallBottom = slowFallPowerUp.y + 20;
// Check if player intersects with slow fall power-up
if (playerRight > slowFallLeft && playerLeft < slowFallRight && playerBottom > slowFallTop && playerTop < slowFallBottom) {
slowFallPowerUp.collected = true;
player.collectSlowFallPowerUp();
slowFallPowerUp.destroy();
slowFallPowerUps.splice(i, 1);
}
}
}
}
game.update = function () {
// Check collisions first to set onGround flag
checkCollisions();
// Handle input
if (leftButton.isPressed) {
player.moveLeft();
} else if (rightButton.isPressed) {
player.moveRight();
} else {
player.stopHorizontalMovement();
}
if (jumpButton.isPressed) {
player.jump();
}
// Update power-up display
if (player.powerUpActive) {
var secondsLeft = Math.ceil(player.powerUpTimer / 60);
powerUpText.setText('★ Super Jump: ' + secondsLeft + 's');
} else {
powerUpText.setText('');
}
// Update slow fall display
if (player.slowFallActive) {
var secondsLeft = Math.ceil(player.slowFallTimer / 60);
slowFallText.setText('🪶 Slow Fall: ' + secondsLeft + 's');
} else {
slowFallText.setText('');
}
// Camera follows player
var targetY = -player.y + 1366; // Center player vertically on screen
game.y = targetY;
// Check if player reached platform 15
var platform15 = null;
for (var i = 0; i < platforms.length; i++) {
if (platforms[i].platformNumber === 15) {
platform15 = platforms[i];
break;
}
}
if (platform15) {
var playerBottom = player.y;
var playerLeft = player.x - 90;
var playerRight = player.x + 90;
var platform15Left = platform15.x - platform15.platformWidth / 2;
var platform15Right = platform15.x + platform15.platformWidth / 2;
var platform15Top = platform15.y - platform15.platformHeight / 2;
// Check if player is on platform 15
if (playerRight > platform15Left && playerLeft < platform15Right && playerBottom >= platform15Top && playerBottom <= platform15Top + 50) {
// Player reached platform 15 - advance to next level
currentLevel++;
if (currentLevel > 10) {
// After 10 levels, show you win
LK.showYouWin();
} else {
// Create next level
createLevel(currentLevel);
levelText.setText('Level ' + currentLevel);
// Reset player position for new level
player.x = 1024;
player.y = 2500;
player.velocityX = 0;
player.velocityY = 0;
// Flash screen green to indicate level completion
LK.effects.flashScreen(0x00ff00, 500);
}
}
}
// Check if player fell off screen
if (player.y > 2800) {
// Reset player position
player.x = 1024;
player.y = 2500;
player.velocityX = 0;
player.velocityY = 0;
}
};
// Play background music
LK.playMusic('Musica'); ===================================================================
--- original.js
+++ change.js
@@ -613,5 +613,7 @@
player.y = 2500;
player.velocityX = 0;
player.velocityY = 0;
}
-};
\ No newline at end of file
+};
+// Play background music
+LK.playMusic('Musica');
\ No newline at end of file
Poder de saltó. In-Game asset. 2d. High contrast. No shadows
Slow fall. In-Game asset. 2d. High contrast. No shadows
Paracaídas. In-Game asset. 2d. High contrast. No shadows
Flecha hacia la derecha. In-Game asset. 2d. High contrast. No shadows
Botas de super salto. In-Game asset. 2d. High contrast. No shadows
Cubo de slime con cara feliz. In-Game asset. 2d. High contrast. No shadows