User prompt
The goal of the game is to climb upwards. Therefore, the score needs to climb high enough to reach 500,000. You should make the level longer so it can be played for a long time.
User prompt
Design it so that it can climb up infinitely. A constantly jumping character will not require the player to jump extra. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
The player is falling from the ground you have made right now, so you have made it passable, fix that.
User prompt
jump higher
User prompt
The game will be a mobile game so it should be in 16:9 aspect ratio. The floors to be jumped are wider and larger, the jumping character is larger, and when the game starts, the first floor will be permanently wide.
User prompt
Instead of falling down at the beginning, the ground will be wide so the player can start whenever he wants
User prompt
make start base. so player when jump first floor game will start
Code edit (1 edits merged)
Please save this source code
User prompt
Sky Jumper Tower
Initial prompt
icy tower game, its climbing tower game. but character jump automaticly jump always and player only move to left and right. when makes perfect jump it boots jump distance and make combos.
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var Platform = Container.expand(function () {
var self = Container.call(this);
var platformGraphics = self.attachAsset('platform', {
anchorX: 0.5,
anchorY: 0.5
});
var centerZone = self.attachAsset('platformCenter', {
anchorX: 0.5,
anchorY: 0.5,
alpha: 0.7
});
self.width = 400;
self.centerZoneWidth = 120;
self.isPerfectLanding = function (playerX) {
var platformCenterX = self.x;
var distance = Math.abs(playerX - platformCenterX);
return distance <= self.centerZoneWidth / 2;
};
return self;
});
var Player = Container.expand(function () {
var self = Container.call(this);
var playerGraphics = self.attachAsset('player', {
anchorX: 0.5,
anchorY: 0.5
});
self.velocityX = 0;
self.velocityY = 0;
self.isJumping = false;
self.jumpForce = -35;
self.gravity = 1.2;
self.moveSpeed = 8;
self.baseJumpForce = -35;
self.jump = function (multiplier) {
if (multiplier === undefined) multiplier = 1;
self.velocityY = self.baseJumpForce * multiplier;
self.isJumping = true;
LK.getSound('jump').play();
};
self.update = function () {
// Apply horizontal movement
self.x += self.velocityX;
// Apply gravity and vertical movement
self.velocityY += self.gravity;
self.y += self.velocityY;
// Horizontal drag
self.velocityX *= 0.85;
// Keep player within screen bounds horizontally
if (self.x < 60) {
self.x = 60;
self.velocityX = 0;
} else if (self.x > 1988) {
self.x = 1988;
self.velocityX = 0;
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB
});
/****
* Game Code
****/
var player = game.addChild(new Player());
var platforms = [];
var camera = {
y: 0
};
var combo = 0;
var maxCombo = 0;
var jumpTimer = 0;
var autoJumpInterval = 90; // Auto jump every 1.5 seconds at 60fps
var platformSpacing = 300;
var nextPlatformY = -platformSpacing;
var gameHeight = 2732;
var lastPlatformLanded = null;
var gameStarted = false;
// UI Elements
var scoreText = new Text2('Height: 0', {
size: 60,
fill: 0xFFFFFF
});
scoreText.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreText);
var comboText = new Text2('', {
size: 50,
fill: 0xFFD700
});
comboText.anchor.set(0.5, 0);
comboText.y = 80;
LK.gui.top.addChild(comboText);
// Initialize player position
player.x = 1024;
player.y = gameHeight - 200;
// Create initial platforms
function createPlatform(y) {
var platform = new Platform();
platform.x = Math.random() * (2048 - 800) + 400;
platform.y = y;
platforms.push(platform);
game.addChild(platform);
}
// Create permanently wide starting ground platform
var startingPlatform = new Platform();
startingPlatform.x = 1024; // Center of screen
startingPlatform.y = gameHeight - 100;
// Make the starting platform span almost full screen width
startingPlatform.scaleX = 5; // Make it 5 times wider (2000px wide)
startingPlatform.width = 2000; // Update logical width for collision detection
startingPlatform.centerZoneWidth = 600; // Make center zone proportionally larger
platforms.push(startingPlatform);
game.addChild(startingPlatform);
// Create initial platforms above
for (var i = 1; i <= 8; i++) {
createPlatform(gameHeight - 100 - platformSpacing * i);
}
function updateCamera() {
var targetY = Math.max(0, player.y - gameHeight * 0.7);
camera.y += (targetY - camera.y) * 0.1;
game.y = -camera.y;
}
function generateNewPlatforms() {
while (nextPlatformY > camera.y - gameHeight) {
createPlatform(nextPlatformY);
nextPlatformY -= platformSpacing + Math.random() * 100 - 50;
}
}
function removeOldPlatforms() {
for (var i = platforms.length - 1; i >= 0; i--) {
var platform = platforms[i];
if (platform.y > camera.y + gameHeight + 500) {
platform.destroy();
platforms.splice(i, 1);
}
}
}
function checkPlatformCollisions() {
if (player.velocityY <= 0) return;
for (var i = 0; i < platforms.length; i++) {
var platform = platforms[i];
// Check if player is falling and intersects with platform
if (player.intersects(platform) && player.y < platform.y + 30 && player.y > platform.y - 60) {
// Landing on platform
player.y = platform.y - 60;
player.velocityY = 0;
player.isJumping = false;
// Check for perfect landing
if (platform.isPerfectLanding(player.x) && platform !== lastPlatformLanded) {
combo++;
maxCombo = Math.max(maxCombo, combo);
LK.getSound('perfectLanding').play();
// Visual feedback for perfect landing
tween(platform, {
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 200,
easing: tween.easeOut
});
tween(platform, {
scaleX: 1,
scaleY: 1
}, {
duration: 200,
easing: tween.easeIn
});
// Update combo display
comboText.setText('Combo: ' + combo + 'x');
if (combo > 1) {
tween(comboText, {
scaleX: 1.3,
scaleY: 1.3
}, {
duration: 150
});
tween(comboText, {
scaleX: 1,
scaleY: 1
}, {
duration: 150
});
}
} else if (platform !== lastPlatformLanded) {
// Break combo on non-perfect landing
if (combo > 0) {
combo = 0;
comboText.setText('');
LK.getSound('comboBreak').play();
}
}
lastPlatformLanded = platform;
return true;
}
}
return false;
}
function handleInput(x, y) {
// Start game with first input if not started yet
if (!gameStarted && !player.isJumping) {
gameStarted = true;
player.jump();
jumpTimer = 0;
}
var centerX = 1024;
var inputForce = 15;
if (x < centerX) {
player.velocityX = -inputForce;
} else {
player.velocityX = inputForce;
}
}
game.down = function (x, y, obj) {
handleInput(x, y);
};
game.move = function (x, y, obj) {
handleInput(x, y);
};
game.update = function () {
if (gameStarted) {
jumpTimer++;
// Auto jump at intervals
if (jumpTimer >= autoJumpInterval && !player.isJumping) {
var jumpMultiplier = 1 + combo * 0.3;
player.jump(jumpMultiplier);
jumpTimer = 0;
}
}
// Check platform collisions
checkPlatformCollisions();
// Update camera
updateCamera();
// Generate new platforms
generateNewPlatforms();
// Remove old platforms
removeOldPlatforms();
// Update score based on height
var height = Math.max(0, Math.floor((gameHeight - player.y) / 10));
LK.setScore(height + maxCombo * 100);
scoreText.setText('Height: ' + height);
// Check game over
if (player.y > camera.y + gameHeight + 200) {
LK.showGameOver();
}
}; ===================================================================
--- original.js
+++ change.js
@@ -148,9 +148,9 @@
}
}
}
function checkPlatformCollisions() {
- if (player.velocityY <= 0 || player.isJumping) return;
+ if (player.velocityY <= 0) return;
for (var i = 0; i < platforms.length; i++) {
var platform = platforms[i];
// Check if player is falling and intersects with platform
if (player.intersects(platform) && player.y < platform.y + 30 && player.y > platform.y - 60) {