/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Exit = Container.expand(function () { var self = Container.call(this); var exitGraphics = self.attachAsset('exit', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Glow effect var alpha = 0.7 + Math.sin(LK.ticks * 0.05) * 0.3; exitGraphics.alpha = alpha; }; return self; }); var Obstacle = Container.expand(function () { var self = Container.call(this); var obstacleGraphics = self.attachAsset('obstacle', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Rotate obstacle for visual effect obstacleGraphics.rotation += 0.02; }; return self; }); var Platform = Container.expand(function () { var self = Container.call(this); self.attachAsset('platform', { anchorX: 0.5, anchorY: 0.5 }); 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.onGround = false; self.speed = 8; self.jumpPower = 15; self.gravity = 0.8; self.maxVelocityY = 20; self.canTeleport = true; self.update = function () { // Apply gravity if (!self.onGround) { self.velocityY += self.gravity; if (self.velocityY > self.maxVelocityY) { self.velocityY = self.maxVelocityY; } } // Apply velocity self.x += self.velocityX; self.y += self.velocityY; // Apply friction self.velocityX *= 0.85; // Keep player in bounds if (self.x < 30) { self.x = 30; self.velocityX = 0; } if (self.x > 2018) { self.x = 2018; self.velocityX = 0; } // Check ground collision var groundY = 2732 - 100 - 30; // Ground top minus half player height if (self.y >= groundY) { self.y = groundY; self.velocityY = 0; self.onGround = true; } else { self.onGround = false; } // Check platform collisions for (var i = 0; i < platforms.length; i++) { var platform = platforms[i]; if (self.intersects(platform)) { var playerBottom = self.y + 30; var playerTop = self.y - 30; var platformTop = platform.y - 20; var platformBottom = platform.y + 20; if (self.velocityY > 0 && playerTop < platformTop && playerBottom > platformTop) { self.y = platformTop - 30; self.velocityY = 0; self.onGround = true; } } } // Check portal collisions if (self.canTeleport && portal1 && portal2) { if (self.intersects(portal1)) { self.teleport(portal1, portal2); } else if (self.intersects(portal2)) { self.teleport(portal2, portal1); } } // Check obstacle collisions for (var i = 0; i < obstacles.length; i++) { var obstacle = obstacles[i]; if (self.intersects(obstacle)) { self.die(); return; } } // Check exit collision if (exit && self.intersects(exit)) { self.win(); } }; self.teleport = function (fromPortal, toPortal) { self.canTeleport = false; self.x = toPortal.x; self.y = toPortal.y; // Add some visual feedback LK.effects.flashObject(self, 0x9C27B0, 300); LK.getSound('portal_travel').play(); // Prevent immediate re-teleport LK.setTimeout(function () { self.canTeleport = true; }, 500); }; self.jump = function () { if (self.onGround) { self.velocityY = -self.jumpPower; self.onGround = false; } }; self.moveLeft = function () { self.velocityX = -self.speed; }; self.moveRight = function () { self.velocityX = self.speed; }; self.die = function () { LK.effects.flashScreen(0xFF0000, 1000); LK.getSound('death').play(); LK.setTimeout(function () { LK.showGameOver(); }, 1000); }; self.win = function () { LK.effects.flashScreen(0x00FF00, 1000); LK.getSound('win').play(); LK.setTimeout(function () { if (currentLevel < maxLevels) { loadLevel(currentLevel + 1); } else { LK.showYouWin(); } }, 1000); }; return self; }); var Portal = Container.expand(function () { var self = Container.call(this); var portalGraphics = self.attachAsset('portal', { anchorX: 0.5, anchorY: 0.5 }); self.active = false; self.update = function () { if (self.active) { // Rotate portal for visual effect portalGraphics.rotation += 0.05; // Pulse effect var scale = 1 + Math.sin(LK.ticks * 0.1) * 0.1; portalGraphics.scaleX = scale; portalGraphics.scaleY = scale; } }; self.activate = function () { self.active = true; portalGraphics.alpha = 1; tween(portalGraphics, { scaleX: 1.2, scaleY: 1.2 }, { duration: 200, easing: tween.easeOut, onFinish: function onFinish() { tween(portalGraphics, { scaleX: 1, scaleY: 1 }, { duration: 200, easing: tween.easeIn }); } }); }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87CEEB }); /**** * Game Code ****/ var player; var portal1 = null; var portal2 = null; var platforms = []; var obstacles = []; var exit; var portalCount = 0; var leftPressed = false; var rightPressed = false; var jumpPressed = false; var currentLevel = 1; var maxLevels = 50; // Level data array with 50 different level configurations var levelData = [ // Level 1 - Tutorial { platforms: [{ x: 400, y: 2400 }, { x: 800, y: 2200 }, { x: 1200, y: 2000 }, { x: 1600, y: 1800 }], obstacles: [{ x: 600, y: 2632 - 100 - 20 }, { x: 1000, y: 2632 - 100 - 20 }, { x: 800, y: 2200 - 40 }], exit: { x: 1800, y: 1720 }, playerStart: { x: 100, y: 2732 - 200 } }, // Level 2 - Higher platforms { platforms: [{ x: 300, y: 2300 }, { x: 700, y: 2100 }, { x: 1100, y: 1900 }, { x: 1500, y: 1700 }, { x: 1900, y: 1500 }], obstacles: [{ x: 500, y: 2632 - 100 - 20 }, { x: 900, y: 2632 - 100 - 20 }, { x: 1300, y: 2632 - 100 - 20 }], exit: { x: 1900, y: 1420 }, playerStart: { x: 100, y: 2732 - 200 } }, // Level 3 - Maze-like { platforms: [{ x: 200, y: 2500 }, { x: 200, y: 2300 }, { x: 600, y: 2300 }, { x: 600, y: 2100 }, { x: 1000, y: 2100 }, { x: 1000, y: 1900 }, { x: 1400, y: 1900 }, { x: 1800, y: 1700 }], obstacles: [{ x: 400, y: 2632 - 100 - 20 }, { x: 800, y: 2632 - 100 - 20 }, { x: 1200, y: 2632 - 100 - 20 }, { x: 1600, y: 2632 - 100 - 20 }], exit: { x: 1800, y: 1620 }, playerStart: { x: 100, y: 2732 - 200 } }, // Level 4 - Vertical challenge { platforms: [{ x: 500, y: 2400 }, { x: 1500, y: 2200 }, { x: 500, y: 2000 }, { x: 1500, y: 1800 }, { x: 1000, y: 1600 }], obstacles: [{ x: 750, y: 2632 - 100 - 20 }, { x: 1250, y: 2632 - 100 - 20 }, { x: 500, y: 2400 - 40 }, { x: 1500, y: 2200 - 40 }], exit: { x: 1000, y: 1520 }, playerStart: { x: 100, y: 2732 - 200 } }, // Level 5 - Obstacle course { platforms: [{ x: 300, y: 2400 }, { x: 600, y: 2300 }, { x: 900, y: 2200 }, { x: 1200, y: 2100 }, { x: 1500, y: 2000 }, { x: 1800, y: 1900 }], obstacles: [{ x: 150, y: 2632 - 100 - 20 }, { x: 450, y: 2632 - 100 - 20 }, { x: 750, y: 2632 - 100 - 20 }, { x: 1050, y: 2632 - 100 - 20 }, { x: 1350, y: 2632 - 100 - 20 }, { x: 1650, y: 2632 - 100 - 20 }], exit: { x: 1800, y: 1820 }, playerStart: { x: 100, y: 2732 - 200 } }, // Level 6 - Portal bridges { platforms: [{ x: 300, y: 2300 }, { x: 1700, y: 2300 }, { x: 1000, y: 2000 }], obstacles: [{ x: 500, y: 2632 - 100 - 20 }, { x: 800, y: 2632 - 100 - 20 }, { x: 1200, y: 2632 - 100 - 20 }, { x: 1500, y: 2632 - 100 - 20 }], exit: { x: 1000, y: 1920 }, playerStart: { x: 100, y: 2732 - 200 } }, // Level 7 - Spiral up { platforms: [{ x: 200, y: 2400 }, { x: 400, y: 2300 }, { x: 600, y: 2200 }, { x: 800, y: 2100 }, { x: 1000, y: 2000 }, { x: 1200, y: 1900 }, { x: 1400, y: 1800 }, { x: 1600, y: 1700 }], obstacles: [{ x: 300, y: 2632 - 100 - 20 }, { x: 700, y: 2632 - 100 - 20 }, { x: 1100, y: 2632 - 100 - 20 }, { x: 1500, y: 2632 - 100 - 20 }], exit: { x: 1600, y: 1620 }, playerStart: { x: 100, y: 2732 - 200 } }, // Level 8 - Islands { platforms: [{ x: 200, y: 2200 }, { x: 600, y: 2000 }, { x: 1000, y: 1800 }, { x: 1400, y: 1600 }, { x: 1800, y: 1400 }], obstacles: [{ x: 400, y: 2632 - 100 - 20 }, { x: 800, y: 2632 - 100 - 20 }, { x: 1200, y: 2632 - 100 - 20 }, { x: 1600, y: 2632 - 100 - 20 }], exit: { x: 1800, y: 1320 }, playerStart: { x: 100, y: 2732 - 200 } }, // Level 9 - Dangerous ground { platforms: [{ x: 200, y: 2400 }, { x: 500, y: 2200 }, { x: 800, y: 2000 }, { x: 1100, y: 1800 }, { x: 1400, y: 1600 }, { x: 1700, y: 1400 }], obstacles: [{ x: 100, y: 2632 - 100 - 20 }, { x: 200, y: 2632 - 100 - 20 }, { x: 300, y: 2632 - 100 - 20 }, { x: 400, y: 2632 - 100 - 20 }, { x: 600, y: 2632 - 100 - 20 }, { x: 700, y: 2632 - 100 - 20 }, { x: 900, y: 2632 - 100 - 20 }, { x: 1000, y: 2632 - 100 - 20 }, { x: 1200, y: 2632 - 100 - 20 }, { x: 1300, y: 2632 - 100 - 20 }, { x: 1500, y: 2632 - 100 - 20 }, { x: 1600, y: 2632 - 100 - 20 }, { x: 1800, y: 2632 - 100 - 20 }, { x: 1900, y: 2632 - 100 - 20 }], exit: { x: 1700, y: 1320 }, playerStart: { x: 50, y: 2732 - 200 } }, // Level 10 - Tower climb { platforms: [{ x: 1000, y: 2400 }, { x: 1000, y: 2200 }, { x: 1000, y: 2000 }, { x: 1000, y: 1800 }, { x: 1000, y: 1600 }, { x: 1000, y: 1400 }], obstacles: [{ x: 800, y: 2632 - 100 - 20 }, { x: 1200, y: 2632 - 100 - 20 }, { x: 900, y: 2400 - 40 }, { x: 1100, y: 2200 - 40 }, { x: 900, y: 2000 - 40 }, { x: 1100, y: 1800 - 40 }], exit: { x: 1000, y: 1320 }, playerStart: { x: 100, y: 2732 - 200 } }, // Level 11 - Zigzag { platforms: [{ x: 200, y: 2300 }, { x: 800, y: 2100 }, { x: 200, y: 1900 }, { x: 800, y: 1700 }, { x: 200, y: 1500 }, { x: 800, y: 1300 }], obstacles: [{ x: 400, y: 2632 - 100 - 20 }, { x: 600, y: 2632 - 100 - 20 }, { x: 1000, y: 2632 - 100 - 20 }, { x: 1200, y: 2632 - 100 - 20 }], exit: { x: 800, y: 1220 }, playerStart: { x: 100, y: 2732 - 200 } }, // Level 12 - Portal puzzle { platforms: [{ x: 300, y: 2400 }, { x: 1700, y: 2400 }, { x: 1000, y: 2000 }, { x: 500, y: 1600 }, { x: 1500, y: 1600 }], obstacles: [{ x: 1000, y: 2632 - 100 - 20 }, { x: 1000, y: 2400 - 40 }, { x: 1000, y: 2000 - 40 }], exit: { x: 1000, y: 1520 }, playerStart: { x: 100, y: 2732 - 200 } }, // Level 13 - Narrow passages { platforms: [{ x: 200, y: 2400 }, { x: 400, y: 2200 }, { x: 600, y: 2000 }, { x: 800, y: 1800 }, { x: 1000, y: 1600 }, { x: 1200, y: 1400 }, { x: 1400, y: 1200 }, { x: 1600, y: 1000 }], obstacles: [{ x: 300, y: 2632 - 100 - 20 }, { x: 500, y: 2632 - 100 - 20 }, { x: 700, y: 2632 - 100 - 20 }, { x: 900, y: 2632 - 100 - 20 }, { x: 1100, y: 2632 - 100 - 20 }, { x: 1300, y: 2632 - 100 - 20 }, { x: 1500, y: 2632 - 100 - 20 }], exit: { x: 1600, y: 920 }, playerStart: { x: 100, y: 2732 - 200 } }, // Level 14 - Multiple routes { platforms: [{ x: 300, y: 2300 }, { x: 700, y: 2100 }, { x: 1100, y: 1900 }, { x: 1500, y: 1700 }, { x: 300, y: 1900 }, { x: 700, y: 1700 }, { x: 1100, y: 1500 }], obstacles: [{ x: 500, y: 2632 - 100 - 20 }, { x: 900, y: 2632 - 100 - 20 }, { x: 1300, y: 2632 - 100 - 20 }, { x: 1700, y: 2632 - 100 - 20 }], exit: { x: 1500, y: 1620 }, playerStart: { x: 100, y: 2732 - 200 } }, // Level 15 - Floating islands { platforms: [{ x: 200, y: 2200 }, { x: 600, y: 1800 }, { x: 1000, y: 1400 }, { x: 1400, y: 1000 }, { x: 1800, y: 600 }], obstacles: [{ x: 400, y: 2632 - 100 - 20 }, { x: 800, y: 2632 - 100 - 20 }, { x: 1200, y: 2632 - 100 - 20 }, { x: 1600, y: 2632 - 100 - 20 }], exit: { x: 1800, y: 520 }, playerStart: { x: 100, y: 2732 - 200 } }, // Level 16 - Obstacle maze { platforms: [{ x: 200, y: 2400 }, { x: 500, y: 2200 }, { x: 800, y: 2000 }, { x: 1100, y: 1800 }, { x: 1400, y: 1600 }, { x: 1700, y: 1400 }], obstacles: [{ x: 350, y: 2632 - 100 - 20 }, { x: 650, y: 2632 - 100 - 20 }, { x: 950, y: 2632 - 100 - 20 }, { x: 1250, y: 2632 - 100 - 20 }, { x: 1550, y: 2632 - 100 - 20 }, { x: 200, y: 2400 - 40 }, { x: 500, y: 2200 - 40 }, { x: 800, y: 2000 - 40 }, { x: 1100, y: 1800 - 40 }], exit: { x: 1700, y: 1320 }, playerStart: { x: 100, y: 2732 - 200 } }, // Level 17 - High jump required { platforms: [{ x: 400, y: 2300 }, { x: 1200, y: 2000 }, { x: 800, y: 1500 }], obstacles: [{ x: 600, y: 2632 - 100 - 20 }, { x: 1000, y: 2632 - 100 - 20 }, { x: 1400, y: 2632 - 100 - 20 }], exit: { x: 800, y: 1420 }, playerStart: { x: 100, y: 2732 - 200 } }, // Level 18 - Portal precision { platforms: [{ x: 200, y: 2400 }, { x: 600, y: 2000 }, { x: 1000, y: 1600 }, { x: 1400, y: 1200 }, { x: 1800, y: 800 }], obstacles: [{ x: 400, y: 2632 - 100 - 20 }, { x: 800, y: 2632 - 100 - 20 }, { x: 1200, y: 2632 - 100 - 20 }, { x: 1600, y: 2632 - 100 - 20 }], exit: { x: 1800, y: 720 }, playerStart: { x: 100, y: 2732 - 200 } }, // Level 19 - Deadly ground { platforms: [{ x: 200, y: 2300 }, { x: 500, y: 2100 }, { x: 800, y: 1900 }, { x: 1100, y: 1700 }, { x: 1400, y: 1500 }, { x: 1700, y: 1300 }], obstacles: [{ x: 50, y: 2632 - 100 - 20 }, { x: 100, y: 2632 - 100 - 20 }, { x: 150, y: 2632 - 100 - 20 }, { x: 250, y: 2632 - 100 - 20 }, { x: 300, y: 2632 - 100 - 20 }, { x: 350, y: 2632 - 100 - 20 }, { x: 400, y: 2632 - 100 - 20 }, { x: 450, y: 2632 - 100 - 20 }, { x: 550, y: 2632 - 100 - 20 }, { x: 600, y: 2632 - 100 - 20 }, { x: 650, y: 2632 - 100 - 20 }, { x: 700, y: 2632 - 100 - 20 }, { x: 750, y: 2632 - 100 - 20 }, { x: 850, y: 2632 - 100 - 20 }, { x: 900, y: 2632 - 100 - 20 }, { x: 950, y: 2632 - 100 - 20 }, { x: 1000, y: 2632 - 100 - 20 }, { x: 1050, y: 2632 - 100 - 20 }, { x: 1150, y: 2632 - 100 - 20 }, { x: 1200, y: 2632 - 100 - 20 }, { x: 1250, y: 2632 - 100 - 20 }, { x: 1300, y: 2632 - 100 - 20 }, { x: 1350, y: 2632 - 100 - 20 }, { x: 1450, y: 2632 - 100 - 20 }, { x: 1500, y: 2632 - 100 - 20 }, { x: 1550, y: 2632 - 100 - 20 }, { x: 1600, y: 2632 - 100 - 20 }, { x: 1650, y: 2632 - 100 - 20 }, { x: 1750, y: 2632 - 100 - 20 }, { x: 1800, y: 2632 - 100 - 20 }, { x: 1850, y: 2632 - 100 - 20 }, { x: 1900, y: 2632 - 100 - 20 }, { x: 1950, y: 2632 - 100 - 20 }], exit: { x: 1700, y: 1220 }, playerStart: { x: 200, y: 2220 } }, // Level 20 - Circular platforms { platforms: [{ x: 1000, y: 2300 }, { x: 600, y: 2000 }, { x: 1400, y: 2000 }, { x: 400, y: 1600 }, { x: 1600, y: 1600 }, { x: 800, y: 1200 }, { x: 1200, y: 1200 }], obstacles: [{ x: 500, y: 2632 - 100 - 20 }, { x: 1000, y: 2632 - 100 - 20 }, { x: 1500, y: 2632 - 100 - 20 }], exit: { x: 1000, y: 1120 }, playerStart: { x: 100, y: 2732 - 200 } }, // Level 21-50 continue with increasingly complex layouts { platforms: [{ x: 300, y: 2400 }, { x: 700, y: 2200 }, { x: 1100, y: 2000 }, { x: 1500, y: 1800 }, { x: 1900, y: 1600 }], obstacles: [{ x: 500, y: 2632 - 100 - 20 }, { x: 900, y: 2632 - 100 - 20 }, { x: 1300, y: 2632 - 100 - 20 }, { x: 1700, y: 2632 - 100 - 20 }], exit: { x: 1900, y: 1520 }, playerStart: { x: 100, y: 2732 - 200 } }, { platforms: [{ x: 200, y: 2300 }, { x: 800, y: 2100 }, { x: 200, y: 1900 }, { x: 800, y: 1700 }, { x: 200, y: 1500 }], obstacles: [{ x: 400, y: 2632 - 100 - 20 }, { x: 600, y: 2632 - 100 - 20 }, { x: 1000, y: 2632 - 100 - 20 }, { x: 1200, y: 2632 - 100 - 20 }], exit: { x: 200, y: 1420 }, playerStart: { x: 100, y: 2732 - 200 } }, { platforms: [{ x: 500, y: 2400 }, { x: 1000, y: 2200 }, { x: 1500, y: 2000 }, { x: 1000, y: 1800 }, { x: 500, y: 1600 }], obstacles: [{ x: 250, y: 2632 - 100 - 20 }, { x: 750, y: 2632 - 100 - 20 }, { x: 1250, y: 2632 - 100 - 20 }, { x: 1750, y: 2632 - 100 - 20 }], exit: { x: 500, y: 1520 }, playerStart: { x: 100, y: 2732 - 200 } }, { platforms: [{ x: 200, y: 2000 }, { x: 600, y: 1800 }, { x: 1000, y: 1600 }, { x: 1400, y: 1400 }, { x: 1800, y: 1200 }], obstacles: [{ x: 400, y: 2632 - 100 - 20 }, { x: 800, y: 2632 - 100 - 20 }, { x: 1200, y: 2632 - 100 - 20 }, { x: 1600, y: 2632 - 100 - 20 }], exit: { x: 1800, y: 1120 }, playerStart: { x: 100, y: 2732 - 200 } }, { platforms: [{ x: 300, y: 2300 }, { x: 900, y: 2100 }, { x: 1500, y: 1900 }, { x: 600, y: 1700 }, { x: 1200, y: 1500 }], obstacles: [{ x: 150, y: 2632 - 100 - 20 }, { x: 450, y: 2632 - 100 - 20 }, { x: 750, y: 2632 - 100 - 20 }, { x: 1050, y: 2632 - 100 - 20 }, { x: 1350, y: 2632 - 100 - 20 }, { x: 1650, y: 2632 - 100 - 20 }, { x: 1950, y: 2632 - 100 - 20 }], exit: { x: 1200, y: 1420 }, playerStart: { x: 100, y: 2732 - 200 } }, { platforms: [{ x: 400, y: 2400 }, { x: 1200, y: 2000 }, { x: 800, y: 1600 }, { x: 1600, y: 1200 }], obstacles: [{ x: 200, y: 2632 - 100 - 20 }, { x: 600, y: 2632 - 100 - 20 }, { x: 1000, y: 2632 - 100 - 20 }, { x: 1400, y: 2632 - 100 - 20 }, { x: 1800, y: 2632 - 100 - 20 }], exit: { x: 1600, y: 1120 }, playerStart: { x: 100, y: 2732 - 200 } }, { platforms: [{ x: 200, y: 2200 }, { x: 700, y: 2000 }, { x: 1200, y: 1800 }, { x: 1700, y: 1600 }, { x: 1000, y: 1400 }], obstacles: [{ x: 350, y: 2632 - 100 - 20 }, { x: 550, y: 2632 - 100 - 20 }, { x: 850, y: 2632 - 100 - 20 }, { x: 1050, y: 2632 - 100 - 20 }, { x: 1350, y: 2632 - 100 - 20 }, { x: 1550, y: 2632 - 100 - 20 }], exit: { x: 1000, y: 1320 }, playerStart: { x: 100, y: 2732 - 200 } }, { platforms: [{ x: 500, y: 2300 }, { x: 1000, y: 2100 }, { x: 1500, y: 1900 }, { x: 500, y: 1700 }, { x: 1000, y: 1500 }], obstacles: [{ x: 250, y: 2632 - 100 - 20 }, { x: 750, y: 2632 - 100 - 20 }, { x: 1250, y: 2632 - 100 - 20 }, { x: 1750, y: 2632 - 100 - 20 }], exit: { x: 1000, y: 1420 }, playerStart: { x: 100, y: 2732 - 200 } }, { platforms: [{ x: 300, y: 2400 }, { x: 800, y: 2200 }, { x: 1300, y: 2000 }, { x: 1800, y: 1800 }, { x: 1000, y: 1600 }], obstacles: [{ x: 100, y: 2632 - 100 - 20 }, { x: 500, y: 2632 - 100 - 20 }, { x: 1000, y: 2632 - 100 - 20 }, { x: 1500, y: 2632 - 100 - 20 }, { x: 1900, y: 2632 - 100 - 20 }], exit: { x: 1000, y: 1520 }, playerStart: { x: 100, y: 2732 - 200 } }, { platforms: [{ x: 200, y: 2300 }, { x: 600, y: 2100 }, { x: 1000, y: 1900 }, { x: 1400, y: 1700 }, { x: 1800, y: 1500 }], obstacles: [{ x: 400, y: 2632 - 100 - 20 }, { x: 800, y: 2632 - 100 - 20 }, { x: 1200, y: 2632 - 100 - 20 }, { x: 1600, y: 2632 - 100 - 20 }], exit: { x: 1800, y: 1420 }, playerStart: { x: 100, y: 2732 - 200 } }, { platforms: [{ x: 400, y: 2400 }, { x: 1200, y: 2200 }, { x: 800, y: 2000 }, { x: 1600, y: 1800 }, { x: 1000, y: 1600 }], obstacles: [{ x: 200, y: 2632 - 100 - 20 }, { x: 600, y: 2632 - 100 - 20 }, { x: 1000, y: 2632 - 100 - 20 }, { x: 1400, y: 2632 - 100 - 20 }, { x: 1800, y: 2632 - 100 - 20 }], exit: { x: 1000, y: 1520 }, playerStart: { x: 100, y: 2732 - 200 } }, { platforms: [{ x: 300, y: 2300 }, { x: 900, y: 2100 }, { x: 1500, y: 1900 }, { x: 600, y: 1700 }, { x: 1200, y: 1500 }, { x: 1800, y: 1300 }], obstacles: [{ x: 150, y: 2632 - 100 - 20 }, { x: 450, y: 2632 - 100 - 20 }, { x: 750, y: 2632 - 100 - 20 }, { x: 1050, y: 2632 - 100 - 20 }, { x: 1350, y: 2632 - 100 - 20 }, { x: 1650, y: 2632 - 100 - 20 }, { x: 1950, y: 2632 - 100 - 20 }], exit: { x: 1800, y: 1220 }, playerStart: { x: 100, y: 2732 - 200 } }, { platforms: [{ x: 500, y: 2400 }, { x: 1000, y: 2200 }, { x: 1500, y: 2000 }, { x: 1000, y: 1800 }, { x: 500, y: 1600 }, { x: 1000, y: 1400 }], obstacles: [{ x: 250, y: 2632 - 100 - 20 }, { x: 750, y: 2632 - 100 - 20 }, { x: 1250, y: 2632 - 100 - 20 }, { x: 1750, y: 2632 - 100 - 20 }], exit: { x: 1000, y: 1320 }, playerStart: { x: 100, y: 2732 - 200 } }, { platforms: [{ x: 200, y: 2200 }, { x: 800, y: 2000 }, { x: 1400, y: 1800 }, { x: 500, y: 1600 }, { x: 1100, y: 1400 }, { x: 1700, y: 1200 }], obstacles: [{ x: 350, y: 2632 - 100 - 20 }, { x: 650, y: 2632 - 100 - 20 }, { x: 950, y: 2632 - 100 - 20 }, { x: 1250, y: 2632 - 100 - 20 }, { x: 1550, y: 2632 - 100 - 20 }, { x: 1850, y: 2632 - 100 - 20 }], exit: { x: 1700, y: 1120 }, playerStart: { x: 100, y: 2732 - 200 } }, { platforms: [{ x: 400, y: 2400 }, { x: 1200, y: 2000 }, { x: 800, y: 1600 }, { x: 1600, y: 1200 }, { x: 1000, y: 800 }], obstacles: [{ x: 200, y: 2632 - 100 - 20 }, { x: 600, y: 2632 - 100 - 20 }, { x: 1000, y: 2632 - 100 - 20 }, { x: 1400, y: 2632 - 100 - 20 }, { x: 1800, y: 2632 - 100 - 20 }], exit: { x: 1000, y: 720 }, playerStart: { x: 100, y: 2732 - 200 } }, { platforms: [{ x: 300, y: 2300 }, { x: 700, y: 2100 }, { x: 1100, y: 1900 }, { x: 1500, y: 1700 }, { x: 1900, y: 1500 }, { x: 1500, y: 1300 }, { x: 1100, y: 1100 }], obstacles: [{ x: 100, y: 2632 - 100 - 20 }, { x: 500, y: 2632 - 100 - 20 }, { x: 900, y: 2632 - 100 - 20 }, { x: 1300, y: 2632 - 100 - 20 }, { x: 1700, y: 2632 - 100 - 20 }], exit: { x: 1100, y: 1020 }, playerStart: { x: 100, y: 2732 - 200 } }, { platforms: [{ x: 200, y: 2400 }, { x: 600, y: 2200 }, { x: 1000, y: 2000 }, { x: 1400, y: 1800 }, { x: 1800, y: 1600 }, { x: 1400, y: 1400 }, { x: 1000, y: 1200 }, { x: 600, y: 1000 }], obstacles: [{ x: 400, y: 2632 - 100 - 20 }, { x: 800, y: 2632 - 100 - 20 }, { x: 1200, y: 2632 - 100 - 20 }, { x: 1600, y: 2632 - 100 - 20 }], exit: { x: 600, y: 920 }, playerStart: { x: 100, y: 2732 - 200 } }, { platforms: [{ x: 500, y: 2300 }, { x: 1000, y: 2100 }, { x: 1500, y: 1900 }, { x: 1000, y: 1700 }, { x: 500, y: 1500 }, { x: 1000, y: 1300 }, { x: 1500, y: 1100 }], obstacles: [{ x: 250, y: 2632 - 100 - 20 }, { x: 750, y: 2632 - 100 - 20 }, { x: 1250, y: 2632 - 100 - 20 }, { x: 1750, y: 2632 - 100 - 20 }], exit: { x: 1500, y: 1020 }, playerStart: { x: 100, y: 2732 - 200 } }, { platforms: [{ x: 300, y: 2200 }, { x: 900, y: 2000 }, { x: 1500, y: 1800 }, { x: 600, y: 1600 }, { x: 1200, y: 1400 }, { x: 1800, y: 1200 }, { x: 1000, y: 1000 }], obstacles: [{ x: 150, y: 2632 - 100 - 20 }, { x: 450, y: 2632 - 100 - 20 }, { x: 750, y: 2632 - 100 - 20 }, { x: 1050, y: 2632 - 100 - 20 }, { x: 1350, y: 2632 - 100 - 20 }, { x: 1650, y: 2632 - 100 - 20 }, { x: 1950, y: 2632 - 100 - 20 }], exit: { x: 1000, y: 920 }, playerStart: { x: 100, y: 2732 - 200 } }, { platforms: [{ x: 400, y: 2400 }, { x: 1200, y: 2200 }, { x: 800, y: 2000 }, { x: 1600, y: 1800 }, { x: 1000, y: 1600 }, { x: 1800, y: 1400 }, { x: 1400, y: 1200 }, { x: 600, y: 1000 }], obstacles: [{ x: 200, y: 2632 - 100 - 20 }, { x: 600, y: 2632 - 100 - 20 }, { x: 1000, y: 2632 - 100 - 20 }, { x: 1400, y: 2632 - 100 - 20 }, { x: 1800, y: 2632 - 100 - 20 }], exit: { x: 600, y: 920 }, playerStart: { x: 100, y: 2732 - 200 } }, { platforms: [{ x: 200, y: 2300 }, { x: 700, y: 2100 }, { x: 1200, y: 1900 }, { x: 1700, y: 1700 }, { x: 1200, y: 1500 }, { x: 700, y: 1300 }, { x: 200, y: 1100 }, { x: 1000, y: 900 }], obstacles: [{ x: 350, y: 2632 - 100 - 20 }, { x: 550, y: 2632 - 100 - 20 }, { x: 850, y: 2632 - 100 - 20 }, { x: 1050, y: 2632 - 100 - 20 }, { x: 1350, y: 2632 - 100 - 20 }, { x: 1550, y: 2632 - 100 - 20 }, { x: 1850, y: 2632 - 100 - 20 }], exit: { x: 1000, y: 820 }, playerStart: { x: 100, y: 2732 - 200 } }, { platforms: [{ x: 500, y: 2400 }, { x: 1000, y: 2200 }, { x: 1500, y: 2000 }, { x: 1000, y: 1800 }, { x: 500, y: 1600 }, { x: 1000, y: 1400 }, { x: 1500, y: 1200 }, { x: 1000, y: 1000 }, { x: 500, y: 800 }], obstacles: [{ x: 250, y: 2632 - 100 - 20 }, { x: 750, y: 2632 - 100 - 20 }, { x: 1250, y: 2632 - 100 - 20 }, { x: 1750, y: 2632 - 100 - 20 }], exit: { x: 500, y: 720 }, playerStart: { x: 100, y: 2732 - 200 } }, { platforms: [{ x: 300, y: 2300 }, { x: 800, y: 2100 }, { x: 1300, y: 1900 }, { x: 1800, y: 1700 }, { x: 1300, y: 1500 }, { x: 800, y: 1300 }, { x: 300, y: 1100 }, { x: 800, y: 900 }, { x: 1300, y: 700 }], obstacles: [{ x: 100, y: 2632 - 100 - 20 }, { x: 500, y: 2632 - 100 - 20 }, { x: 1000, y: 2632 - 100 - 20 }, { x: 1500, y: 2632 - 100 - 20 }, { x: 1900, y: 2632 - 100 - 20 }], exit: { x: 1300, y: 620 }, playerStart: { x: 100, y: 2732 - 200 } }, { platforms: [{ x: 200, y: 2200 }, { x: 600, y: 2000 }, { x: 1000, y: 1800 }, { x: 1400, y: 1600 }, { x: 1800, y: 1400 }, { x: 1400, y: 1200 }, { x: 1000, y: 1000 }, { x: 600, y: 800 }, { x: 200, y: 600 }], obstacles: [{ x: 400, y: 2632 - 100 - 20 }, { x: 800, y: 2632 - 100 - 20 }, { x: 1200, y: 2632 - 100 - 20 }, { x: 1600, y: 2632 - 100 - 20 }], exit: { x: 200, y: 520 }, playerStart: { x: 100, y: 2732 - 200 } }, { platforms: [{ x: 400, y: 2400 }, { x: 1200, y: 2000 }, { x: 800, y: 1600 }, { x: 1600, y: 1200 }, { x: 1000, y: 800 }, { x: 1800, y: 400 }], obstacles: [{ x: 200, y: 2632 - 100 - 20 }, { x: 600, y: 2632 - 100 - 20 }, { x: 1000, y: 2632 - 100 - 20 }, { x: 1400, y: 2632 - 100 - 20 }, { x: 1800, y: 2632 - 100 - 20 }], exit: { x: 1800, y: 320 }, playerStart: { x: 100, y: 2732 - 200 } }, { platforms: [{ x: 300, y: 2300 }, { x: 900, y: 2100 }, { x: 1500, y: 1900 }, { x: 600, y: 1700 }, { x: 1200, y: 1500 }, { x: 1800, y: 1300 }, { x: 1000, y: 1100 }, { x: 400, y: 900 }, { x: 1600, y: 700 }, { x: 800, y: 500 }], obstacles: [{ x: 150, y: 2632 - 100 - 20 }, { x: 450, y: 2632 - 100 - 20 }, { x: 750, y: 2632 - 100 - 20 }, { x: 1050, y: 2632 - 100 - 20 }, { x: 1350, y: 2632 - 100 - 20 }, { x: 1650, y: 2632 - 100 - 20 }, { x: 1950, y: 2632 - 100 - 20 }], exit: { x: 800, y: 420 }, playerStart: { x: 100, y: 2732 - 200 } }, { platforms: [{ x: 1000, y: 2400 }, { x: 1000, y: 2200 }, { x: 1000, y: 2000 }, { x: 1000, y: 1800 }, { x: 1000, y: 1600 }, { x: 1000, y: 1400 }, { x: 1000, y: 1200 }, { x: 1000, y: 1000 }, { x: 1000, y: 800 }, { x: 1000, y: 600 }, { x: 1000, y: 400 }], obstacles: [{ x: 800, y: 2632 - 100 - 20 }, { x: 1200, y: 2632 - 100 - 20 }, { x: 900, y: 2400 - 40 }, { x: 1100, y: 2200 - 40 }, { x: 900, y: 2000 - 40 }, { x: 1100, y: 1800 - 40 }, { x: 900, y: 1600 - 40 }, { x: 1100, y: 1400 - 40 }, { x: 900, y: 1200 - 40 }, { x: 1100, y: 1000 - 40 }, { x: 900, y: 800 - 40 }, { x: 1100, y: 600 - 40 }], exit: { x: 1000, y: 320 }, playerStart: { x: 100, y: 2732 - 200 } }]; // Create ground var ground = game.addChild(LK.getAsset('ground', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 2732 - 50 })); // Create player player = game.addChild(new Player()); // Create level display levelTxt = new Text2('Level 1', { size: 80, fill: 0xFFD700 }); levelTxt.anchor.set(0.5, 0); LK.gui.top.addChild(levelTxt); levelTxt.y = 200; // Load the first level loadLevel(1); // Create UI instructions var instructionTxt = new Text2('Tap to create portals\nHold sides to move\nHold top to jump', { size: 60, fill: 0xFFFFFF }); instructionTxt.anchor.set(0.5, 0); LK.gui.top.addChild(instructionTxt); instructionTxt.y = 100; // Declare levelTxt in global scope var levelTxt; // Control areas var leftControlArea = { x: 0, y: 0, width: 683, height: 2732 }; var rightControlArea = { x: 1365, y: 0, width: 683, height: 2732 }; var jumpControlArea = { x: 683, y: 0, width: 682, height: 400 }; function isPointInArea(x, y, area) { return x >= area.x && x <= area.x + area.width && y >= area.y && y <= area.y + area.height; } function loadLevel(levelNum) { // Clear existing level elements for (var i = platforms.length - 1; i >= 0; i--) { platforms[i].destroy(); } platforms = []; for (var i = obstacles.length - 1; i >= 0; i--) { obstacles[i].destroy(); } obstacles = []; if (exit) { exit.destroy(); exit = null; } if (portal1) { portal1.destroy(); portal1 = null; } if (portal2) { portal2.destroy(); portal2 = null; } portalCount = 0; // Load new level data var level = levelData[levelNum - 1]; // Create platforms for (var i = 0; i < level.platforms.length; i++) { var platformData = level.platforms[i]; var platform = game.addChild(new Platform()); platform.x = platformData.x; platform.y = platformData.y; platforms.push(platform); } // Create obstacles for (var i = 0; i < level.obstacles.length; i++) { var obstacleData = level.obstacles[i]; var obstacle = game.addChild(new Obstacle()); obstacle.x = obstacleData.x; obstacle.y = obstacleData.y; obstacles.push(obstacle); } // Create exit exit = game.addChild(new Exit()); exit.x = level.exit.x; exit.y = level.exit.y; // Set player position player.x = level.playerStart.x; player.y = level.playerStart.y; player.velocityX = 0; player.velocityY = 0; player.onGround = false; player.canTeleport = true; // Update level display levelTxt.setText('Level ' + levelNum); currentLevel = levelNum; } function createPortal(x, y) { if (portalCount === 0) { // Create first portal portal1 = game.addChild(new Portal()); portal1.x = x; portal1.y = y; portalCount = 1; LK.getSound('portal_create').play(); } else if (portalCount === 1) { // Create second portal and activate both portal2 = game.addChild(new Portal()); portal2.x = x; portal2.y = y; portal1.activate(); portal2.activate(); portalCount = 2; LK.getSound('portal_create').play(); } else { // Replace portals if (portal1) { portal1.destroy(); } if (portal2) { portal2.destroy(); } portal1 = game.addChild(new Portal()); portal1.x = x; portal1.y = y; portal2 = null; portalCount = 1; LK.getSound('portal_create').play(); } } game.down = function (x, y, obj) { if (isPointInArea(x, y, leftControlArea)) { leftPressed = true; } else if (isPointInArea(x, y, rightControlArea)) { rightPressed = true; } else if (isPointInArea(x, y, jumpControlArea)) { jumpPressed = true; } else { // Create portal in game area createPortal(x, y); } }; game.up = function (x, y, obj) { leftPressed = false; rightPressed = false; jumpPressed = false; }; game.update = function () { // Handle controls if (leftPressed) { player.moveLeft(); } if (rightPressed) { player.moveRight(); } if (jumpPressed) { player.jump(); } };
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var Exit = Container.expand(function () {
var self = Container.call(this);
var exitGraphics = self.attachAsset('exit', {
anchorX: 0.5,
anchorY: 0.5
});
self.update = function () {
// Glow effect
var alpha = 0.7 + Math.sin(LK.ticks * 0.05) * 0.3;
exitGraphics.alpha = alpha;
};
return self;
});
var Obstacle = Container.expand(function () {
var self = Container.call(this);
var obstacleGraphics = self.attachAsset('obstacle', {
anchorX: 0.5,
anchorY: 0.5
});
self.update = function () {
// Rotate obstacle for visual effect
obstacleGraphics.rotation += 0.02;
};
return self;
});
var Platform = Container.expand(function () {
var self = Container.call(this);
self.attachAsset('platform', {
anchorX: 0.5,
anchorY: 0.5
});
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.onGround = false;
self.speed = 8;
self.jumpPower = 15;
self.gravity = 0.8;
self.maxVelocityY = 20;
self.canTeleport = true;
self.update = function () {
// Apply gravity
if (!self.onGround) {
self.velocityY += self.gravity;
if (self.velocityY > self.maxVelocityY) {
self.velocityY = self.maxVelocityY;
}
}
// Apply velocity
self.x += self.velocityX;
self.y += self.velocityY;
// Apply friction
self.velocityX *= 0.85;
// Keep player in bounds
if (self.x < 30) {
self.x = 30;
self.velocityX = 0;
}
if (self.x > 2018) {
self.x = 2018;
self.velocityX = 0;
}
// Check ground collision
var groundY = 2732 - 100 - 30; // Ground top minus half player height
if (self.y >= groundY) {
self.y = groundY;
self.velocityY = 0;
self.onGround = true;
} else {
self.onGround = false;
}
// Check platform collisions
for (var i = 0; i < platforms.length; i++) {
var platform = platforms[i];
if (self.intersects(platform)) {
var playerBottom = self.y + 30;
var playerTop = self.y - 30;
var platformTop = platform.y - 20;
var platformBottom = platform.y + 20;
if (self.velocityY > 0 && playerTop < platformTop && playerBottom > platformTop) {
self.y = platformTop - 30;
self.velocityY = 0;
self.onGround = true;
}
}
}
// Check portal collisions
if (self.canTeleport && portal1 && portal2) {
if (self.intersects(portal1)) {
self.teleport(portal1, portal2);
} else if (self.intersects(portal2)) {
self.teleport(portal2, portal1);
}
}
// Check obstacle collisions
for (var i = 0; i < obstacles.length; i++) {
var obstacle = obstacles[i];
if (self.intersects(obstacle)) {
self.die();
return;
}
}
// Check exit collision
if (exit && self.intersects(exit)) {
self.win();
}
};
self.teleport = function (fromPortal, toPortal) {
self.canTeleport = false;
self.x = toPortal.x;
self.y = toPortal.y;
// Add some visual feedback
LK.effects.flashObject(self, 0x9C27B0, 300);
LK.getSound('portal_travel').play();
// Prevent immediate re-teleport
LK.setTimeout(function () {
self.canTeleport = true;
}, 500);
};
self.jump = function () {
if (self.onGround) {
self.velocityY = -self.jumpPower;
self.onGround = false;
}
};
self.moveLeft = function () {
self.velocityX = -self.speed;
};
self.moveRight = function () {
self.velocityX = self.speed;
};
self.die = function () {
LK.effects.flashScreen(0xFF0000, 1000);
LK.getSound('death').play();
LK.setTimeout(function () {
LK.showGameOver();
}, 1000);
};
self.win = function () {
LK.effects.flashScreen(0x00FF00, 1000);
LK.getSound('win').play();
LK.setTimeout(function () {
if (currentLevel < maxLevels) {
loadLevel(currentLevel + 1);
} else {
LK.showYouWin();
}
}, 1000);
};
return self;
});
var Portal = Container.expand(function () {
var self = Container.call(this);
var portalGraphics = self.attachAsset('portal', {
anchorX: 0.5,
anchorY: 0.5
});
self.active = false;
self.update = function () {
if (self.active) {
// Rotate portal for visual effect
portalGraphics.rotation += 0.05;
// Pulse effect
var scale = 1 + Math.sin(LK.ticks * 0.1) * 0.1;
portalGraphics.scaleX = scale;
portalGraphics.scaleY = scale;
}
};
self.activate = function () {
self.active = true;
portalGraphics.alpha = 1;
tween(portalGraphics, {
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 200,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(portalGraphics, {
scaleX: 1,
scaleY: 1
}, {
duration: 200,
easing: tween.easeIn
});
}
});
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB
});
/****
* Game Code
****/
var player;
var portal1 = null;
var portal2 = null;
var platforms = [];
var obstacles = [];
var exit;
var portalCount = 0;
var leftPressed = false;
var rightPressed = false;
var jumpPressed = false;
var currentLevel = 1;
var maxLevels = 50;
// Level data array with 50 different level configurations
var levelData = [
// Level 1 - Tutorial
{
platforms: [{
x: 400,
y: 2400
}, {
x: 800,
y: 2200
}, {
x: 1200,
y: 2000
}, {
x: 1600,
y: 1800
}],
obstacles: [{
x: 600,
y: 2632 - 100 - 20
}, {
x: 1000,
y: 2632 - 100 - 20
}, {
x: 800,
y: 2200 - 40
}],
exit: {
x: 1800,
y: 1720
},
playerStart: {
x: 100,
y: 2732 - 200
}
},
// Level 2 - Higher platforms
{
platforms: [{
x: 300,
y: 2300
}, {
x: 700,
y: 2100
}, {
x: 1100,
y: 1900
}, {
x: 1500,
y: 1700
}, {
x: 1900,
y: 1500
}],
obstacles: [{
x: 500,
y: 2632 - 100 - 20
}, {
x: 900,
y: 2632 - 100 - 20
}, {
x: 1300,
y: 2632 - 100 - 20
}],
exit: {
x: 1900,
y: 1420
},
playerStart: {
x: 100,
y: 2732 - 200
}
},
// Level 3 - Maze-like
{
platforms: [{
x: 200,
y: 2500
}, {
x: 200,
y: 2300
}, {
x: 600,
y: 2300
}, {
x: 600,
y: 2100
}, {
x: 1000,
y: 2100
}, {
x: 1000,
y: 1900
}, {
x: 1400,
y: 1900
}, {
x: 1800,
y: 1700
}],
obstacles: [{
x: 400,
y: 2632 - 100 - 20
}, {
x: 800,
y: 2632 - 100 - 20
}, {
x: 1200,
y: 2632 - 100 - 20
}, {
x: 1600,
y: 2632 - 100 - 20
}],
exit: {
x: 1800,
y: 1620
},
playerStart: {
x: 100,
y: 2732 - 200
}
},
// Level 4 - Vertical challenge
{
platforms: [{
x: 500,
y: 2400
}, {
x: 1500,
y: 2200
}, {
x: 500,
y: 2000
}, {
x: 1500,
y: 1800
}, {
x: 1000,
y: 1600
}],
obstacles: [{
x: 750,
y: 2632 - 100 - 20
}, {
x: 1250,
y: 2632 - 100 - 20
}, {
x: 500,
y: 2400 - 40
}, {
x: 1500,
y: 2200 - 40
}],
exit: {
x: 1000,
y: 1520
},
playerStart: {
x: 100,
y: 2732 - 200
}
},
// Level 5 - Obstacle course
{
platforms: [{
x: 300,
y: 2400
}, {
x: 600,
y: 2300
}, {
x: 900,
y: 2200
}, {
x: 1200,
y: 2100
}, {
x: 1500,
y: 2000
}, {
x: 1800,
y: 1900
}],
obstacles: [{
x: 150,
y: 2632 - 100 - 20
}, {
x: 450,
y: 2632 - 100 - 20
}, {
x: 750,
y: 2632 - 100 - 20
}, {
x: 1050,
y: 2632 - 100 - 20
}, {
x: 1350,
y: 2632 - 100 - 20
}, {
x: 1650,
y: 2632 - 100 - 20
}],
exit: {
x: 1800,
y: 1820
},
playerStart: {
x: 100,
y: 2732 - 200
}
},
// Level 6 - Portal bridges
{
platforms: [{
x: 300,
y: 2300
}, {
x: 1700,
y: 2300
}, {
x: 1000,
y: 2000
}],
obstacles: [{
x: 500,
y: 2632 - 100 - 20
}, {
x: 800,
y: 2632 - 100 - 20
}, {
x: 1200,
y: 2632 - 100 - 20
}, {
x: 1500,
y: 2632 - 100 - 20
}],
exit: {
x: 1000,
y: 1920
},
playerStart: {
x: 100,
y: 2732 - 200
}
},
// Level 7 - Spiral up
{
platforms: [{
x: 200,
y: 2400
}, {
x: 400,
y: 2300
}, {
x: 600,
y: 2200
}, {
x: 800,
y: 2100
}, {
x: 1000,
y: 2000
}, {
x: 1200,
y: 1900
}, {
x: 1400,
y: 1800
}, {
x: 1600,
y: 1700
}],
obstacles: [{
x: 300,
y: 2632 - 100 - 20
}, {
x: 700,
y: 2632 - 100 - 20
}, {
x: 1100,
y: 2632 - 100 - 20
}, {
x: 1500,
y: 2632 - 100 - 20
}],
exit: {
x: 1600,
y: 1620
},
playerStart: {
x: 100,
y: 2732 - 200
}
},
// Level 8 - Islands
{
platforms: [{
x: 200,
y: 2200
}, {
x: 600,
y: 2000
}, {
x: 1000,
y: 1800
}, {
x: 1400,
y: 1600
}, {
x: 1800,
y: 1400
}],
obstacles: [{
x: 400,
y: 2632 - 100 - 20
}, {
x: 800,
y: 2632 - 100 - 20
}, {
x: 1200,
y: 2632 - 100 - 20
}, {
x: 1600,
y: 2632 - 100 - 20
}],
exit: {
x: 1800,
y: 1320
},
playerStart: {
x: 100,
y: 2732 - 200
}
},
// Level 9 - Dangerous ground
{
platforms: [{
x: 200,
y: 2400
}, {
x: 500,
y: 2200
}, {
x: 800,
y: 2000
}, {
x: 1100,
y: 1800
}, {
x: 1400,
y: 1600
}, {
x: 1700,
y: 1400
}],
obstacles: [{
x: 100,
y: 2632 - 100 - 20
}, {
x: 200,
y: 2632 - 100 - 20
}, {
x: 300,
y: 2632 - 100 - 20
}, {
x: 400,
y: 2632 - 100 - 20
}, {
x: 600,
y: 2632 - 100 - 20
}, {
x: 700,
y: 2632 - 100 - 20
}, {
x: 900,
y: 2632 - 100 - 20
}, {
x: 1000,
y: 2632 - 100 - 20
}, {
x: 1200,
y: 2632 - 100 - 20
}, {
x: 1300,
y: 2632 - 100 - 20
}, {
x: 1500,
y: 2632 - 100 - 20
}, {
x: 1600,
y: 2632 - 100 - 20
}, {
x: 1800,
y: 2632 - 100 - 20
}, {
x: 1900,
y: 2632 - 100 - 20
}],
exit: {
x: 1700,
y: 1320
},
playerStart: {
x: 50,
y: 2732 - 200
}
},
// Level 10 - Tower climb
{
platforms: [{
x: 1000,
y: 2400
}, {
x: 1000,
y: 2200
}, {
x: 1000,
y: 2000
}, {
x: 1000,
y: 1800
}, {
x: 1000,
y: 1600
}, {
x: 1000,
y: 1400
}],
obstacles: [{
x: 800,
y: 2632 - 100 - 20
}, {
x: 1200,
y: 2632 - 100 - 20
}, {
x: 900,
y: 2400 - 40
}, {
x: 1100,
y: 2200 - 40
}, {
x: 900,
y: 2000 - 40
}, {
x: 1100,
y: 1800 - 40
}],
exit: {
x: 1000,
y: 1320
},
playerStart: {
x: 100,
y: 2732 - 200
}
},
// Level 11 - Zigzag
{
platforms: [{
x: 200,
y: 2300
}, {
x: 800,
y: 2100
}, {
x: 200,
y: 1900
}, {
x: 800,
y: 1700
}, {
x: 200,
y: 1500
}, {
x: 800,
y: 1300
}],
obstacles: [{
x: 400,
y: 2632 - 100 - 20
}, {
x: 600,
y: 2632 - 100 - 20
}, {
x: 1000,
y: 2632 - 100 - 20
}, {
x: 1200,
y: 2632 - 100 - 20
}],
exit: {
x: 800,
y: 1220
},
playerStart: {
x: 100,
y: 2732 - 200
}
},
// Level 12 - Portal puzzle
{
platforms: [{
x: 300,
y: 2400
}, {
x: 1700,
y: 2400
}, {
x: 1000,
y: 2000
}, {
x: 500,
y: 1600
}, {
x: 1500,
y: 1600
}],
obstacles: [{
x: 1000,
y: 2632 - 100 - 20
}, {
x: 1000,
y: 2400 - 40
}, {
x: 1000,
y: 2000 - 40
}],
exit: {
x: 1000,
y: 1520
},
playerStart: {
x: 100,
y: 2732 - 200
}
},
// Level 13 - Narrow passages
{
platforms: [{
x: 200,
y: 2400
}, {
x: 400,
y: 2200
}, {
x: 600,
y: 2000
}, {
x: 800,
y: 1800
}, {
x: 1000,
y: 1600
}, {
x: 1200,
y: 1400
}, {
x: 1400,
y: 1200
}, {
x: 1600,
y: 1000
}],
obstacles: [{
x: 300,
y: 2632 - 100 - 20
}, {
x: 500,
y: 2632 - 100 - 20
}, {
x: 700,
y: 2632 - 100 - 20
}, {
x: 900,
y: 2632 - 100 - 20
}, {
x: 1100,
y: 2632 - 100 - 20
}, {
x: 1300,
y: 2632 - 100 - 20
}, {
x: 1500,
y: 2632 - 100 - 20
}],
exit: {
x: 1600,
y: 920
},
playerStart: {
x: 100,
y: 2732 - 200
}
},
// Level 14 - Multiple routes
{
platforms: [{
x: 300,
y: 2300
}, {
x: 700,
y: 2100
}, {
x: 1100,
y: 1900
}, {
x: 1500,
y: 1700
}, {
x: 300,
y: 1900
}, {
x: 700,
y: 1700
}, {
x: 1100,
y: 1500
}],
obstacles: [{
x: 500,
y: 2632 - 100 - 20
}, {
x: 900,
y: 2632 - 100 - 20
}, {
x: 1300,
y: 2632 - 100 - 20
}, {
x: 1700,
y: 2632 - 100 - 20
}],
exit: {
x: 1500,
y: 1620
},
playerStart: {
x: 100,
y: 2732 - 200
}
},
// Level 15 - Floating islands
{
platforms: [{
x: 200,
y: 2200
}, {
x: 600,
y: 1800
}, {
x: 1000,
y: 1400
}, {
x: 1400,
y: 1000
}, {
x: 1800,
y: 600
}],
obstacles: [{
x: 400,
y: 2632 - 100 - 20
}, {
x: 800,
y: 2632 - 100 - 20
}, {
x: 1200,
y: 2632 - 100 - 20
}, {
x: 1600,
y: 2632 - 100 - 20
}],
exit: {
x: 1800,
y: 520
},
playerStart: {
x: 100,
y: 2732 - 200
}
},
// Level 16 - Obstacle maze
{
platforms: [{
x: 200,
y: 2400
}, {
x: 500,
y: 2200
}, {
x: 800,
y: 2000
}, {
x: 1100,
y: 1800
}, {
x: 1400,
y: 1600
}, {
x: 1700,
y: 1400
}],
obstacles: [{
x: 350,
y: 2632 - 100 - 20
}, {
x: 650,
y: 2632 - 100 - 20
}, {
x: 950,
y: 2632 - 100 - 20
}, {
x: 1250,
y: 2632 - 100 - 20
}, {
x: 1550,
y: 2632 - 100 - 20
}, {
x: 200,
y: 2400 - 40
}, {
x: 500,
y: 2200 - 40
}, {
x: 800,
y: 2000 - 40
}, {
x: 1100,
y: 1800 - 40
}],
exit: {
x: 1700,
y: 1320
},
playerStart: {
x: 100,
y: 2732 - 200
}
},
// Level 17 - High jump required
{
platforms: [{
x: 400,
y: 2300
}, {
x: 1200,
y: 2000
}, {
x: 800,
y: 1500
}],
obstacles: [{
x: 600,
y: 2632 - 100 - 20
}, {
x: 1000,
y: 2632 - 100 - 20
}, {
x: 1400,
y: 2632 - 100 - 20
}],
exit: {
x: 800,
y: 1420
},
playerStart: {
x: 100,
y: 2732 - 200
}
},
// Level 18 - Portal precision
{
platforms: [{
x: 200,
y: 2400
}, {
x: 600,
y: 2000
}, {
x: 1000,
y: 1600
}, {
x: 1400,
y: 1200
}, {
x: 1800,
y: 800
}],
obstacles: [{
x: 400,
y: 2632 - 100 - 20
}, {
x: 800,
y: 2632 - 100 - 20
}, {
x: 1200,
y: 2632 - 100 - 20
}, {
x: 1600,
y: 2632 - 100 - 20
}],
exit: {
x: 1800,
y: 720
},
playerStart: {
x: 100,
y: 2732 - 200
}
},
// Level 19 - Deadly ground
{
platforms: [{
x: 200,
y: 2300
}, {
x: 500,
y: 2100
}, {
x: 800,
y: 1900
}, {
x: 1100,
y: 1700
}, {
x: 1400,
y: 1500
}, {
x: 1700,
y: 1300
}],
obstacles: [{
x: 50,
y: 2632 - 100 - 20
}, {
x: 100,
y: 2632 - 100 - 20
}, {
x: 150,
y: 2632 - 100 - 20
}, {
x: 250,
y: 2632 - 100 - 20
}, {
x: 300,
y: 2632 - 100 - 20
}, {
x: 350,
y: 2632 - 100 - 20
}, {
x: 400,
y: 2632 - 100 - 20
}, {
x: 450,
y: 2632 - 100 - 20
}, {
x: 550,
y: 2632 - 100 - 20
}, {
x: 600,
y: 2632 - 100 - 20
}, {
x: 650,
y: 2632 - 100 - 20
}, {
x: 700,
y: 2632 - 100 - 20
}, {
x: 750,
y: 2632 - 100 - 20
}, {
x: 850,
y: 2632 - 100 - 20
}, {
x: 900,
y: 2632 - 100 - 20
}, {
x: 950,
y: 2632 - 100 - 20
}, {
x: 1000,
y: 2632 - 100 - 20
}, {
x: 1050,
y: 2632 - 100 - 20
}, {
x: 1150,
y: 2632 - 100 - 20
}, {
x: 1200,
y: 2632 - 100 - 20
}, {
x: 1250,
y: 2632 - 100 - 20
}, {
x: 1300,
y: 2632 - 100 - 20
}, {
x: 1350,
y: 2632 - 100 - 20
}, {
x: 1450,
y: 2632 - 100 - 20
}, {
x: 1500,
y: 2632 - 100 - 20
}, {
x: 1550,
y: 2632 - 100 - 20
}, {
x: 1600,
y: 2632 - 100 - 20
}, {
x: 1650,
y: 2632 - 100 - 20
}, {
x: 1750,
y: 2632 - 100 - 20
}, {
x: 1800,
y: 2632 - 100 - 20
}, {
x: 1850,
y: 2632 - 100 - 20
}, {
x: 1900,
y: 2632 - 100 - 20
}, {
x: 1950,
y: 2632 - 100 - 20
}],
exit: {
x: 1700,
y: 1220
},
playerStart: {
x: 200,
y: 2220
}
},
// Level 20 - Circular platforms
{
platforms: [{
x: 1000,
y: 2300
}, {
x: 600,
y: 2000
}, {
x: 1400,
y: 2000
}, {
x: 400,
y: 1600
}, {
x: 1600,
y: 1600
}, {
x: 800,
y: 1200
}, {
x: 1200,
y: 1200
}],
obstacles: [{
x: 500,
y: 2632 - 100 - 20
}, {
x: 1000,
y: 2632 - 100 - 20
}, {
x: 1500,
y: 2632 - 100 - 20
}],
exit: {
x: 1000,
y: 1120
},
playerStart: {
x: 100,
y: 2732 - 200
}
},
// Level 21-50 continue with increasingly complex layouts
{
platforms: [{
x: 300,
y: 2400
}, {
x: 700,
y: 2200
}, {
x: 1100,
y: 2000
}, {
x: 1500,
y: 1800
}, {
x: 1900,
y: 1600
}],
obstacles: [{
x: 500,
y: 2632 - 100 - 20
}, {
x: 900,
y: 2632 - 100 - 20
}, {
x: 1300,
y: 2632 - 100 - 20
}, {
x: 1700,
y: 2632 - 100 - 20
}],
exit: {
x: 1900,
y: 1520
},
playerStart: {
x: 100,
y: 2732 - 200
}
}, {
platforms: [{
x: 200,
y: 2300
}, {
x: 800,
y: 2100
}, {
x: 200,
y: 1900
}, {
x: 800,
y: 1700
}, {
x: 200,
y: 1500
}],
obstacles: [{
x: 400,
y: 2632 - 100 - 20
}, {
x: 600,
y: 2632 - 100 - 20
}, {
x: 1000,
y: 2632 - 100 - 20
}, {
x: 1200,
y: 2632 - 100 - 20
}],
exit: {
x: 200,
y: 1420
},
playerStart: {
x: 100,
y: 2732 - 200
}
}, {
platforms: [{
x: 500,
y: 2400
}, {
x: 1000,
y: 2200
}, {
x: 1500,
y: 2000
}, {
x: 1000,
y: 1800
}, {
x: 500,
y: 1600
}],
obstacles: [{
x: 250,
y: 2632 - 100 - 20
}, {
x: 750,
y: 2632 - 100 - 20
}, {
x: 1250,
y: 2632 - 100 - 20
}, {
x: 1750,
y: 2632 - 100 - 20
}],
exit: {
x: 500,
y: 1520
},
playerStart: {
x: 100,
y: 2732 - 200
}
}, {
platforms: [{
x: 200,
y: 2000
}, {
x: 600,
y: 1800
}, {
x: 1000,
y: 1600
}, {
x: 1400,
y: 1400
}, {
x: 1800,
y: 1200
}],
obstacles: [{
x: 400,
y: 2632 - 100 - 20
}, {
x: 800,
y: 2632 - 100 - 20
}, {
x: 1200,
y: 2632 - 100 - 20
}, {
x: 1600,
y: 2632 - 100 - 20
}],
exit: {
x: 1800,
y: 1120
},
playerStart: {
x: 100,
y: 2732 - 200
}
}, {
platforms: [{
x: 300,
y: 2300
}, {
x: 900,
y: 2100
}, {
x: 1500,
y: 1900
}, {
x: 600,
y: 1700
}, {
x: 1200,
y: 1500
}],
obstacles: [{
x: 150,
y: 2632 - 100 - 20
}, {
x: 450,
y: 2632 - 100 - 20
}, {
x: 750,
y: 2632 - 100 - 20
}, {
x: 1050,
y: 2632 - 100 - 20
}, {
x: 1350,
y: 2632 - 100 - 20
}, {
x: 1650,
y: 2632 - 100 - 20
}, {
x: 1950,
y: 2632 - 100 - 20
}],
exit: {
x: 1200,
y: 1420
},
playerStart: {
x: 100,
y: 2732 - 200
}
}, {
platforms: [{
x: 400,
y: 2400
}, {
x: 1200,
y: 2000
}, {
x: 800,
y: 1600
}, {
x: 1600,
y: 1200
}],
obstacles: [{
x: 200,
y: 2632 - 100 - 20
}, {
x: 600,
y: 2632 - 100 - 20
}, {
x: 1000,
y: 2632 - 100 - 20
}, {
x: 1400,
y: 2632 - 100 - 20
}, {
x: 1800,
y: 2632 - 100 - 20
}],
exit: {
x: 1600,
y: 1120
},
playerStart: {
x: 100,
y: 2732 - 200
}
}, {
platforms: [{
x: 200,
y: 2200
}, {
x: 700,
y: 2000
}, {
x: 1200,
y: 1800
}, {
x: 1700,
y: 1600
}, {
x: 1000,
y: 1400
}],
obstacles: [{
x: 350,
y: 2632 - 100 - 20
}, {
x: 550,
y: 2632 - 100 - 20
}, {
x: 850,
y: 2632 - 100 - 20
}, {
x: 1050,
y: 2632 - 100 - 20
}, {
x: 1350,
y: 2632 - 100 - 20
}, {
x: 1550,
y: 2632 - 100 - 20
}],
exit: {
x: 1000,
y: 1320
},
playerStart: {
x: 100,
y: 2732 - 200
}
}, {
platforms: [{
x: 500,
y: 2300
}, {
x: 1000,
y: 2100
}, {
x: 1500,
y: 1900
}, {
x: 500,
y: 1700
}, {
x: 1000,
y: 1500
}],
obstacles: [{
x: 250,
y: 2632 - 100 - 20
}, {
x: 750,
y: 2632 - 100 - 20
}, {
x: 1250,
y: 2632 - 100 - 20
}, {
x: 1750,
y: 2632 - 100 - 20
}],
exit: {
x: 1000,
y: 1420
},
playerStart: {
x: 100,
y: 2732 - 200
}
}, {
platforms: [{
x: 300,
y: 2400
}, {
x: 800,
y: 2200
}, {
x: 1300,
y: 2000
}, {
x: 1800,
y: 1800
}, {
x: 1000,
y: 1600
}],
obstacles: [{
x: 100,
y: 2632 - 100 - 20
}, {
x: 500,
y: 2632 - 100 - 20
}, {
x: 1000,
y: 2632 - 100 - 20
}, {
x: 1500,
y: 2632 - 100 - 20
}, {
x: 1900,
y: 2632 - 100 - 20
}],
exit: {
x: 1000,
y: 1520
},
playerStart: {
x: 100,
y: 2732 - 200
}
}, {
platforms: [{
x: 200,
y: 2300
}, {
x: 600,
y: 2100
}, {
x: 1000,
y: 1900
}, {
x: 1400,
y: 1700
}, {
x: 1800,
y: 1500
}],
obstacles: [{
x: 400,
y: 2632 - 100 - 20
}, {
x: 800,
y: 2632 - 100 - 20
}, {
x: 1200,
y: 2632 - 100 - 20
}, {
x: 1600,
y: 2632 - 100 - 20
}],
exit: {
x: 1800,
y: 1420
},
playerStart: {
x: 100,
y: 2732 - 200
}
}, {
platforms: [{
x: 400,
y: 2400
}, {
x: 1200,
y: 2200
}, {
x: 800,
y: 2000
}, {
x: 1600,
y: 1800
}, {
x: 1000,
y: 1600
}],
obstacles: [{
x: 200,
y: 2632 - 100 - 20
}, {
x: 600,
y: 2632 - 100 - 20
}, {
x: 1000,
y: 2632 - 100 - 20
}, {
x: 1400,
y: 2632 - 100 - 20
}, {
x: 1800,
y: 2632 - 100 - 20
}],
exit: {
x: 1000,
y: 1520
},
playerStart: {
x: 100,
y: 2732 - 200
}
}, {
platforms: [{
x: 300,
y: 2300
}, {
x: 900,
y: 2100
}, {
x: 1500,
y: 1900
}, {
x: 600,
y: 1700
}, {
x: 1200,
y: 1500
}, {
x: 1800,
y: 1300
}],
obstacles: [{
x: 150,
y: 2632 - 100 - 20
}, {
x: 450,
y: 2632 - 100 - 20
}, {
x: 750,
y: 2632 - 100 - 20
}, {
x: 1050,
y: 2632 - 100 - 20
}, {
x: 1350,
y: 2632 - 100 - 20
}, {
x: 1650,
y: 2632 - 100 - 20
}, {
x: 1950,
y: 2632 - 100 - 20
}],
exit: {
x: 1800,
y: 1220
},
playerStart: {
x: 100,
y: 2732 - 200
}
}, {
platforms: [{
x: 500,
y: 2400
}, {
x: 1000,
y: 2200
}, {
x: 1500,
y: 2000
}, {
x: 1000,
y: 1800
}, {
x: 500,
y: 1600
}, {
x: 1000,
y: 1400
}],
obstacles: [{
x: 250,
y: 2632 - 100 - 20
}, {
x: 750,
y: 2632 - 100 - 20
}, {
x: 1250,
y: 2632 - 100 - 20
}, {
x: 1750,
y: 2632 - 100 - 20
}],
exit: {
x: 1000,
y: 1320
},
playerStart: {
x: 100,
y: 2732 - 200
}
}, {
platforms: [{
x: 200,
y: 2200
}, {
x: 800,
y: 2000
}, {
x: 1400,
y: 1800
}, {
x: 500,
y: 1600
}, {
x: 1100,
y: 1400
}, {
x: 1700,
y: 1200
}],
obstacles: [{
x: 350,
y: 2632 - 100 - 20
}, {
x: 650,
y: 2632 - 100 - 20
}, {
x: 950,
y: 2632 - 100 - 20
}, {
x: 1250,
y: 2632 - 100 - 20
}, {
x: 1550,
y: 2632 - 100 - 20
}, {
x: 1850,
y: 2632 - 100 - 20
}],
exit: {
x: 1700,
y: 1120
},
playerStart: {
x: 100,
y: 2732 - 200
}
}, {
platforms: [{
x: 400,
y: 2400
}, {
x: 1200,
y: 2000
}, {
x: 800,
y: 1600
}, {
x: 1600,
y: 1200
}, {
x: 1000,
y: 800
}],
obstacles: [{
x: 200,
y: 2632 - 100 - 20
}, {
x: 600,
y: 2632 - 100 - 20
}, {
x: 1000,
y: 2632 - 100 - 20
}, {
x: 1400,
y: 2632 - 100 - 20
}, {
x: 1800,
y: 2632 - 100 - 20
}],
exit: {
x: 1000,
y: 720
},
playerStart: {
x: 100,
y: 2732 - 200
}
}, {
platforms: [{
x: 300,
y: 2300
}, {
x: 700,
y: 2100
}, {
x: 1100,
y: 1900
}, {
x: 1500,
y: 1700
}, {
x: 1900,
y: 1500
}, {
x: 1500,
y: 1300
}, {
x: 1100,
y: 1100
}],
obstacles: [{
x: 100,
y: 2632 - 100 - 20
}, {
x: 500,
y: 2632 - 100 - 20
}, {
x: 900,
y: 2632 - 100 - 20
}, {
x: 1300,
y: 2632 - 100 - 20
}, {
x: 1700,
y: 2632 - 100 - 20
}],
exit: {
x: 1100,
y: 1020
},
playerStart: {
x: 100,
y: 2732 - 200
}
}, {
platforms: [{
x: 200,
y: 2400
}, {
x: 600,
y: 2200
}, {
x: 1000,
y: 2000
}, {
x: 1400,
y: 1800
}, {
x: 1800,
y: 1600
}, {
x: 1400,
y: 1400
}, {
x: 1000,
y: 1200
}, {
x: 600,
y: 1000
}],
obstacles: [{
x: 400,
y: 2632 - 100 - 20
}, {
x: 800,
y: 2632 - 100 - 20
}, {
x: 1200,
y: 2632 - 100 - 20
}, {
x: 1600,
y: 2632 - 100 - 20
}],
exit: {
x: 600,
y: 920
},
playerStart: {
x: 100,
y: 2732 - 200
}
}, {
platforms: [{
x: 500,
y: 2300
}, {
x: 1000,
y: 2100
}, {
x: 1500,
y: 1900
}, {
x: 1000,
y: 1700
}, {
x: 500,
y: 1500
}, {
x: 1000,
y: 1300
}, {
x: 1500,
y: 1100
}],
obstacles: [{
x: 250,
y: 2632 - 100 - 20
}, {
x: 750,
y: 2632 - 100 - 20
}, {
x: 1250,
y: 2632 - 100 - 20
}, {
x: 1750,
y: 2632 - 100 - 20
}],
exit: {
x: 1500,
y: 1020
},
playerStart: {
x: 100,
y: 2732 - 200
}
}, {
platforms: [{
x: 300,
y: 2200
}, {
x: 900,
y: 2000
}, {
x: 1500,
y: 1800
}, {
x: 600,
y: 1600
}, {
x: 1200,
y: 1400
}, {
x: 1800,
y: 1200
}, {
x: 1000,
y: 1000
}],
obstacles: [{
x: 150,
y: 2632 - 100 - 20
}, {
x: 450,
y: 2632 - 100 - 20
}, {
x: 750,
y: 2632 - 100 - 20
}, {
x: 1050,
y: 2632 - 100 - 20
}, {
x: 1350,
y: 2632 - 100 - 20
}, {
x: 1650,
y: 2632 - 100 - 20
}, {
x: 1950,
y: 2632 - 100 - 20
}],
exit: {
x: 1000,
y: 920
},
playerStart: {
x: 100,
y: 2732 - 200
}
}, {
platforms: [{
x: 400,
y: 2400
}, {
x: 1200,
y: 2200
}, {
x: 800,
y: 2000
}, {
x: 1600,
y: 1800
}, {
x: 1000,
y: 1600
}, {
x: 1800,
y: 1400
}, {
x: 1400,
y: 1200
}, {
x: 600,
y: 1000
}],
obstacles: [{
x: 200,
y: 2632 - 100 - 20
}, {
x: 600,
y: 2632 - 100 - 20
}, {
x: 1000,
y: 2632 - 100 - 20
}, {
x: 1400,
y: 2632 - 100 - 20
}, {
x: 1800,
y: 2632 - 100 - 20
}],
exit: {
x: 600,
y: 920
},
playerStart: {
x: 100,
y: 2732 - 200
}
}, {
platforms: [{
x: 200,
y: 2300
}, {
x: 700,
y: 2100
}, {
x: 1200,
y: 1900
}, {
x: 1700,
y: 1700
}, {
x: 1200,
y: 1500
}, {
x: 700,
y: 1300
}, {
x: 200,
y: 1100
}, {
x: 1000,
y: 900
}],
obstacles: [{
x: 350,
y: 2632 - 100 - 20
}, {
x: 550,
y: 2632 - 100 - 20
}, {
x: 850,
y: 2632 - 100 - 20
}, {
x: 1050,
y: 2632 - 100 - 20
}, {
x: 1350,
y: 2632 - 100 - 20
}, {
x: 1550,
y: 2632 - 100 - 20
}, {
x: 1850,
y: 2632 - 100 - 20
}],
exit: {
x: 1000,
y: 820
},
playerStart: {
x: 100,
y: 2732 - 200
}
}, {
platforms: [{
x: 500,
y: 2400
}, {
x: 1000,
y: 2200
}, {
x: 1500,
y: 2000
}, {
x: 1000,
y: 1800
}, {
x: 500,
y: 1600
}, {
x: 1000,
y: 1400
}, {
x: 1500,
y: 1200
}, {
x: 1000,
y: 1000
}, {
x: 500,
y: 800
}],
obstacles: [{
x: 250,
y: 2632 - 100 - 20
}, {
x: 750,
y: 2632 - 100 - 20
}, {
x: 1250,
y: 2632 - 100 - 20
}, {
x: 1750,
y: 2632 - 100 - 20
}],
exit: {
x: 500,
y: 720
},
playerStart: {
x: 100,
y: 2732 - 200
}
}, {
platforms: [{
x: 300,
y: 2300
}, {
x: 800,
y: 2100
}, {
x: 1300,
y: 1900
}, {
x: 1800,
y: 1700
}, {
x: 1300,
y: 1500
}, {
x: 800,
y: 1300
}, {
x: 300,
y: 1100
}, {
x: 800,
y: 900
}, {
x: 1300,
y: 700
}],
obstacles: [{
x: 100,
y: 2632 - 100 - 20
}, {
x: 500,
y: 2632 - 100 - 20
}, {
x: 1000,
y: 2632 - 100 - 20
}, {
x: 1500,
y: 2632 - 100 - 20
}, {
x: 1900,
y: 2632 - 100 - 20
}],
exit: {
x: 1300,
y: 620
},
playerStart: {
x: 100,
y: 2732 - 200
}
}, {
platforms: [{
x: 200,
y: 2200
}, {
x: 600,
y: 2000
}, {
x: 1000,
y: 1800
}, {
x: 1400,
y: 1600
}, {
x: 1800,
y: 1400
}, {
x: 1400,
y: 1200
}, {
x: 1000,
y: 1000
}, {
x: 600,
y: 800
}, {
x: 200,
y: 600
}],
obstacles: [{
x: 400,
y: 2632 - 100 - 20
}, {
x: 800,
y: 2632 - 100 - 20
}, {
x: 1200,
y: 2632 - 100 - 20
}, {
x: 1600,
y: 2632 - 100 - 20
}],
exit: {
x: 200,
y: 520
},
playerStart: {
x: 100,
y: 2732 - 200
}
}, {
platforms: [{
x: 400,
y: 2400
}, {
x: 1200,
y: 2000
}, {
x: 800,
y: 1600
}, {
x: 1600,
y: 1200
}, {
x: 1000,
y: 800
}, {
x: 1800,
y: 400
}],
obstacles: [{
x: 200,
y: 2632 - 100 - 20
}, {
x: 600,
y: 2632 - 100 - 20
}, {
x: 1000,
y: 2632 - 100 - 20
}, {
x: 1400,
y: 2632 - 100 - 20
}, {
x: 1800,
y: 2632 - 100 - 20
}],
exit: {
x: 1800,
y: 320
},
playerStart: {
x: 100,
y: 2732 - 200
}
}, {
platforms: [{
x: 300,
y: 2300
}, {
x: 900,
y: 2100
}, {
x: 1500,
y: 1900
}, {
x: 600,
y: 1700
}, {
x: 1200,
y: 1500
}, {
x: 1800,
y: 1300
}, {
x: 1000,
y: 1100
}, {
x: 400,
y: 900
}, {
x: 1600,
y: 700
}, {
x: 800,
y: 500
}],
obstacles: [{
x: 150,
y: 2632 - 100 - 20
}, {
x: 450,
y: 2632 - 100 - 20
}, {
x: 750,
y: 2632 - 100 - 20
}, {
x: 1050,
y: 2632 - 100 - 20
}, {
x: 1350,
y: 2632 - 100 - 20
}, {
x: 1650,
y: 2632 - 100 - 20
}, {
x: 1950,
y: 2632 - 100 - 20
}],
exit: {
x: 800,
y: 420
},
playerStart: {
x: 100,
y: 2732 - 200
}
}, {
platforms: [{
x: 1000,
y: 2400
}, {
x: 1000,
y: 2200
}, {
x: 1000,
y: 2000
}, {
x: 1000,
y: 1800
}, {
x: 1000,
y: 1600
}, {
x: 1000,
y: 1400
}, {
x: 1000,
y: 1200
}, {
x: 1000,
y: 1000
}, {
x: 1000,
y: 800
}, {
x: 1000,
y: 600
}, {
x: 1000,
y: 400
}],
obstacles: [{
x: 800,
y: 2632 - 100 - 20
}, {
x: 1200,
y: 2632 - 100 - 20
}, {
x: 900,
y: 2400 - 40
}, {
x: 1100,
y: 2200 - 40
}, {
x: 900,
y: 2000 - 40
}, {
x: 1100,
y: 1800 - 40
}, {
x: 900,
y: 1600 - 40
}, {
x: 1100,
y: 1400 - 40
}, {
x: 900,
y: 1200 - 40
}, {
x: 1100,
y: 1000 - 40
}, {
x: 900,
y: 800 - 40
}, {
x: 1100,
y: 600 - 40
}],
exit: {
x: 1000,
y: 320
},
playerStart: {
x: 100,
y: 2732 - 200
}
}];
// Create ground
var ground = game.addChild(LK.getAsset('ground', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 2732 - 50
}));
// Create player
player = game.addChild(new Player());
// Create level display
levelTxt = new Text2('Level 1', {
size: 80,
fill: 0xFFD700
});
levelTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(levelTxt);
levelTxt.y = 200;
// Load the first level
loadLevel(1);
// Create UI instructions
var instructionTxt = new Text2('Tap to create portals\nHold sides to move\nHold top to jump', {
size: 60,
fill: 0xFFFFFF
});
instructionTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(instructionTxt);
instructionTxt.y = 100;
// Declare levelTxt in global scope
var levelTxt;
// Control areas
var leftControlArea = {
x: 0,
y: 0,
width: 683,
height: 2732
};
var rightControlArea = {
x: 1365,
y: 0,
width: 683,
height: 2732
};
var jumpControlArea = {
x: 683,
y: 0,
width: 682,
height: 400
};
function isPointInArea(x, y, area) {
return x >= area.x && x <= area.x + area.width && y >= area.y && y <= area.y + area.height;
}
function loadLevel(levelNum) {
// Clear existing level elements
for (var i = platforms.length - 1; i >= 0; i--) {
platforms[i].destroy();
}
platforms = [];
for (var i = obstacles.length - 1; i >= 0; i--) {
obstacles[i].destroy();
}
obstacles = [];
if (exit) {
exit.destroy();
exit = null;
}
if (portal1) {
portal1.destroy();
portal1 = null;
}
if (portal2) {
portal2.destroy();
portal2 = null;
}
portalCount = 0;
// Load new level data
var level = levelData[levelNum - 1];
// Create platforms
for (var i = 0; i < level.platforms.length; i++) {
var platformData = level.platforms[i];
var platform = game.addChild(new Platform());
platform.x = platformData.x;
platform.y = platformData.y;
platforms.push(platform);
}
// Create obstacles
for (var i = 0; i < level.obstacles.length; i++) {
var obstacleData = level.obstacles[i];
var obstacle = game.addChild(new Obstacle());
obstacle.x = obstacleData.x;
obstacle.y = obstacleData.y;
obstacles.push(obstacle);
}
// Create exit
exit = game.addChild(new Exit());
exit.x = level.exit.x;
exit.y = level.exit.y;
// Set player position
player.x = level.playerStart.x;
player.y = level.playerStart.y;
player.velocityX = 0;
player.velocityY = 0;
player.onGround = false;
player.canTeleport = true;
// Update level display
levelTxt.setText('Level ' + levelNum);
currentLevel = levelNum;
}
function createPortal(x, y) {
if (portalCount === 0) {
// Create first portal
portal1 = game.addChild(new Portal());
portal1.x = x;
portal1.y = y;
portalCount = 1;
LK.getSound('portal_create').play();
} else if (portalCount === 1) {
// Create second portal and activate both
portal2 = game.addChild(new Portal());
portal2.x = x;
portal2.y = y;
portal1.activate();
portal2.activate();
portalCount = 2;
LK.getSound('portal_create').play();
} else {
// Replace portals
if (portal1) {
portal1.destroy();
}
if (portal2) {
portal2.destroy();
}
portal1 = game.addChild(new Portal());
portal1.x = x;
portal1.y = y;
portal2 = null;
portalCount = 1;
LK.getSound('portal_create').play();
}
}
game.down = function (x, y, obj) {
if (isPointInArea(x, y, leftControlArea)) {
leftPressed = true;
} else if (isPointInArea(x, y, rightControlArea)) {
rightPressed = true;
} else if (isPointInArea(x, y, jumpControlArea)) {
jumpPressed = true;
} else {
// Create portal in game area
createPortal(x, y);
}
};
game.up = function (x, y, obj) {
leftPressed = false;
rightPressed = false;
jumpPressed = false;
};
game.update = function () {
// Handle controls
if (leftPressed) {
player.moveLeft();
}
if (rightPressed) {
player.moveRight();
}
if (jumpPressed) {
player.jump();
}
};