User prompt
Mantar büyüklüğü skora etkisi olsun.
User prompt
Leveli aşağıya ve tam ortaya al
User prompt
Leveli aşağıya al
User prompt
Leveli sola al
User prompt
Leveli sola al
User prompt
Leveli sağa al
User prompt
Level puandan solda olsun
User prompt
Leveli 150 piksel sola al
User prompt
Level indicatorü sol üst köşede goster.
User prompt
Level yazmayı unutma ve iyice sola al.
User prompt
Leveli sol üst kösede belirt 1/3, 2/3, 3/3 şeklinde
User prompt
Mantarlar daha yüksekte spawn olsun.
User prompt
Mantar spawn miktarını çok azalt.
User prompt
Mantar spawn çok az olsun.
User prompt
Mantarlar daha seyrek spawn olsunlar
User prompt
Mantarların arasını iyice aç. Mantarlar daha yavaş spawn olsun ve daha hızlı sola doğru aksınlar.
User prompt
Skorda levelde toplanması gereken mantar sayısını / 50 , / 150 , / 300 diye göster.
User prompt
1.level 50 mantar 2.level 150 mantar 3.level 300 mantar toplansin.
User prompt
Mantarlar üst üste gelmesin ve aralarını iyice axç.
User prompt
Pantarlar arası mesafeyi büyüt.
User prompt
Mantar büyüklüğü 1x ise 3, 3x ise 9, 5x ise 15 patlama parçacık olsun
User prompt
Mantar en küçük ise patlama parçası çok az olsun.
User prompt
Patlama parçacık sayısı mantar büyüklüğü ile oranlı olsun.
User prompt
Mantarlar daha dağınık ve 1x 3x 5x büyüklükte ve yükseklikte olsun. Alınan skorda 1x 3x 5x olsun.
User prompt
Patlama parçaları daha az ve yer çekiminden etkilenmesin..
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ // Enemy class var Enemy = Container.expand(function () { var self = Container.call(this); var gfx = self.attachAsset('enemy_dino', { anchorX: 0.5, anchorY: 1, scaleX: 2, scaleY: 2 }); self.vx = -4; self.visualWidth = gfx.width; self.visualHeight = gfx.height; self.lastX = 0; self.lastY = 0; self.update = function () { self.lastX = self.x; self.lastY = self.y; // Simple left-right movement self.x += self.vx; }; return self; }); // LevelGate class var LevelGate = Container.expand(function () { var self = Container.call(this); var gfx = self.attachAsset('level_gate', { anchorX: 0.5, anchorY: 1, scaleX: 2, scaleY: 2 }); self.active = false; return self; }); // Initialize player // Meteor class var Meteor = Container.expand(function () { var self = Container.call(this); var gfx = self.attachAsset('meteor', { anchorX: 0.5, anchorY: 0.5 }); self.vy = 8; self.lastY = 0; self.update = function () { self.lastY = self.y; self.y += self.vy; }; return self; }); // Mushroom 1x class var Mushroom1x = Container.expand(function () { var self = Container.call(this); var gfx = self.attachAsset('mushroom', { anchorX: 0.5, anchorY: 1, scaleX: 1, scaleY: 1 }); self.value = 1; self.collected = false; return self; }); // Mushroom 3x class var Mushroom3x = Container.expand(function () { var self = Container.call(this); var gfx = self.attachAsset('mushroom', { anchorX: 0.5, anchorY: 1, scaleX: 1.7, scaleY: 1.7 }); self.value = 3; self.collected = false; return self; }); // Mushroom 5x class var Mushroom5x = Container.expand(function () { var self = Container.call(this); var gfx = self.attachAsset('mushroom', { anchorX: 0.5, anchorY: 1, scaleX: 2.3, scaleY: 2.3 }); self.value = 5; self.collected = false; return self; }); // Platform class var Platform = Container.expand(function () { var self = Container.call(this); var gfx = self.attachAsset('platform', { anchorX: 0.5, anchorY: 0.5 }); return self; }); // Player class var Player = Container.expand(function () { var self = Container.call(this); var gfx = self.attachAsset('dino_player', { anchorX: 0.5, anchorY: 1, scaleX: 2, scaleY: 2 }); self.vx = 0; self.vy = 0; self.isJumping = false; self.lastX = 0; self.lastY = 0; self.update = function () { self.lastX = self.x; self.lastY = self.y; // Rotate player to face direction of movement if (self.vx > 0) { // Face right if (gfx.scaleX < 0) { gfx.scaleX = Math.abs(gfx.scaleX); } } else if (self.vx < 0) { // Face left (flip horizontally) if (gfx.scaleX > 0) { gfx.scaleX = -Math.abs(gfx.scaleX); } } else { // If not moving (vx == 0), and player is facing left, and no swipe is active, face right if (gfx.scaleX < 0 && !isTouching) { gfx.scaleX = Math.abs(gfx.scaleX); } } // Movement and gravity will be handled in game.update // Player position is updated in game.update, so nothing to do here }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ // Play background music at game start LK.playMusic('musicId'); // Global game objects and state var player = null; var platforms = []; var mushrooms = []; var enemies = []; var meteors = []; var levelGate = null; var score = 0; var mushroomsToNextLevel = 10; var canLevelUp = false; // --- Life Bar (Hearts) --- var maxLives = 3; var currentLives = maxLives; var heartIcons = []; // Use mushroom asset as heart for now (could be replaced with a heart asset if available) for (var i = 0; i < maxLives; i++) { var heart = LK.getAsset('heart', { anchorX: 0.5, anchorY: 0.5, scaleX: 0.7, scaleY: 0.7, // Move hearts further right (start at x=220 instead of 70) x: 220 + i * 110, y: 70 }); LK.gui.top.addChild(heart); heartIcons.push(heart); } // Enemy spawning variables var ENEMY_SPAWN_INTERVAL_MIN_TICKS = 540; // Approx 9 seconds at 60 FPS (was 6) var ENEMY_SPAWN_INTERVAL_MAX_TICKS = 900; // Approx 15 seconds at 60 FPS (was 10) var MAX_ENEMIES_ON_SCREEN = 3; var nextEnemySpawnTick = ENEMY_SPAWN_INTERVAL_MIN_TICKS; // Time for the first enemy spawn // Initialize player player = new Player(); player.x = 300; player.y = 2200; // Create a seamless row of platforms spanning the screen horizontally var platformAsset = LK.getAsset('platform', { anchorX: 0.5, anchorY: 0.5 }); var platformWidth = platformAsset.width; var yBase = 2300; for (var px = 0; px < 2048; px += platformWidth) { var plat = new Platform(); plat.x = px + platformWidth / 2; plat.y = yBase; game.addChild(plat); platforms.push(plat); } // Add player after platforms so player is in front of platforms game.addChild(player); // Mushrooms will now spawn dynamically with platforms // Enemies will now spawn dynamically // Example meteor (will be dropped randomly in game.update) // Touch controls var jumpQueued = false; var isTouching = false; var swipeThreshold = 80; // New variables for revised touch/swipe logic var touchStartX = 0; var touchStartY = 0; var touchStartTimeTicks = 0; var verticalSwipeForJumpRegistered = false; var playerMovementDirection = 0; // -1 for left, 0 for still, 1 for right // Track both horizontal touch and swipe for jump independently game.down = function (x, y, obj) { isTouching = true; touchStartX = x; touchStartY = y; touchStartTimeTicks = LK.ticks; verticalSwipeForJumpRegistered = false; playerMovementDirection = 0; // Reset direction, will be set by game.move }; game.move = function (x, y, obj) { if (isTouching) { // Detect upward swipe for jump // Only allow one jump per upward swipe gesture if (!verticalSwipeForJumpRegistered && touchStartY - y > swipeThreshold && player.jumpCount < 0.5) { jumpQueued = true; verticalSwipeForJumpRegistered = true; // Calculate jump power based on swipe distance (max out at 2.5x threshold) var swipeDist = touchStartY - y; var minPower = 0.5; // 50% of base jump var maxPower = 1.0; // 100% of base jump var norm = Math.min(1, swipeDist / (swipeThreshold * 2.5)); player._swipeJump = true; player._swipeJumpPower = minPower + (maxPower - minPower) * norm; } // Update player movement direction based on horizontal swipe if (x > player.x + 10) { playerMovementDirection = 1; // right } else if (x < player.x - 10) { playerMovementDirection = -1; // left } else { playerMovementDirection = 0; // still } } }; game.up = function (x, y, obj) { if (isTouching) { // Ensure this logic runs only once per touch end var tapDurationTicks = LK.ticks - touchStartTimeTicks; var dx = x - touchStartX; var dy = y - touchStartY; var tapDistance = Math.sqrt(dx * dx + dy * dy); var maxTapDurationTicks = 15; // Approx 250ms at 60fps var maxTapDistance = swipeThreshold * 0.75; // Allow some small movement for a tap if (!verticalSwipeForJumpRegistered && tapDurationTicks < maxTapDurationTicks && tapDistance < maxTapDistance && player.jumpCount < 0.5) { jumpQueued = true; player._swipeJump = false; // Full power jump for tap } isTouching = false; playerMovementDirection = 0; // Stop player movement when touch is released // verticalSwipeForJumpRegistered is reset on next game.down } }; game.update = function () { // Player movement var speed = 16; var gravity = 7.5; // Softer gravity for more natural jump arc var jumpPower = -90; // Jump power var maxFallSpeed = 60; // Terminal velocity // Horizontal movement based on swipe direction if (isTouching && playerMovementDirection === 1) { player.vx = speed; } else if (isTouching && playerMovementDirection === -1) { player.vx = -speed; } else { player.vx = 0; } player.x += player.vx; // Prevent player from moving outside the left and right screen boundaries var playerHalfWidth = player.width ? player.width / 2 : 50; if (player.x - playerHalfWidth < 0) { player.x = playerHalfWidth; } if (player.x + playerHalfWidth > 2048) { player.x = 2048 - playerHalfWidth; } // --- Clean, Natural Jump Physics --- // Track jump state if (typeof player.jumpCount === "undefined") { player.jumpCount = 0; } if (typeof player.isJumping === "undefined") { player.isJumping = false; } if (typeof player.wasOnGround === "undefined") { player.wasOnGround = false; } if (typeof player.wasOnPlatform === "undefined") { player.wasOnPlatform = false; } // Detect platform and ground contact (for landing) var onPlatform = false; var onGround = false; var platformY = null; for (var i = 0; i < platforms.length; i++) { var plat = platforms[i]; // Check if player feet cross platform top (falling) var platTop = plat.y - plat.height / 2; var playerFeetLast = player.lastY + 10; var playerFeetNow = player.y + 10; if (playerFeetLast <= platTop && playerFeetNow >= platTop && player.x > plat.x - plat.width / 2 && player.x < plat.x + plat.width / 2 && player.vy >= 0) { onPlatform = true; platformY = platTop - 10; break; } } if (player.lastY < 2300 && player.y >= 2300) { onGround = true; } // Reset jump count and state if landed if ((onPlatform || onGround) && player.vy >= 0) { player.jumpCount = 0; player.isJumping = false; } // Allow jump if jumpQueued and jumpCount < 0.5 (half the previous max, disables double jump) if (jumpQueued && player.jumpCount < 0.5) { if (player._swipeJump) { // Use variable jump power if set, otherwise default to half jump var power = typeof player._swipeJumpPower === "number" ? player._swipeJumpPower : 0.5; player.vy = jumpPower * power; player._swipeJump = false; player._swipeJumpPower = undefined; } else { player.vy = jumpPower; } player.isJumping = true; player.jumpCount = 0.5; // Always set to 0.5, never allow more than 0.5 jumps jumpQueued = false; } // Variable jump height: if player releases touch while rising, cut jump short if (!isTouching && player.vy < 0) { player.vy += gravity * 1.2; // Slightly faster fall if jump released early } // Gravity: smooth, natural arc if (player.vy < 0) { // Rising: gentle gravity for floaty apex player.vy += gravity * 0.18; } else { // Falling: normal gravity player.vy += gravity; } if (player.vy > maxFallSpeed) { player.vy = maxFallSpeed; } // Apply vertical movement player.y += player.vy; // Snap to platform if landed if (onPlatform) { player.y = platformY; player.vy = 0; player.isJumping = false; player.jumpCount = 0; } // Snap to ground if landed if (player.y > 2300) { player.y = 2300; player.vy = 0; player.isJumping = false; player.jumpCount = 0; } // Update player lastX/lastY for event logic player.update(); // Mushroom collection for (var i = 0; i < mushrooms.length; i++) { var mush = mushrooms[i]; if (!mush.collected && player.intersects(mush)) { mush.collected = true; mush.visible = false; // Delay the collect effects and score increment LK.setTimeout(function () { score += typeof mush.value === "number" ? mush.value : 1; // Play collect sound (elma ısırma sesi) LK.getSound('collect').play(); // Patlama efekti: mantar toplanınca bir patlama efekti göster (player'ın pozisyonunda ve daha güçlü) // Parçacık sayısı mantar büyüklüğüne göre: 1x=3, 3x=9, 5x=15 var particleCount = 3; if (typeof mush.value === "number") { if (mush.value === 1) particleCount = 3;else if (mush.value === 3) particleCount = 9;else if (mush.value === 5) particleCount = 15; } createParticleExplosion(player.x, player.y, 0xfff200, particleCount, 48, 700, 28, true); if (score >= mushroomsToNextLevel) { canLevelUp = true; if (levelGate) { levelGate.active = true; } } }, 100); // shorter delay before collect effects } } // Enemy Spawning Logic if (LK.ticks >= nextEnemySpawnTick && enemies.length < MAX_ENEMIES_ON_SCREEN) { var newEnemy = new Enemy(); // Spawn off-screen to the right. visualWidth is set in Enemy class constructor. newEnemy.x = 2048 + newEnemy.visualWidth / 2 + 50; // Start a bit further off-screen newEnemy.y = 2300; // Ground level (consistent with player and platform base) // Add enemy behind player but in front of far background elements if any. // Find player's index or add it generally if z-ordering isn't complex. // For now, let's add it generally. If z-order issues arise, we can refine. game.addChild(newEnemy); enemies.push(newEnemy); // Schedule next enemy spawn var spawnInterval = ENEMY_SPAWN_INTERVAL_MIN_TICKS + Math.random() * (ENEMY_SPAWN_INTERVAL_MAX_TICKS - ENEMY_SPAWN_INTERVAL_MIN_TICKS); nextEnemySpawnTick = LK.ticks + Math.floor(spawnInterval); } // Enemy Update, Collision, and Despawning for (var i = enemies.length - 1; i >= 0; i--) { // Iterate backwards for safe removal var enemy = enemies[i]; enemy.update(); // Handles enemy movement // Despawn if off-screen to the left // Ensure enemy.visualWidth is available and correctly represents scaled width if (enemy.x + enemy.visualWidth / 2 < leftEdge) { enemy.destroy(); enemies.splice(i, 1); continue; // Skip further checks for this removed enemy } // Collision with player if (player.intersects(enemy)) { // Only lose life if not already at 0 if (currentLives > 0) { currentLives--; // Flash screen red for 350ms LK.effects.flashScreen(0xff0000, 350); // Animate heart loss if (heartIcons[currentLives]) { tween(heartIcons[currentLives], { alpha: 0.2, scaleX: 0.3, scaleY: 0.3 }, { duration: 300, easing: tween.cubicIn }); } // Play warn sound LK.getSound('warn').play(); // Remove enemy enemy.destroy(); enemies.splice(i, 1); // If no lives left, game over after short delay if (currentLives === 0) { LK.setTimeout(function () { LK.showGameOver(); }, 400); return; } } continue; // Continue game, don't return } } // Define edges for element removal and spawning trigger var rightEdge = 2048; // Right edge of the screen var spawnTriggerEdge = 2048 + 200; // Start spawning new platforms when the rightmost is beyond the screen edge var leftEdge = -200; // Left edge for despawning elements // Get asset dimensions for positioning. These calls are lightweight. var platformAsset = LK.getAsset('platform', { anchorX: 0.5, anchorY: 0.5 }); var platformWidth = platformAsset.width; var platformHeight = platformAsset.height; var mushroomAsset = LK.getAsset('mushroom', { anchorX: 0.5, anchorY: 1 }); // anchorY:1 for bottom var mushroomHeight = mushroomAsset.height; // Move existing platforms var platformMoveSpeed = 7; // Mushrooms and platforms move faster left for (var i = platforms.length - 1; i >= 0; i--) { var plat = platforms[i]; plat.x -= platformMoveSpeed; if (plat.x + platformWidth / 2 < leftEdge) { // Check if entire platform is off-screen plat.destroy(); platforms.splice(i, 1); } } // Move existing mushrooms for (var i = mushrooms.length - 1; i >= 0; i--) { var mush = mushrooms[i]; if (mush.collected) continue; // Already collected, will be invisible mush.x -= platformMoveSpeed; if (mush.x + mushroomAsset.width / 2 < leftEdge) { // Using mushroomAsset.width for consistency mush.destroy(); mushrooms.splice(i, 1); } } // Move existing level gate if (levelGate) { levelGate.x -= platformMoveSpeed; var levelGateAsset = LK.getAsset('level_gate', { anchorX: 0.5, anchorY: 1 }); // anchorY:1 for bottom if (levelGate.x + levelGateAsset.width / 2 < leftEdge) { levelGate.destroy(); levelGate = null; // Allow a new one to spawn if conditions met again } } // Find the rightmost platform's x position (its right edge) var rightmostPlatformEdge = 0; // Default to 0 if no platforms exist if (platforms.length > 0) { var currentRightmostX = -Infinity; for (var i = 0; i < platforms.length; i++) { if (platforms[i].x > currentRightmostX) { currentRightmostX = platforms[i].x; } } rightmostPlatformEdge = currentRightmostX + platformWidth / 2; } // Mushroom spawn control variables (persist across calls) if (typeof game._mushroomNextX === "undefined") { game._mushroomNextX = 0; } var mushroomHorizontalSpacing = 1800 + Math.floor(Math.random() * 900); // 1800-2700px between mushrooms (much wider spacing, much less spawn) // Spawn new platforms if there's space on the right while (rightmostPlatformEdge < spawnTriggerEdge) { var newPlat = new Platform(); newPlat.x = rightmostPlatformEdge === 0 ? platformWidth / 2 : rightmostPlatformEdge + platformWidth / 2; newPlat.y = 2300; // Base Y for platforms game.addChildAt(newPlat, 0); // Always add platforms at the very back platforms.push(newPlat); rightmostPlatformEdge = newPlat.x + platformWidth / 2; var platformTopY = newPlat.y - platformHeight / 2; // Only spawn a mushroom on 1 out of every 3 platforms (randomly) if (Math.random() < 0.34) { // Randomly pick mushroom type: 1x (60%), 3x (30%), 5x (10%) var rand = Math.random(); var mush; if (rand < 0.6) { mush = new Mushroom1x(); } else if (rand < 0.9) { mush = new Mushroom3x(); } else { mush = new Mushroom5x(); } // Get player height (scaled) var playerAsset = LK.getAsset('dino_player', { anchorX: 0.5, anchorY: 1, scaleX: 2, scaleY: 2 }); var playerHeight = playerAsset.height; // Always spawn at one of 3 levels: lowest is much higher above player, each level spaced by 1.5x player height for extra height var levelIndex = Math.floor(Math.random() * 3); // 0, 1, or 2 var mushHeight = mushroomAsset.height; var yOffset = Math.random() * 60 - 30; // larger random offset for more scatter var mushroomLevelSpacing = playerHeight * 1.5; // Increased vertical spacing // Raise all mushroom spawn heights by an extra 350px var mushroomSpawnHeightBoost = 350; // --- Prevent mushrooms from overlapping and increase spacing --- // Find all mushrooms that will be on this platform (within a certain X range) var minMushX = newPlat.x - platformWidth / 2 + 80; var maxMushX = newPlat.x + platformWidth / 2 - 80; // Divide platform into 3-4 slots, randomly pick a free slot for this mushroom var slotCount = 3 + Math.floor(Math.random() * 2); // 3 or 4 slots var slotWidth = (maxMushX - minMushX) / slotCount; // Track which slots are already occupied by mushrooms on this platform var slotOccupied = []; for (var i = 0; i < slotCount; i++) slotOccupied[i] = false; for (var i = 0; i < mushrooms.length; i++) { var m = mushrooms[i]; if (m.x >= minMushX && m.x <= maxMushX && Math.abs(m.y - (platformTopY - playerHeight * 1.5 - mushHeight / 2)) < playerHeight * 2.5) { // Find which slot this mushroom occupies var slotIdx = Math.floor((m.x - minMushX) / slotWidth); if (slotIdx >= 0 && slotIdx < slotCount) slotOccupied[slotIdx] = true; } } // Find all free slots var freeSlots = []; for (var i = 0; i < slotCount; i++) if (!slotOccupied[i]) freeSlots.push(i); // If no free slot, skip spawning this mushroom if (freeSlots.length === 0) { // Do not spawn this mushroom } else { // Pick a random free slot var chosenSlot = freeSlots[Math.floor(Math.random() * freeSlots.length)]; // Place mushroom in the center of the slot, with a small random offset var scatterX = (Math.random() - 0.5) * (slotWidth * 0.4); // less scatter, more separation mush.x = minMushX + chosenSlot * slotWidth + slotWidth / 2 + scatterX; mush.y = platformTopY - playerHeight * 1.5 - mushHeight / 2 - levelIndex * mushroomLevelSpacing + yOffset - mushroomSpawnHeightBoost; game.addChild(mush); // Add mushroom on top of layers mushrooms.push(mush); } // Schedule next mushroom X position game._mushroomNextX = newPlat.x + mushroomHorizontalSpacing + Math.floor(Math.random() * 120); } // Spawn level gate on this new platform if conditions are met and no gate exists if (canLevelUp && !levelGate) { levelGate = new LevelGate(); levelGate.x = newPlat.x; levelGate.y = platformTopY; // Place bottom of the gate on the platform surface levelGate.active = true; game.addChild(levelGate); // Add gate on top of layers } } // Meteor drop (randomly every 240 ticks, was 120) if (LK.ticks % 240 === 0) { var meteor = new Meteor(); meteor.x = 400 + Math.floor(Math.random() * 1200); meteor.y = -100; game.addChild(meteor); meteors.push(meteor); } // Meteor update and collision for (var i = meteors.length - 1; i >= 0; i--) { var meteor = meteors[i]; meteor.update(); if (player.intersects(meteor)) { if (currentLives > 0) { currentLives--; LK.effects.flashScreen(0xff0000, 350); if (heartIcons[currentLives]) { tween(heartIcons[currentLives], { alpha: 0.2, scaleX: 0.3, scaleY: 0.3 }, { duration: 300, easing: tween.cubicIn }); } LK.getSound('warn').play(); meteor.destroy(); meteors.splice(i, 1); if (currentLives === 0) { LK.setTimeout(function () { LK.showGameOver(); }, 400); return; } } continue; } if (meteor.y > 2800) { meteor.destroy(); meteors.splice(i, 1); } } // --- LEVEL PROGRESSION STATE --- if (typeof game._level === "undefined") { game._level = 1; game._levelText = null; game._levelTextTimeout = null; game._level2Shown = false; game._level3Shown = false; game._levelCompleteShown = false; game._level2GateActivated = false; game._level3GateActivated = false; game._level2PlayerStart = { x: 300, y: 2200 }; game._level3PlayerStart = { x: 300, y: 2200 }; // Show "LEVEL 1" text centered and big at game start if (game._levelText) { game._levelText.destroy(); game._levelText = null; } var levelText = new Text2("LEVEL 1", { size: 260, fill: 0xFFB300, fontWeight: "bold" }); levelText.anchor.set(0.5, 0.5); levelText.x = 2048 / 2; levelText.y = 2732 / 2; game.addChild(levelText); game._levelText = levelText; if (game._levelTextTimeout) LK.clearTimeout(game._levelTextTimeout); game._levelTextTimeout = LK.setTimeout(function () { if (game._levelText) { game._levelText.destroy(); game._levelText = null; } }, 1500); } // --- LEVEL GATE LOGIC --- if (levelGate && player.intersects(levelGate)) { // Only allow progressing if gate is active and at correct score if (canLevelUp && levelGate.active) { if (game._level === 1 && score >= 50) { // LEVEL 2 game._level = 2; canLevelUp = false; mushroomsToNextLevel = 150; if (levelGate) { levelGate.destroy(); levelGate = null; } // Show "LEVEL 2" text centered and big if (game._levelText) { game._levelText.destroy(); game._levelText = null; } var levelText = new Text2("LEVEL 2", { size: 260, fill: 0xFFB300, fontWeight: "bold" }); levelText.anchor.set(0.5, 0.5); levelText.x = 2048 / 2; levelText.y = 2732 / 2; game.addChild(levelText); game._levelText = levelText; // Remove after 1.5s if (game._levelTextTimeout) LK.clearTimeout(game._levelTextTimeout); game._levelTextTimeout = LK.setTimeout(function () { if (game._levelText) { game._levelText.destroy(); game._levelText = null; } }, 1500); // Reset player to start player.x = game._level2PlayerStart.x; player.y = game._level2PlayerStart.y; player.vx = 0; player.vy = 0; // Remove all enemies, meteors, mushrooms, and gate for (var i = enemies.length - 1; i >= 0; i--) { enemies[i].destroy(); enemies.splice(i, 1); } for (var i = meteors.length - 1; i >= 0; i--) { meteors[i].destroy(); meteors.splice(i, 1); } for (var i = mushrooms.length - 1; i >= 0; i--) { mushrooms[i].destroy(); mushrooms.splice(i, 1); } if (levelGate) { levelGate.destroy(); levelGate = null; } // Reset platform row to initial for (var i = platforms.length - 1; i >= 0; i--) { platforms[i].destroy(); platforms.splice(i, 1); } var platformAsset = LK.getAsset('platform', { anchorX: 0.5, anchorY: 0.5 }); var platformWidth = platformAsset.width; var yBase = 2300; for (var px = 0; px < 2048; px += platformWidth) { var plat = new Platform(); plat.x = px + platformWidth / 2; plat.y = yBase; game.addChildAt(plat, 0); platforms.push(plat); } // Reset mushroom spawn X game._mushroomNextX = 0; } else if (game._level === 2 && score >= 150) { // LEVEL 3 game._level = 3; canLevelUp = false; mushroomsToNextLevel = 300; if (levelGate) { levelGate.destroy(); levelGate = null; } // Show "LEVEL 3" text centered and big if (game._levelText) { game._levelText.destroy(); game._levelText = null; } var levelText = new Text2("LEVEL 3", { size: 260, fill: 0x00E0FF, fontWeight: "bold" }); levelText.anchor.set(0.5, 0.5); levelText.x = 2048 / 2; levelText.y = 2732 / 2; game.addChild(levelText); game._levelText = levelText; if (game._levelTextTimeout) LK.clearTimeout(game._levelTextTimeout); game._levelTextTimeout = LK.setTimeout(function () { if (game._levelText) { game._levelText.destroy(); game._levelText = null; } }, 1500); // Reset player to start player.x = game._level3PlayerStart.x; player.y = game._level3PlayerStart.y; player.vx = 0; player.vy = 0; // Remove all enemies, meteors, mushrooms, and gate for (var i = enemies.length - 1; i >= 0; i--) { enemies[i].destroy(); enemies.splice(i, 1); } for (var i = meteors.length - 1; i >= 0; i--) { meteors[i].destroy(); meteors.splice(i, 1); } for (var i = mushrooms.length - 1; i >= 0; i--) { mushrooms[i].destroy(); mushrooms.splice(i, 1); } if (levelGate) { levelGate.destroy(); levelGate = null; } // Reset platform row to initial for (var i = platforms.length - 1; i >= 0; i--) { platforms[i].destroy(); platforms.splice(i, 1); } var platformAsset = LK.getAsset('platform', { anchorX: 0.5, anchorY: 0.5 }); var platformWidth = platformAsset.width; var yBase = 2300; for (var px = 0; px < 2048; px += platformWidth) { var plat = new Platform(); plat.x = px + platformWidth / 2; plat.y = yBase; game.addChildAt(plat, 0); // Always add platforms at the very back platforms.push(plat); } // Reset mushroom spawn X game._mushroomNextX = 0; } else if (game._level === 3 && score >= 300) { // LEVEL COMPLETE if (!game._levelCompleteShown) { game._levelCompleteShown = true; // Show "BAŞARIYLA TAMAMLANDI" text centered and big if (game._levelText) { game._levelText.destroy(); game._levelText = null; } var levelText = new Text2("BAŞARIYLA\nTAMAMLANDI", { size: 180, fill: 0x00FF44, fontWeight: "bold", align: "center" }); levelText.anchor.set(0.5, 0.5); levelText.x = 2048 / 2; levelText.y = 2732 / 2; game.addChild(levelText); game._levelText = levelText; if (game._levelTextTimeout) LK.clearTimeout(game._levelTextTimeout); game._levelTextTimeout = LK.setTimeout(function () { if (game._levelText) { game._levelText.destroy(); game._levelText = null; } }, 2000); // Show win popup after a short delay LK.setTimeout(function () { LK.showYouWin(); }, 1200); } } } else { // Play warning sound LK.getSound('warn').play(); } } }; // Score display var scoreTxt = new Text2('0/50', { size: 110, // bigger fill: "#fff", fontWeight: "bold", letterSpacing: 18 // more spaced (if supported) }); scoreTxt.anchor.set(0.5, 0); // Move score bar a bit lower and more separated from hearts scoreTxt.y = 160; LK.gui.top.addChild(scoreTxt); // Helper to get current level's required mushroom count function getLevelTargetScore() { if (typeof game._level === "undefined" || game._level === 1) return 50; if (game._level === 2) return 150; if (game._level === 3) return 300; return 50; } // Update score display in game.update var oldGameUpdate = game.update; game.update = function () { var target = getLevelTargetScore(); scoreTxt.setText(score + "/" + target); oldGameUpdate(); }; // Custom particle explosion effect (replacement for LK.effects.particleExplosion) function createParticleExplosion(x, y, color, count, size, duration, speed, fade) { for (var i = 0; i < count; i++) { var particle = LK.getAsset('mushroom', { anchorX: 0.5, anchorY: 0.5, scaleX: size / 100, scaleY: size / 100, tint: color }); particle.x = x; particle.y = y; game.addChild(particle); // Random direction var angle = Math.random() * Math.PI * 2; var velocity = speed * (0.5 + Math.random() * 0.5); var vx = Math.cos(angle) * velocity; var vy = Math.sin(angle) * velocity; // Animate particle (function (p, vx, vy, duration, fade) { var startTime = LK.ticks; var startAlpha = 1; var endAlpha = fade ? 0 : 1; var totalFrames = Math.max(1, Math.floor(duration / (1000 / 60))); var frame = 0; var _updateFn = function updateFn() { p.x += vx; p.y += vy; // Gravity for a more natural effect vy += 1.2; frame++; if (fade) { p.alpha = startAlpha + (endAlpha - startAlpha) * (frame / totalFrames); } if (frame >= totalFrames) { p.destroy(); LK.off('tick', _updateFn); } }; LK.on('tick', _updateFn); })(particle, vx, vy, duration, fade); } }
===================================================================
--- original.js
+++ change.js
@@ -565,13 +565,15 @@
scaleX: 2,
scaleY: 2
});
var playerHeight = playerAsset.height;
- // Always spawn at one of 3 levels: lowest is well above player, each level spaced by 1.5x player height for extra height
+ // Always spawn at one of 3 levels: lowest is much higher above player, each level spaced by 1.5x player height for extra height
var levelIndex = Math.floor(Math.random() * 3); // 0, 1, or 2
var mushHeight = mushroomAsset.height;
var yOffset = Math.random() * 60 - 30; // larger random offset for more scatter
var mushroomLevelSpacing = playerHeight * 1.5; // Increased vertical spacing
+ // Raise all mushroom spawn heights by an extra 350px
+ var mushroomSpawnHeightBoost = 350;
// --- Prevent mushrooms from overlapping and increase spacing ---
// Find all mushrooms that will be on this platform (within a certain X range)
var minMushX = newPlat.x - platformWidth / 2 + 80;
var maxMushX = newPlat.x + platformWidth / 2 - 80;
@@ -600,9 +602,9 @@
var chosenSlot = freeSlots[Math.floor(Math.random() * freeSlots.length)];
// Place mushroom in the center of the slot, with a small random offset
var scatterX = (Math.random() - 0.5) * (slotWidth * 0.4); // less scatter, more separation
mush.x = minMushX + chosenSlot * slotWidth + slotWidth / 2 + scatterX;
- mush.y = platformTopY - playerHeight * 1.5 - mushHeight / 2 - levelIndex * mushroomLevelSpacing + yOffset;
+ mush.y = platformTopY - playerHeight * 1.5 - mushHeight / 2 - levelIndex * mushroomLevelSpacing + yOffset - mushroomSpawnHeightBoost;
game.addChild(mush); // Add mushroom on top of layers
mushrooms.push(mush);
}
// Schedule next mushroom X position
Fullscreen modern App Store landscape banner, 16:9, high definition, for a game titled "Dino Mantar Macerası" and with the description "Sevimli bir dinozorla platformlarda zıplayıp mantar topla, düşmanlardan ve meteorlardan kaç, 10 mantar sonrası tabeladan yeni seviyeye geç!". No text on banner!
yukardan aşağıya olsun açısı
sevimli bir dinazor olsun ancak açık kırmızı ve dişleri olan azcık da kızgın olsun. High contrast. No shadows
mantarın yüzü olmasın altı da düz olsun platforma gelecek
Üzerine EXIT yazalım.
sağ ve sol kenar keskin olsun
Kalp. In-Game asset. 2d