User prompt
coin logic still doesn't work properly please review it and make it like it would be in icy tower
User prompt
problem with the coins remains, one cannot collect the coins after the first one as they move with the screen
User prompt
coins should appear on platforms and than disappear with the platform if not collected. right now they remain on the screen until they are collected
User prompt
there is a problem with the coin logic please fix it
User prompt
add some coins to be collected on platforms with different values keep score of the coins as well as the score of platforms passed. these scores should appear on the screen separately
User prompt
when the chracter hits the walls it should jump twice as it would jump normally
User prompt
Please fix the bug: 'TypeError: tween.to is not a function' in or related to this line: 'tween.to(pGfx, {' Line Number: 478 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
each time the character jumps add a jumping animation to him like raise it hands and make a facial expression, also when it hits the walls it should rotate like tumble
User prompt
keep the vertical distance between platforms the same, all levels should last 20 platforms
User prompt
don't place the platforms vertically away from each other as the level increases only increase the horizontal distance between them
User prompt
no make every level the same platform number (20)
User prompt
first level lasts for more than 20 platforms
User prompt
make the level system every 20 platform and also increase the hardness by placing the platforms a bit more away from each other to make it harder to jump from one to another slowly in each level
User prompt
make the game a bit harder in each level, increase the number of levels to 10 and add some assets so that I can add more images for next levels
User prompt
sometimes the chracter does not jump to the next platform even in animation it should land on it, it falls down the platform below, please fix this bug
User prompt
every level should last until the character remains in game for 50 platforms
User prompt
there should be 3 levels and in every level platforms should change. level 1 chipwhite level 2 chipgreen and level 3 chiporange
User prompt
name caserect as chipwhite and chipwhite as chiporange
User prompt
mkae the platforms shape change every 50 platform
User prompt
In assets I should only see chipBlue as the character and platform names
User prompt
platforms are still so small in height make them bigger in height and also increase the spacing between them
User prompt
make platforms a bit bigger and wider than each other
User prompt
beggining has some problems
User prompt
preserve the platform image aspect ratio
User prompt
let's count how many platforms passed as the score on top right of the screen
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ // PokerChip class: draggable, rotatable, circular var PokerChip = Container.expand(function () { var self = Container.call(this); // Asset id and color are passed in self.assetId = self.assetId || 'chipRed'; var chip = self.attachAsset(self.assetId, { anchorX: 0.5, anchorY: 0.5 }); // For rotation handle var handle = self.attachAsset('chipWhite', { anchorX: 0.5, anchorY: 0.5, scaleX: 0.18, scaleY: 0.18, y: -chip.height / 2 - 40 }); handle.alpha = 0.7; // For drag/rotate state self.isDragging = false; self.isRotating = false; self.dragOffsetX = 0; self.dragOffsetY = 0; self.startAngle = 0; self.startRotation = 0; // For hit testing self.radius = chip.width / 2; // Used to distinguish between drag and rotate self.down = function (x, y, obj) { var local = self.toLocal({ x: x, y: y }); // If touch is on handle, start rotating var dx = local.x - handle.x; var dy = local.y - handle.y; if (dx * dx + dy * dy < handle.width / 2 * (handle.width / 2)) { self.isRotating = true; // Angle from center to pointer var cx = self.x, cy = self.y; self.startAngle = Math.atan2(y - cy, x - cx); self.startRotation = self.rotation; } else { // Otherwise, start dragging self.isDragging = true; self.dragOffsetX = x - self.x; self.dragOffsetY = y - self.y; } // Bring to front if (self.parent) { self.parent.setChildIndex(self, self.parent.children.length - 1); } }; self.up = function (x, y, obj) { self.isDragging = false; self.isRotating = false; }; // No per-chip move handler; handled globally return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x18181b }); /**** * Game Code ****/ // --- Icy Tower Constants --- var highScore = storage.highScore || 0; var GAME_W = 2048; var GAME_H = 2732; var PLATFORM_W = 400; var PLATFORM_H = 40; var PLAYER_W = 120; var PLAYER_H = 120; var GRAVITY = 2.2; var JUMP_VELOCITY = -48; var MOVE_SPEED = 22; var PLATFORM_SPACING_MIN = 220; var PLATFORM_SPACING_MAX = 340; var PLATFORM_X_MARGIN = 120; var CAMERA_OFFSET = 900; // How far from bottom the player is kept // --- State --- var platforms = []; var player = null; var vy = 0; var vx = 0; var isJumping = false; var isTouching = false; var touchStartX = 0; var cameraY = 0; var maxHeight = 0; var gameOver = false; // --- Assets --- var playerAsset = LK.getAsset('chipBlue', { anchorX: 0.5, anchorY: 1, scaleX: PLAYER_W / 320, scaleY: PLAYER_H / 320 }); // Level themes: background color and platform asset per level // Platform color is always high-contrast with background for visibility var LEVEL_THEMES = [{ bg: 0x18181b, platformAsset: 'caseRect', platformColor: 0xfacc15 // bright yellow on dark bg }, { bg: 0x1e293b, platformAsset: 'chipGreen', platformColor: 0xf1f5f9 // white on blue bg }, { bg: 0x312e81, platformAsset: 'chipPurple', platformColor: 0xfacc15 // yellow on purple bg }, { bg: 0x7c2d12, platformAsset: 'chipRed', platformColor: 0xf1f5f9 // white on brown bg }, { bg: 0xfbbf24, platformAsset: 'chipYellow', platformColor: 0x22272b // dark on bright yellow bg }, { bg: 0xf1f5f9, platformAsset: 'chipWhite', platformColor: 0x22272b // dark on white bg }]; // Helper to get current theme index based on score/level function getThemeIndex(score) { return Math.floor(score / 100) % LEVEL_THEMES.length; } // Helper to get current theme object function getCurrentTheme(score) { return LEVEL_THEMES[getThemeIndex(score)]; } // Used for initial platform asset (will be replaced in createPlatform) var platformAsset = LK.getAsset('caseRect', { anchorX: 0.5, anchorY: 0.5, scaleX: PLATFORM_W / 1100, scaleY: PLATFORM_H / 700 }); // --- UI --- // Platform pass counter var platformsPassed = 0; // Score text (platforms passed) - top right var scoreTxt = new Text2('0', { size: 90, fill: 0xffffff }); scoreTxt.anchor.set(1, 0); // right aligned scoreTxt.x = GAME_W - 60; scoreTxt.y = 60; LK.gui.top.addChild(scoreTxt); var highScoreTxt = new Text2('Best: ' + highScore, { size: 60, fill: 0xfacc15 }); highScoreTxt.anchor.set(1, 0); highScoreTxt.x = GAME_W - 60; highScoreTxt.y = 160; LK.gui.top.addChild(highScoreTxt); // --- Helper: create a platform at (x, y) --- function createPlatform(x, y, width) { var plat = new Container(); var w = width || PLATFORM_W; // Determine theme based on current score (or maxHeight for new platforms) var score = Math.floor(maxHeight / 10) || 0; var theme = getCurrentTheme(score); var assetId = theme.platformAsset; var platformColor = theme.platformColor; var platGfx = plat.attachAsset(assetId, { anchorX: 0.5, anchorY: 0.5, scaleX: w / 1100, scaleY: PLATFORM_H / 700, color: platformColor }); plat.x = x; plat.y = y; plat.width = w; plat.height = PLATFORM_H; game.addChild(plat); platforms.push(plat); return plat; } // --- Helper: find a safe X for a new platform, given previous platform --- function getSafePlatformX(prevPlat, width) { // Always keep new platform horizontally reachable from previous var minX = Math.max(PLATFORM_X_MARGIN + width / 2, prevPlat ? prevPlat.x - 400 : PLATFORM_X_MARGIN + width / 2); var maxX = Math.min(GAME_W - PLATFORM_X_MARGIN - width / 2, prevPlat ? prevPlat.x + 400 : GAME_W - PLATFORM_X_MARGIN - width / 2); if (minX > maxX) minX = maxX = prevPlat ? prevPlat.x : GAME_W / 2; return minX + Math.random() * (maxX - minX); } // --- Helper: reset game state --- function resetGame() { // Remove old platforms for (var i = 0; i < platforms.length; ++i) { platforms[i].destroy(); } platforms = []; // Remove player if (player) player.destroy(); // Create player player = new Container(); var pGfx = player.attachAsset('chipBlue', { anchorX: 0.5, anchorY: 1, scaleX: PLAYER_W / 320, scaleY: PLAYER_H / 320 }); player.x = GAME_W / 2; player.y = GAME_H - 400; player.width = PLAYER_W; player.height = PLAYER_H; game.addChild(player); vy = 0; vx = 0; isJumping = false; isTouching = false; cameraY = 0; maxHeight = 0; gameOver = false; // Create initial platforms var y = GAME_H - 200; // First platform: centered and wide, guaranteed under player var firstPlat = createPlatform(GAME_W / 2, y); y -= 260; // Consistent spacing for first jump // Place player directly above first platform player.x = firstPlat.x; player.y = firstPlat.y - PLATFORM_H / 2; // Make platforms much wider and closer for easy jumps var EASY_PLATFORM_W = 820; var EASY_PLATFORM_SPACING_MIN = 120; var EASY_PLATFORM_SPACING_MAX = 160; var prevPlat = firstPlat; for (var i = 1; i < 12; ++i) { var px = getSafePlatformX(prevPlat, EASY_PLATFORM_W); var plat = createPlatform(px, y, EASY_PLATFORM_W); plat.width = EASY_PLATFORM_W; plat.children[0].scale.x = EASY_PLATFORM_W / 1100; prevPlat = plat; y -= Math.random() * (EASY_PLATFORM_SPACING_MAX - EASY_PLATFORM_SPACING_MIN) + EASY_PLATFORM_SPACING_MIN; } // Sort platforms by y platforms.sort(function (a, b) { return a.y - b.y; }); // Score platformsPassed = 0; scoreTxt.setText('0'); highScoreTxt.setText('Best: ' + highScore); // Reset theme and background game.lastThemeIndex = -1; game.setBackgroundColor(LEVEL_THEMES[0].bg); } // --- Helper: check collision between player and platform --- function playerOnPlatform() { for (var i = 0; i < platforms.length; ++i) { var plat = platforms[i]; // Only check if player is falling if (vy >= 0) { var px = player.x; var py = player.y; var platTop = plat.y - PLATFORM_H / 2; var platLeft = plat.x - PLATFORM_W / 2; var platRight = plat.x + PLATFORM_W / 2; // Check if player's feet are just above platform if (py >= platTop && py <= platTop + vy + 8) { if (px > platLeft && px < platRight) { return plat; } } } } return null; } // --- Touch controls: left/right jump --- game.down = function (x, y, obj) { if (gameOver) return; isTouching = true; touchStartX = x; // If player is on ground/platform, jump if (!isJumping) { vy = JUMP_VELOCITY; // Direction: left or right half of screen if (x < GAME_W / 2) { vx = -MOVE_SPEED; } else { vx = MOVE_SPEED; } isJumping = true; } }; game.up = function (x, y, obj) { isTouching = false; vx = 0; }; game.move = function (x, y, obj) { // Optionally, allow swiping to control direction if (isTouching && !gameOver) { if (x < GAME_W / 2) { vx = -MOVE_SPEED; } else { vx = MOVE_SPEED; } } }; // --- Main update loop --- game.update = function () { if (gameOver) return; // Physics vy += GRAVITY; player.x += vx; player.y += vy; // Clamp player to screen if (player.x < PLAYER_W / 2) player.x = PLAYER_W / 2; if (player.x > GAME_W - PLAYER_W / 2) player.x = GAME_W - PLAYER_W / 2; // Platform collision var plat = playerOnPlatform(); if (plat && vy > 0) { player.y = plat.y - PLATFORM_H / 2; vy = JUMP_VELOCITY; isJumping = false; } else { isJumping = true; } // Camera follows player upward if (player.y < GAME_H - CAMERA_OFFSET) { var diff = GAME_H - CAMERA_OFFSET - player.y; cameraY += diff; // Move all platforms and player down by diff for (var i = 0; i < platforms.length; ++i) { platforms[i].y += diff; } player.y += diff; maxHeight += diff; } // Always keep player in front of platforms if (player.parent && player.parent.children.indexOf(player) !== player.parent.children.length - 1) { player.parent.setChildIndex(player, player.parent.children.length - 1); } // Remove platforms that are off screen, add new ones at top for (var i = platforms.length - 1; i >= 0; --i) { if (platforms[i].y > GAME_H + 100) { platforms[i].destroy(); platforms.splice(i, 1); platformsPassed++; scoreTxt.setText(platformsPassed.toString()); } } // Add new platforms if needed while (platforms.length < 12) { var topY = platforms[0].y; // Use much easier spacing and width for new platforms var EASY_PLATFORM_W = 820; var EASY_PLATFORM_SPACING_MIN = 120; var EASY_PLATFORM_SPACING_MAX = 160; var newY = topY - Math.random() * (EASY_PLATFORM_SPACING_MAX - EASY_PLATFORM_SPACING_MIN) - EASY_PLATFORM_SPACING_MIN; var prevPlat = platforms[0]; var px = getSafePlatformX(prevPlat, EASY_PLATFORM_W); var plat = createPlatform(px, newY, EASY_PLATFORM_W); platforms.sort(function (a, b) { return a.y - b.y; }); } // Score: based on maxHeight climbed var score = Math.floor(maxHeight / 10); scoreTxt.setText(score.toString()); // Level theme logic removed // High score logic if (score > highScore) { highScore = score; storage.highScore = highScore; highScoreTxt.setText('Best: ' + highScore); } // Game over: fall below screen if (player.y > GAME_H + 200) { gameOver = true; LK.setTimeout(function () { LK.showGameOver(); }, 800); } }; // --- Start game --- resetGame();
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
// PokerChip class: draggable, rotatable, circular
var PokerChip = Container.expand(function () {
var self = Container.call(this);
// Asset id and color are passed in
self.assetId = self.assetId || 'chipRed';
var chip = self.attachAsset(self.assetId, {
anchorX: 0.5,
anchorY: 0.5
});
// For rotation handle
var handle = self.attachAsset('chipWhite', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.18,
scaleY: 0.18,
y: -chip.height / 2 - 40
});
handle.alpha = 0.7;
// For drag/rotate state
self.isDragging = false;
self.isRotating = false;
self.dragOffsetX = 0;
self.dragOffsetY = 0;
self.startAngle = 0;
self.startRotation = 0;
// For hit testing
self.radius = chip.width / 2;
// Used to distinguish between drag and rotate
self.down = function (x, y, obj) {
var local = self.toLocal({
x: x,
y: y
});
// If touch is on handle, start rotating
var dx = local.x - handle.x;
var dy = local.y - handle.y;
if (dx * dx + dy * dy < handle.width / 2 * (handle.width / 2)) {
self.isRotating = true;
// Angle from center to pointer
var cx = self.x,
cy = self.y;
self.startAngle = Math.atan2(y - cy, x - cx);
self.startRotation = self.rotation;
} else {
// Otherwise, start dragging
self.isDragging = true;
self.dragOffsetX = x - self.x;
self.dragOffsetY = y - self.y;
}
// Bring to front
if (self.parent) {
self.parent.setChildIndex(self, self.parent.children.length - 1);
}
};
self.up = function (x, y, obj) {
self.isDragging = false;
self.isRotating = false;
};
// No per-chip move handler; handled globally
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x18181b
});
/****
* Game Code
****/
// --- Icy Tower Constants ---
var highScore = storage.highScore || 0;
var GAME_W = 2048;
var GAME_H = 2732;
var PLATFORM_W = 400;
var PLATFORM_H = 40;
var PLAYER_W = 120;
var PLAYER_H = 120;
var GRAVITY = 2.2;
var JUMP_VELOCITY = -48;
var MOVE_SPEED = 22;
var PLATFORM_SPACING_MIN = 220;
var PLATFORM_SPACING_MAX = 340;
var PLATFORM_X_MARGIN = 120;
var CAMERA_OFFSET = 900; // How far from bottom the player is kept
// --- State ---
var platforms = [];
var player = null;
var vy = 0;
var vx = 0;
var isJumping = false;
var isTouching = false;
var touchStartX = 0;
var cameraY = 0;
var maxHeight = 0;
var gameOver = false;
// --- Assets ---
var playerAsset = LK.getAsset('chipBlue', {
anchorX: 0.5,
anchorY: 1,
scaleX: PLAYER_W / 320,
scaleY: PLAYER_H / 320
});
// Level themes: background color and platform asset per level
// Platform color is always high-contrast with background for visibility
var LEVEL_THEMES = [{
bg: 0x18181b,
platformAsset: 'caseRect',
platformColor: 0xfacc15 // bright yellow on dark bg
}, {
bg: 0x1e293b,
platformAsset: 'chipGreen',
platformColor: 0xf1f5f9 // white on blue bg
}, {
bg: 0x312e81,
platformAsset: 'chipPurple',
platformColor: 0xfacc15 // yellow on purple bg
}, {
bg: 0x7c2d12,
platformAsset: 'chipRed',
platformColor: 0xf1f5f9 // white on brown bg
}, {
bg: 0xfbbf24,
platformAsset: 'chipYellow',
platformColor: 0x22272b // dark on bright yellow bg
}, {
bg: 0xf1f5f9,
platformAsset: 'chipWhite',
platformColor: 0x22272b // dark on white bg
}];
// Helper to get current theme index based on score/level
function getThemeIndex(score) {
return Math.floor(score / 100) % LEVEL_THEMES.length;
}
// Helper to get current theme object
function getCurrentTheme(score) {
return LEVEL_THEMES[getThemeIndex(score)];
}
// Used for initial platform asset (will be replaced in createPlatform)
var platformAsset = LK.getAsset('caseRect', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: PLATFORM_W / 1100,
scaleY: PLATFORM_H / 700
});
// --- UI ---
// Platform pass counter
var platformsPassed = 0;
// Score text (platforms passed) - top right
var scoreTxt = new Text2('0', {
size: 90,
fill: 0xffffff
});
scoreTxt.anchor.set(1, 0); // right aligned
scoreTxt.x = GAME_W - 60;
scoreTxt.y = 60;
LK.gui.top.addChild(scoreTxt);
var highScoreTxt = new Text2('Best: ' + highScore, {
size: 60,
fill: 0xfacc15
});
highScoreTxt.anchor.set(1, 0);
highScoreTxt.x = GAME_W - 60;
highScoreTxt.y = 160;
LK.gui.top.addChild(highScoreTxt);
// --- Helper: create a platform at (x, y) ---
function createPlatform(x, y, width) {
var plat = new Container();
var w = width || PLATFORM_W;
// Determine theme based on current score (or maxHeight for new platforms)
var score = Math.floor(maxHeight / 10) || 0;
var theme = getCurrentTheme(score);
var assetId = theme.platformAsset;
var platformColor = theme.platformColor;
var platGfx = plat.attachAsset(assetId, {
anchorX: 0.5,
anchorY: 0.5,
scaleX: w / 1100,
scaleY: PLATFORM_H / 700,
color: platformColor
});
plat.x = x;
plat.y = y;
plat.width = w;
plat.height = PLATFORM_H;
game.addChild(plat);
platforms.push(plat);
return plat;
}
// --- Helper: find a safe X for a new platform, given previous platform ---
function getSafePlatformX(prevPlat, width) {
// Always keep new platform horizontally reachable from previous
var minX = Math.max(PLATFORM_X_MARGIN + width / 2, prevPlat ? prevPlat.x - 400 : PLATFORM_X_MARGIN + width / 2);
var maxX = Math.min(GAME_W - PLATFORM_X_MARGIN - width / 2, prevPlat ? prevPlat.x + 400 : GAME_W - PLATFORM_X_MARGIN - width / 2);
if (minX > maxX) minX = maxX = prevPlat ? prevPlat.x : GAME_W / 2;
return minX + Math.random() * (maxX - minX);
}
// --- Helper: reset game state ---
function resetGame() {
// Remove old platforms
for (var i = 0; i < platforms.length; ++i) {
platforms[i].destroy();
}
platforms = [];
// Remove player
if (player) player.destroy();
// Create player
player = new Container();
var pGfx = player.attachAsset('chipBlue', {
anchorX: 0.5,
anchorY: 1,
scaleX: PLAYER_W / 320,
scaleY: PLAYER_H / 320
});
player.x = GAME_W / 2;
player.y = GAME_H - 400;
player.width = PLAYER_W;
player.height = PLAYER_H;
game.addChild(player);
vy = 0;
vx = 0;
isJumping = false;
isTouching = false;
cameraY = 0;
maxHeight = 0;
gameOver = false;
// Create initial platforms
var y = GAME_H - 200;
// First platform: centered and wide, guaranteed under player
var firstPlat = createPlatform(GAME_W / 2, y);
y -= 260; // Consistent spacing for first jump
// Place player directly above first platform
player.x = firstPlat.x;
player.y = firstPlat.y - PLATFORM_H / 2;
// Make platforms much wider and closer for easy jumps
var EASY_PLATFORM_W = 820;
var EASY_PLATFORM_SPACING_MIN = 120;
var EASY_PLATFORM_SPACING_MAX = 160;
var prevPlat = firstPlat;
for (var i = 1; i < 12; ++i) {
var px = getSafePlatformX(prevPlat, EASY_PLATFORM_W);
var plat = createPlatform(px, y, EASY_PLATFORM_W);
plat.width = EASY_PLATFORM_W;
plat.children[0].scale.x = EASY_PLATFORM_W / 1100;
prevPlat = plat;
y -= Math.random() * (EASY_PLATFORM_SPACING_MAX - EASY_PLATFORM_SPACING_MIN) + EASY_PLATFORM_SPACING_MIN;
}
// Sort platforms by y
platforms.sort(function (a, b) {
return a.y - b.y;
});
// Score
platformsPassed = 0;
scoreTxt.setText('0');
highScoreTxt.setText('Best: ' + highScore);
// Reset theme and background
game.lastThemeIndex = -1;
game.setBackgroundColor(LEVEL_THEMES[0].bg);
}
// --- Helper: check collision between player and platform ---
function playerOnPlatform() {
for (var i = 0; i < platforms.length; ++i) {
var plat = platforms[i];
// Only check if player is falling
if (vy >= 0) {
var px = player.x;
var py = player.y;
var platTop = plat.y - PLATFORM_H / 2;
var platLeft = plat.x - PLATFORM_W / 2;
var platRight = plat.x + PLATFORM_W / 2;
// Check if player's feet are just above platform
if (py >= platTop && py <= platTop + vy + 8) {
if (px > platLeft && px < platRight) {
return plat;
}
}
}
}
return null;
}
// --- Touch controls: left/right jump ---
game.down = function (x, y, obj) {
if (gameOver) return;
isTouching = true;
touchStartX = x;
// If player is on ground/platform, jump
if (!isJumping) {
vy = JUMP_VELOCITY;
// Direction: left or right half of screen
if (x < GAME_W / 2) {
vx = -MOVE_SPEED;
} else {
vx = MOVE_SPEED;
}
isJumping = true;
}
};
game.up = function (x, y, obj) {
isTouching = false;
vx = 0;
};
game.move = function (x, y, obj) {
// Optionally, allow swiping to control direction
if (isTouching && !gameOver) {
if (x < GAME_W / 2) {
vx = -MOVE_SPEED;
} else {
vx = MOVE_SPEED;
}
}
};
// --- Main update loop ---
game.update = function () {
if (gameOver) return;
// Physics
vy += GRAVITY;
player.x += vx;
player.y += vy;
// Clamp player to screen
if (player.x < PLAYER_W / 2) player.x = PLAYER_W / 2;
if (player.x > GAME_W - PLAYER_W / 2) player.x = GAME_W - PLAYER_W / 2;
// Platform collision
var plat = playerOnPlatform();
if (plat && vy > 0) {
player.y = plat.y - PLATFORM_H / 2;
vy = JUMP_VELOCITY;
isJumping = false;
} else {
isJumping = true;
}
// Camera follows player upward
if (player.y < GAME_H - CAMERA_OFFSET) {
var diff = GAME_H - CAMERA_OFFSET - player.y;
cameraY += diff;
// Move all platforms and player down by diff
for (var i = 0; i < platforms.length; ++i) {
platforms[i].y += diff;
}
player.y += diff;
maxHeight += diff;
}
// Always keep player in front of platforms
if (player.parent && player.parent.children.indexOf(player) !== player.parent.children.length - 1) {
player.parent.setChildIndex(player, player.parent.children.length - 1);
}
// Remove platforms that are off screen, add new ones at top
for (var i = platforms.length - 1; i >= 0; --i) {
if (platforms[i].y > GAME_H + 100) {
platforms[i].destroy();
platforms.splice(i, 1);
platformsPassed++;
scoreTxt.setText(platformsPassed.toString());
}
}
// Add new platforms if needed
while (platforms.length < 12) {
var topY = platforms[0].y;
// Use much easier spacing and width for new platforms
var EASY_PLATFORM_W = 820;
var EASY_PLATFORM_SPACING_MIN = 120;
var EASY_PLATFORM_SPACING_MAX = 160;
var newY = topY - Math.random() * (EASY_PLATFORM_SPACING_MAX - EASY_PLATFORM_SPACING_MIN) - EASY_PLATFORM_SPACING_MIN;
var prevPlat = platforms[0];
var px = getSafePlatformX(prevPlat, EASY_PLATFORM_W);
var plat = createPlatform(px, newY, EASY_PLATFORM_W);
platforms.sort(function (a, b) {
return a.y - b.y;
});
}
// Score: based on maxHeight climbed
var score = Math.floor(maxHeight / 10);
scoreTxt.setText(score.toString());
// Level theme logic removed
// High score logic
if (score > highScore) {
highScore = score;
storage.highScore = highScore;
highScoreTxt.setText('Best: ' + highScore);
}
// Game over: fall below screen
if (player.y > GAME_H + 200) {
gameOver = true;
LK.setTimeout(function () {
LK.showGameOver();
}, 800);
}
};
// --- Start game ---
resetGame();
icy tower guy. In-Game asset. 2d. High contrast. No shadows
mario or icy tower like platforms. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
icy tower advanced level platform. In-Game asset. 2d. High contrast. No shadows
diamond. In-Game asset. 2d. High contrast. No shadows
dollar. In-Game asset. 2d. High contrast. No shadows
Design a single floating 2D game platform made of levitating crystal shards, connected by glowing magical runes or light energy. No ice or snow. The platform should feel arcane and unique. No background.. In-Game asset. 2d. High contrast. No shadows
rectangle shape jumping platform for a simple 2D game. In-Game asset. 2d. High contrast. No shadows
super mario facing camera. In-Game asset. 2d. High contrast. No shadows
blue transparent cloud. In-Game asset. 2d. High contrast. No shadows
bright transparent cloud. In-Game asset. 2d. High contrast. No shadows
fluffy transparent cloud. In-Game asset. 2d. High contrast. No shadows
orange transparent cloud. In-Game asset. 2d. High contrast. No shadows
grey transparent cloud. In-Game asset. 2d. High contrast. No shadows
star. In-Game asset. 2d. High contrast. No shadows
icy tower background without platforms, just walls. In-Game asset. 2d. High contrast. No shadows
just a start line without any text. In-Game asset. 2d. High contrast. No shadows
stuart little jumping and raised its arms. In-Game asset. 2d. High contrast. No shadows. facing camera
shout
Sound effect
fall
Sound effect
darara
Music
garavel-1
Sound effect
garavel-2
Sound effect
garavel-3
Sound effect
garavel-4
Sound effect
garavel-5
Sound effect
death-1
Sound effect
death-2
Sound effect
opening-sound
Sound effect
opening-music
Music
game-theme-song-1
Music
game-theme-song-2
Music
game-theme-song-3
Music
game-theme-song-4
Music