User prompt
diken ekle oyunda raskele bir şekilde çok fazla olmayacak şekilde seede göre oluşsun
User prompt
portal oluştuğuna bütün engelleri gizle
User prompt
kalp aldığında puan 2 şer atrsın
User prompt
kalp aldığında 1 puan arttır
User prompt
puan engellerden geşince artsın,
User prompt
puanı arttır
User prompt
puannı her engelden geçince arttır
User prompt
her engel dizisinden geçince 1 puan artsın
User prompt
portalın etrafında engeller olsun
User prompt
1. level için puan 10 olduğunda porlat oluşsun
User prompt
puan 40 olduğunda portal oluşsun
User prompt
puan 10 olduğunda portal oluşsun
User prompt
40 puana gelince portal oluşsun
User prompt
level bitmeden kapı oluşmasın
User prompt
level göstergesi eklermisin
User prompt
her level arasında portal olsun
User prompt
seed di her seferinde değiştir
User prompt
oyunu sıfırla ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
oyunu sıfırla
User prompt
level 1 i eski haline getir
User prompt
level 1 engellerinin arasındaki mesafeyi arttır
User prompt
laval 1 de engellerin boşluklarını arttırın
User prompt
engellerin arasını bayağı arttırın
User prompt
engellerin arasını açalım
User prompt
engellerin arasını kuş geçecek kadar ayarlayalım
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1", { currentLevel: 1, unlockedLevels: 1, totalScore: 0 }); /**** * Classes ****/ var BackgroundShape = Container.expand(function () { var self = Container.call(this); var shapeTypes = ['bgCircle', 'bgSquare', 'bgTriangle']; var randomType = shapeTypes[Math.floor(Math.random() * shapeTypes.length)]; var shapeGraphics = self.attachAsset(randomType, { anchorX: 0.5, anchorY: 0.5 }); self.speed = -1 - Math.random() * 2; // Random speed between -1 and -3 self.rotationSpeed = (Math.random() - 0.5) * 0.02; // Random rotation self.pulseScale = 1; self.pulseDirection = 1; self.alpha = 0.3 + Math.random() * 0.4; // Random transparency between 0.3-0.7 shapeGraphics.alpha = self.alpha; self.update = function () { self.x += self.speed; // Add rotation shapeGraphics.rotation += self.rotationSpeed; // Add subtle pulsing self.pulseScale += 0.003 * self.pulseDirection; if (self.pulseScale > 1.1) self.pulseDirection = -1; if (self.pulseScale < 0.9) self.pulseDirection = 1; shapeGraphics.scaleX = self.pulseScale; shapeGraphics.scaleY = self.pulseScale; }; return self; }); var Bird = Container.expand(function () { var self = Container.call(this); var birdGraphics = self.attachAsset('bird', { anchorX: 0.5, anchorY: 0.5 }); // Ensure bird is visible birdGraphics.alpha = 1.0; birdGraphics.visible = true; self.velocityY = 0; self.gravity = 0.8; self.flapPower = -12; self.rotation = 0; self.rotationVelocity = 0; self.isFlipping = false; self.completedFlips = 0; self.lastUpright = true; self.flap = function () { self.velocityY = self.flapPower; LK.getSound('flap').play(); }; self.update = function () { // Apply gravity self.velocityY += self.gravity; self.y += self.velocityY; // Add continuous rotation to bird character birdGraphics.rotation += 0.1; // Keep bird in bounds horizontally if (self.x < 40) self.x = 40; if (self.x > 2008) self.x = 2008; }; self.isUpright = function () { var normalizedRotation = self.rotation % (Math.PI * 2); return normalizedRotation < 0.3 || normalizedRotation > Math.PI * 2 - 0.3; }; return self; }); var Heart = Container.expand(function () { var self = Container.call(this); var heartGraphics = self.attachAsset('heart', { anchorX: 0.5, anchorY: 0.5, scaleX: 2, scaleY: 2 }); self.speed = -3; self.collected = false; self.pulseScale = 1; self.pulseDirection = 1; self.floatOffset = 0; // Add pulsing and floating animation self.update = function () { self.x += self.speed; // Pulsing effect self.pulseScale += 0.01 * self.pulseDirection; if (self.pulseScale > 1.2) self.pulseDirection = -1; if (self.pulseScale < 0.8) self.pulseDirection = 1; heartGraphics.scaleX = self.pulseScale; heartGraphics.scaleY = self.pulseScale; // Floating effect self.floatOffset += 0.05; heartGraphics.y = Math.sin(self.floatOffset) * 10; }; return self; }); var Obstacle = Container.expand(function () { var self = Container.call(this); // Choose obstacle type from level-specific sequence var randomType = 'block'; // Default fallback if (levelObstacleTypes.length > 0) { var typeIndex = obstacleCounter % levelObstacleTypes.length; randomType = levelObstacleTypes[typeIndex]; } var obstacleGraphics = self.attachAsset(randomType, { anchorX: 0.5, anchorY: 0.5 }); self.speed = -3; self.passed = false; self.obstacleType = randomType; // Add visual effects for Geometry Dash style self.pulseScale = 1; self.pulseDirection = 1; self.rotationSpeed = 0; self.isStationary = false; // Set rotation speed for certain types if (randomType === 'spike' || randomType === 'block') { self.rotationSpeed = 0.02; } // Set rest platform specific properties if (randomType === 'restPlatform') { self.speed = 0; // Rest platforms don't move horizontally self.isStationary = true; self.isSafe = true; // Mark as safe platform } // Set door specific properties if (randomType === 'door') { self.speed = -1; // Doors move slower self.isDoor = true; // Mark as door for special collision handling self.pulseScale = 1.1; // Start with larger pulse for visibility } self.update = function () { // Only move if not stationary if (!self.isStationary) { self.x += self.speed; } // Add pulsing effect only for non-rest platform obstacles if (self.obstacleType !== 'restPlatform') { self.pulseScale += 0.005 * self.pulseDirection; if (self.pulseScale > 1.05) self.pulseDirection = -1; if (self.pulseScale < 0.98) self.pulseDirection = 1; obstacleGraphics.scaleX = self.pulseScale; obstacleGraphics.scaleY = self.pulseScale; } // Add rotation for certain obstacles if (self.rotationSpeed > 0) { obstacleGraphics.rotation += self.rotationSpeed; } }; return self; }); var Portal = Container.expand(function () { var self = Container.call(this); var portalGraphics = self.attachAsset('door', { anchorX: 0.5, anchorY: 0.5, scaleX: 1.5, scaleY: 1.5 }); self.speed = -2; self.passed = false; self.isPortal = true; self.pulseScale = 1; self.pulseDirection = 1; self.rotationSpeed = 0.01; // Portal specific visual effects portalGraphics.tint = 0x9966ff; // Purple tint for portal self.update = function () { self.x += self.speed; // Enhanced pulsing effect for portal self.pulseScale += 0.008 * self.pulseDirection; if (self.pulseScale > 1.3) self.pulseDirection = -1; if (self.pulseScale < 0.8) self.pulseDirection = 1; portalGraphics.scaleX = self.pulseScale * 1.5; portalGraphics.scaleY = self.pulseScale * 1.5; // Portal rotation portalGraphics.rotation += self.rotationSpeed; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87CEEB }); /**** * Game Code ****/ var bird; var obstacles = []; var hearts = []; var backgroundShapes = []; var portals = []; var ground; var gameStarted = false; var lastObstacle = 0; var obstacleSpacing = 400; var currentLevel = 1; var unlockedLevels = 1; var totalScore = 0; var levelScoreThreshold = 10; // Score needed to unlock next level var obstacleCounter = 0; // Counter for obstacle generation var levelObstacleTypes = []; // Array to store shuffled obstacle types for current level var playerHealth = 3; // Player starts with 3 lives var lastBackgroundShape = 0; var backgroundShapeSpacing = 800; // Spacing between background shapes var missedHearts = 0; // Track how many hearts were missed var portalSpawned = false; // Track if portal has been spawned for current level // Reset game score LK.setScore(0); // Create score display var scoreTxt = new Text2('0', { size: 80, fill: 0xFFFFFF }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); scoreTxt.y = 100; // Reset storage values to initial state storage.currentLevel = 1; storage.unlockedLevels = 1; storage.totalScore = 0; // Create level display var levelTxt = new Text2('Level ' + currentLevel, { size: 70, fill: 0xFFD700 }); levelTxt.anchor.set(0.5, 0); LK.gui.top.addChild(levelTxt); levelTxt.y = 180; // Create level progress display var progressTxt = new Text2('Progress: 0/' + levelScoreThreshold, { size: 40, fill: 0xFFFFFF }); progressTxt.anchor.set(0.5, 0); LK.gui.top.addChild(progressTxt); progressTxt.y = 280; // Create health display var healthTxt = new Text2('Lives: ' + playerHealth, { size: 50, fill: 0xff0000 }); healthTxt.anchor.set(0.5, 0); LK.gui.top.addChild(healthTxt); healthTxt.y = 340; // Create instructions var instructionTxt = new Text2('TAP TO FLIP AND FLY\nBOUNCE OFF OBSTACLES!', { size: 60, fill: 0xFFFFFF }); instructionTxt.anchor.set(0.5, 0.5); game.addChild(instructionTxt); instructionTxt.x = 1024; instructionTxt.y = 1000; // Create ground ground = game.addChild(LK.getAsset('ground', { anchorX: 0, anchorY: 0 })); ground.x = 0; ground.y = 2632; // Create bird bird = game.addChild(new Bird()); bird.x = 300; bird.y = 800; // Generate initial obstacle sequence for current level generateLevelObstacleSequence(); // Create initial obstacles at game start createObstacle(); // Create initial background shapes for (var i = 0; i < 5; i++) { createBackgroundShape(); } function generateLevelObstacleSequence() { levelObstacleTypes = []; var baseTypes = ['spike', 'block', 'tallBlock', 'platform', 'restPlatform', 'restPlatform', 'restPlatform', 'door']; // Added door obstacle type var sequenceLength = 50; // Generate enough types for a full level var seed = currentLevel * 12345 + Date.now(); // Level-based seed plus current time for different patterns each time for (var i = 0; i < sequenceLength; i++) { seed = (seed * 9301 + 49297) % 233280; var randomIndex = Math.floor(seed / 233280 * baseTypes.length); levelObstacleTypes.push(baseTypes[randomIndex]); } } function updateLevelProgress() { var levelProgress = LK.getScore(); var progressNeeded = levelScoreThreshold * currentLevel; // Update progress display progressTxt.setText('Progress: ' + levelProgress + '/' + progressNeeded); } function updateDifficultyForLevel() { // Each level increases difficulty var difficultyMultiplier = 1 + (currentLevel - 1) * 0.3; // Adjust obstacle spacing based on level obstacleSpacing = Math.max(200, 400 - (currentLevel - 1) * 20); // Adjust bird physics slightly for higher levels if (currentLevel > 3) { bird.gravity = 0.8 + (currentLevel - 3) * 0.1; } } function resetToLevelStart() { // Reset to level 1 when game over occurs currentLevel = 1; storage.currentLevel = 1; levelTxt.setText('Level ' + currentLevel); // Reset score to level start LK.setScore(0); scoreTxt.setText(0); // Reset health playerHealth = 3; healthTxt.setText('Lives: ' + playerHealth); // Clear all obstacles for (var i = obstacles.length - 1; i >= 0; i--) { obstacles[i].destroy(); obstacles.splice(i, 1); } // Clear all background shapes for (var j = backgroundShapes.length - 1; j >= 0; j--) { backgroundShapes[j].destroy(); backgroundShapes.splice(j, 1); } // Clear all hearts for (var k = hearts.length - 1; k >= 0; k--) { hearts[k].destroy(); hearts.splice(k, 1); } // Clear all portals for (var p = portals.length - 1; p >= 0; p--) { portals[p].destroy(); portals.splice(p, 1); } // Reset obstacle counter obstacleCounter = 0; // Reset missed hearts counter missedHearts = 0; // Reset portal spawned flag portalSpawned = false; // Reset bird position bird.x = 300; bird.y = 800; bird.velocityY = 0; bird.completedFlips = 0; // Regenerate obstacle sequence for current level generateLevelObstacleSequence(); // Update displays updateLevelProgress(); // Update difficulty for level 1 updateDifficultyForLevel(); // Create initial obstacle createObstacle(); } function takeDamage() { playerHealth--; healthTxt.setText('Lives: ' + playerHealth); // Flash screen red when taking damage tween(game, { tint: 0xff4444 }, { duration: 200, onFinish: function onFinish() { tween(game, { tint: 0xffffff }, { duration: 200 }); } }); // Check if game over if (playerHealth <= 0) { // Show game over screen with level button showGameOverWithLevelButton(); } } function resetHealth() { playerHealth = 3; healthTxt.setText('Lives: ' + playerHealth); } function startGame() { if (!gameStarted) { gameStarted = true; game.removeChild(instructionTxt); // Reset obstacle counter for consistent level maps obstacleCounter = 0; // Generate obstacle sequence for current level generateLevelObstacleSequence(); resetHealth(); // Reset health when starting game updateDifficultyForLevel(); updateLevelProgress(); } } function createBackgroundShape() { var bgShape = new BackgroundShape(); bgShape.x = 2200 + Math.random() * 200; // Start off-screen right bgShape.y = 200 + Math.random() * 2300; // Random Y position backgroundShapes.push(bgShape); game.addChild(bgShape); } function createHeart() { var heart = new Heart(); heart.x = 2200; // Start off-screen right heart.y = 300 + Math.random() * 2000; // Random Y position within playable area hearts.push(heart); game.addChild(heart); } function createObstacle() { // Create walls that cover full screen with a gap for the bird var baseX = 2148; var gapSize = 600; // Size of the gap for bird to pass through - significantly increased for much easier passage // Make level 1 much easier with larger gaps if (currentLevel === 1) { gapSize = 600; // Reset to original gap size for level 1 } else if (currentLevel >= 4) { // Use a progressive gap size that stays large but gets slightly smaller with more obstacles var progressiveGapSize = Math.max(500, 600 - obstacleCounter * 2); // Start at 600, reduce by 2 per obstacle, minimum 500 gapSize = progressiveGapSize; } // Use seeded random based on current level, obstacle counter and current time for different maps each time var seed = (currentLevel * 1000 + obstacleCounter + Date.now()) % 9973; // Use prime number for better distribution plus time var seededRandom = (seed * 9301 + 49297) % 233280 / 233280; // Linear congruential generator var gapPosition = seededRandom * (2200 - gapSize) + 300; // Seeded gap position between 300-2200 var obstacleHeight = 320; // Height of each obstacle segment (reduced from 400) // Reduce obstacle height for Level 4 to create more segments and fill gaps if (currentLevel >= 4) { obstacleHeight = 240; // Smaller segments create more obstacles (reduced from 300) } var numSegments = Math.ceil(2732 / obstacleHeight); // Number of segments to cover full height for (var i = 0; i < numSegments; i++) { var segmentY = i * obstacleHeight + obstacleHeight / 2; // Skip creating obstacles in the gap area if (segmentY + obstacleHeight / 2 > gapPosition && segmentY - obstacleHeight / 2 < gapPosition + gapSize) { continue; } var obstacle = new Obstacle(); obstacle.x = baseX; obstacle.y = segmentY; obstacles.push(obstacle); game.addChild(obstacle); } // Add extra obstacles to fill empty spaces for all levels (not just level 4+) var extraObstacles = 6 + Math.floor(seededRandom * 4); // 6-9 additional obstacles (increased from 4-6) for (var j = 0; j < extraObstacles; j++) { var extraSeed = (seed + j * 777) % 9973; var extraRandom = (extraSeed * 9301 + 49297) % 233280 / 233280; var obstacleX = baseX + 150 + extraRandom * 600; // Spread across wider area var obstacleY = 200 + extraRandom * 2200; // Cover more vertical space // Make sure it's not in the main gap area if (obstacleY < gapPosition - 50 || obstacleY > gapPosition + gapSize + 50) { var extraObstacle = new Obstacle(); extraObstacle.x = obstacleX; extraObstacle.y = obstacleY; obstacles.push(extraObstacle); game.addChild(extraObstacle); } } // Add obstacles in the middle area between main wall and character starting position var middleObstacles = 5 + Math.floor(seededRandom * 3); // 5-7 middle obstacles (increased from 3-4) for (var m = 0; m < middleObstacles; m++) { var middleSeed = (seed + m * 333 + 111) % 9973; var middleRandom = (middleSeed * 9301 + 49297) % 233280 / 233280; var middleX = baseX - 400 - middleRandom * 800; // Place between character and main wall var middleY = 300 + middleRandom * 2000; // Random Y position // Ensure obstacles are within screen bounds and spread out if (middleX > 500 && middleY > 200 && middleY < 2400) { var middleObstacle = new Obstacle(); middleObstacle.x = middleX; middleObstacle.y = middleY; obstacles.push(middleObstacle); game.addChild(middleObstacle); } } // Add additional scattered obstacles for Level 4, but fewer at the beginning if (currentLevel >= 4 && obstacleCounter > 3) { // Create 2-3 additional obstacles in random positions, but only after first few obstacles var additionalObstacles = 2 + Math.floor(seededRandom * 2); // 2-3 obstacles for (var j = 0; j < additionalObstacles; j++) { var additionalSeed = (seed + j * 1000) % 9973; var additionalRandom = (additionalSeed * 9301 + 49297) % 233280 / 233280; var obstacleX = baseX + 200 + additionalRandom * 400; // Spread them out var obstacleY = 400 + additionalRandom * 1800; // Random Y position // Make sure it's not in the main gap area if (obstacleY < gapPosition || obstacleY > gapPosition + gapSize) { var additionalObstacle = new Obstacle(); additionalObstacle.x = obstacleX; additionalObstacle.y = obstacleY; obstacles.push(additionalObstacle); game.addChild(additionalObstacle); } } // Add obstacles specifically in character's current area for Level 4, but fewer at the beginning var characterAreaObstacles = obstacleCounter > 2 ? 3 + Math.floor(seededRandom * 2) : 1 + Math.floor(seededRandom * 1); // Start with 1-2 obstacles, then 3-4 for (var k = 0; k < characterAreaObstacles; k++) { var charAreaSeed = (seed + k * 2000 + 500) % 9973; var charAreaRandom = (charAreaSeed * 9301 + 49297) % 233280 / 233280; // Place obstacles in character's vicinity (around x=300, y=800) var charObstacleX = baseX + 100 + charAreaRandom * 300; // Close to current obstacles var charObstacleY = bird.y - 400 + charAreaRandom * 800; // Around character's Y position // Ensure obstacles are within screen bounds and not in gap if (charObstacleY > 100 && charObstacleY < 2500 && (charObstacleY < gapPosition || charObstacleY > gapPosition + gapSize)) { var charAreaObstacle = new Obstacle(); charAreaObstacle.x = charObstacleX; charAreaObstacle.y = charObstacleY; obstacles.push(charAreaObstacle); game.addChild(charAreaObstacle); } } } obstacleCounter++; lastObstacle = LK.ticks; // Create hearts based on missed hearts count (minimum 1, add 1 for each missed) var heartsToCreate = 1 + missedHearts; for (var heartIndex = 0; heartIndex < heartsToCreate; heartIndex++) { var heart = new Heart(); heart.x = baseX + 30; // Position heart 30 pixels ahead of obstacle // Spread multiple hearts vertically in the gap area if (heartsToCreate === 1) { heart.y = gapPosition + gapSize / 2; // Center single heart in the gap area } else { // Distribute multiple hearts evenly across the gap var heartSpacing = gapSize / (heartsToCreate + 1); heart.y = gapPosition + heartSpacing * (heartIndex + 1); } hearts.push(heart); game.addChild(heart); } } function checkCollisions() { // Check ground collision - game over when bird touches ground if (bird.y + 60 >= ground.y) { // Show game over screen with level button showGameOverWithLevelButton(); return; } // Check obstacle collisions - bounce off obstacles for (var i = obstacles.length - 1; i >= 0; i--) { var obstacle = obstacles[i]; // Skip if obstacle is undefined if (!obstacle) { obstacles.splice(i, 1); continue; } if (bird.intersects(obstacle)) { // Check if it's a door - level progression if (obstacle.obstacleType === 'door') { // Flash screen gold to indicate level progression LK.effects.flashScreen(0xffd700, 500); // Advance to next level totalScore += LK.getScore(); storage.totalScore = totalScore; // Unlock next level if not already unlocked if (currentLevel >= unlockedLevels) { unlockedLevels = currentLevel + 1; storage.unlockedLevels = unlockedLevels; } // Advance to next level currentLevel++; storage.currentLevel = currentLevel; levelTxt.setText('Level ' + currentLevel); // Reset score for new level LK.setScore(0); scoreTxt.setText(0); // Reset obstacle counter for consistent level maps obstacleCounter = 0; // Clear all obstacles for (var j = obstacles.length - 1; j >= 0; j--) { obstacles[j].destroy(); obstacles.splice(j, 1); } // Generate new obstacle sequence for the new level generateLevelObstacleSequence(); updateLevelProgress(); // Increase difficulty for new level updateDifficultyForLevel(); // Reset bird position bird.x = 300; bird.y = 800; bird.velocityY = 0; bird.completedFlips = 0; // Reset health resetHealth(); // Create initial obstacle for new level createObstacle(); return; // Exit collision check to avoid other collision handling } // Check if it's a rest platform - safe area if (obstacle.obstacleType === 'restPlatform') { // Safe collision - just bounce without damage var distanceX = bird.x - obstacle.x; var distanceY = bird.y - obstacle.y; var totalDistance = Math.sqrt(distanceX * distanceX + distanceY * distanceY); if (totalDistance > 0) { var normalX = distanceX / totalDistance; var normalY = distanceY / totalDistance; // Gentle push away from platform var pushForce = 3; bird.x += normalX * pushForce; bird.y += normalY * pushForce; // Apply gentle bounce velocity bird.velocityY = normalY * 3; // Visual feedback for landing on safe platform LK.effects.flashObject(obstacle, 0x00ff88, 300); } continue; // Skip damage dealing } // Only take damage if not already damaged from this obstacle if (!obstacle.damagedBird) { takeDamage(); obstacle.damagedBird = true; // Mark this obstacle as having caused damage } // Calculate collision direction var distanceX = bird.x - obstacle.x; var distanceY = bird.y - obstacle.y; var totalDistance = Math.sqrt(distanceX * distanceX + distanceY * distanceY); // Normalize collision direction if (totalDistance > 0) { var normalX = distanceX / totalDistance; var normalY = distanceY / totalDistance; // Push bird away from obstacle var pushForce = 8; bird.x += normalX * pushForce; bird.y += normalY * pushForce; // Apply bounce velocity var bounceForce = 5; bird.velocityY = normalY * bounceForce; // Play flap sound for bounce feedback LK.getSound('flap').play(); } } // Check if bird passed obstacle if (!obstacle.passed && obstacle.x + 100 < bird.x) { obstacle.passed = true; // Award points for passing any obstacle LK.setScore(LK.getScore() + 1); scoreTxt.setText(LK.getScore()); LK.getSound('score').play(); updateLevelProgress(); } // Remove off-screen obstacles (but keep stationary gears and rest platforms) if (obstacle.x < -100 && !obstacle.isStationary) { // Add flash effect when obstacle disappears LK.effects.flashObject(obstacle, 0xffffff, 200); obstacle.destroy(); obstacles.splice(i, 1); } } // Check heart collections for (var h = hearts.length - 1; h >= 0; h--) { var heart = hearts[h]; // Skip if heart is undefined if (!heart) { hearts.splice(h, 1); continue; } // Check if bird collected the heart if (bird.intersects(heart) && !heart.collected) { heart.collected = true; // Reset missed hearts counter when collecting a heart missedHearts = 0; // Always increase health (no maximum limit) playerHealth++; healthTxt.setText('Lives: ' + playerHealth); // Visual feedback for collecting heart tween(heart, { scaleX: 2, scaleY: 2, alpha: 0 }, { duration: 300, easing: tween.easeOut, onFinish: function onFinish() { heart.destroy(); } }); // Flash screen green briefly LK.effects.flashScreen(0x00ff00, 200); // Play score sound as feedback LK.getSound('score').play(); hearts.splice(h, 1); continue; } // Remove off-screen hearts if (heart.x < -100) { // Track that this heart was missed missedHearts++; heart.destroy(); hearts.splice(h, 1); } } // Check portal collisions for (var p = portals.length - 1; p >= 0; p--) { var portal = portals[p]; // Skip if portal is undefined if (!portal) { portals.splice(p, 1); continue; } if (bird.intersects(portal)) { // Flash screen purple to indicate portal entry LK.effects.flashScreen(0x9966ff, 800); // Advance to next level totalScore += LK.getScore(); storage.totalScore = totalScore; // Unlock next level if not already unlocked if (currentLevel >= unlockedLevels) { unlockedLevels = currentLevel + 1; storage.unlockedLevels = unlockedLevels; } // Advance to next level currentLevel++; storage.currentLevel = currentLevel; levelTxt.setText('Level ' + currentLevel); // Reset score for new level LK.setScore(0); scoreTxt.setText(0); // Reset obstacle counter for consistent level maps obstacleCounter = 0; // Clear all obstacles for (var j = obstacles.length - 1; j >= 0; j--) { obstacles[j].destroy(); obstacles.splice(j, 1); } // Clear all portals for (var pt = portals.length - 1; pt >= 0; pt--) { portals[pt].destroy(); portals.splice(pt, 1); } // Generate new obstacle sequence for the new level generateLevelObstacleSequence(); updateLevelProgress(); // Increase difficulty for new level updateDifficultyForLevel(); // Reset bird position bird.x = 300; bird.y = 800; bird.velocityY = 0; bird.completedFlips = 0; // Reset health resetHealth(); // Reset portal spawned flag portalSpawned = false; // Create initial obstacle for new level createObstacle(); return; // Exit collision check to avoid other collision handling } // Remove off-screen portals if (portal.x < -200) { portal.destroy(); portals.splice(p, 1); } } // Check ceiling collision if (bird.y < 50) { bird.y = 50; bird.velocityY = 0; } } game.down = function (x, y, obj) { if (!gameStarted) { startGame(); } bird.flap(); }; game.update = function () { if (!gameStarted) return; // Create obstacles if (LK.ticks - lastObstacle > obstacleSpacing) { createObstacle(); } // Create background shapes if (LK.ticks - lastBackgroundShape > backgroundShapeSpacing) { createBackgroundShape(); lastBackgroundShape = LK.ticks; } // Hearts are now created after each obstacle, so no timer-based spawning needed // Update bird physics bird.update(); // Update obstacles for (var i = 0; i < obstacles.length; i++) { obstacles[i].update(); } // Update hearts for (var h = 0; h < hearts.length; h++) { hearts[h].update(); } // Update portals for (var p = 0; p < portals.length; p++) { portals[p].update(); } // Update background shapes for (var j = backgroundShapes.length - 1; j >= 0; j--) { var bgShape = backgroundShapes[j]; bgShape.update(); // Remove off-screen background shapes if (bgShape.x < -200) { bgShape.destroy(); backgroundShapes.splice(j, 1); } } // Check collisions checkCollisions(); // Level-based difficulty progression var baseSpacing = 400 - (currentLevel - 1) * 20; var minSpacing = Math.max(200, 300 - (currentLevel - 1) * 10); var reductionRate = 1 + currentLevel; // Increase reduction rate with level var currentSpacing = baseSpacing - LK.getScore() * reductionRate; obstacleSpacing = Math.max(minSpacing, currentSpacing); }; function showGameOverWithLevelButton() { resetToLevelStart(); LK.showGameOver(); }
===================================================================
--- original.js
+++ change.js
@@ -300,20 +300,8 @@
var levelProgress = LK.getScore();
var progressNeeded = levelScoreThreshold * currentLevel;
// Update progress display
progressTxt.setText('Progress: ' + levelProgress + '/' + progressNeeded);
- // Check if level threshold is reached and portal not yet spawned
- if (levelProgress >= progressNeeded && !portalSpawned) {
- // Spawn portal for level transition
- var portal = new Portal();
- portal.x = 2200; // Start off-screen right
- portal.y = 1366; // Center of screen vertically
- portals.push(portal);
- game.addChild(portal);
- portalSpawned = true;
- // Flash screen blue to indicate portal spawn
- LK.effects.flashScreen(0x0066ff, 500);
- }
}
function updateDifficultyForLevel() {
// Each level increases difficulty
var difficultyMultiplier = 1 + (currentLevel - 1) * 0.3;
kırmızı bir kalp . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
portal. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
bomba. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
minecraft papağan. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
bayrak . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat