User prompt
Please fix the bug: 'game.pause is not a function' in or related to this line: 'game.pause();' Line Number: 282
User prompt
'seenek1' veya 'seenek2' seçeneğine dokunana kadar oyun donar
User prompt
Seenek1 görselini 200 birim sola kaydır
User prompt
Seenek2 görselini 500 birim sağa kaydır
User prompt
Seenek1 görselini 200 birim sola kaydır
User prompt
Seenek1 görselini 250 birim sola kaydır
User prompt
Seneek1 görselini 200 birim sola kaydır
User prompt
60 birim sağa kaydır
User prompt
Seenek1 görseli 20 birim sola kaysın
User prompt
Seenek1 görseli ortanoktanın sağına kaydır
User prompt
Seenek1 görselini sağa kaydır
User prompt
'arkaplan' görselini arkaplan yap
User prompt
'arkaplan' görseli sahneden kaldırılsın
User prompt
Bu görseller sahnede gözüksün
User prompt
'seenek1' görseli arkplan görselinin üstünde olsun
User prompt
Orta noktaya koy
User prompt
'seenek1' görselinin sahnenin sol üst köşesine koy
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading 'addChild')' in or related to this line: 'background.addChild(seçenek1);' Line Number: 277
User prompt
Arkaplanın ortasına seene1 ve seenek2 resimlerini yerleştir
User prompt
Center 'seçenek1' and 'seçenek2' assets in the scene kalıcı olarak
User prompt
Seenek1 ve seenek2 yi sahnenin orta noktasına yerleştir
User prompt
'seçenek1' ve 'seçenek2' görsel assenti oluştur ve sahnenin ortasına yerleştir yanyana
User prompt
// Başlangıç ekranında butonları oluştur function createControlButtons() { // Başlangıç ekranını oluşturmak için div const startScreen = document.createElement('div'); startScreen.style.position = 'absolute'; startScreen.style.top = '0'; startScreen.style.left = '0'; startScreen.style.width = '100%'; startScreen.style.height = '100%'; startScreen.style.backgroundColor = 'rgba(0, 0, 0, 0.7)'; startScreen.style.display = 'flex'; startScreen.style.flexDirection = 'column'; startScreen.style.justifyContent = 'center'; startScreen.style.alignItems = 'center'; document.body.appendChild(startScreen); // Başlık const heading = document.createElement('h1'); heading.innerText = 'Choose Control Mode'; heading.style.color = 'white'; startScreen.appendChild(heading); // Play with Buttons butonu const buttonModeButton = document.createElement('button'); buttonModeButton.innerText = 'Play with Buttons'; buttonModeButton.style.padding = '15px 30px'; buttonModeButton.style.fontSize = '20px'; buttonModeButton.style.backgroundColor = '#4CAF50'; buttonModeButton.style.color = 'white'; buttonModeButton.style.border = 'none'; buttonModeButton.style.cursor = 'pointer'; buttonModeButton.style.margin = '20px'; buttonModeButton.style.transition = 'background-color 0.3s'; buttonModeButton.addEventListener('mouseover', () => { buttonModeButton.style.backgroundColor = '#45a049'; }); buttonModeButton.addEventListener('mouseout', () => { buttonModeButton.style.backgroundColor = '#4CAF50'; }); startScreen.appendChild(buttonModeButton); // Play with Touch butonu const touchModeButton = document.createElement('button'); touchModeButton.innerText = 'Play with Touch'; touchModeButton.style.padding = '15px 30px'; touchModeButton.style.fontSize = '20px'; touchModeButton.style.backgroundColor = '#4CAF50'; touchModeButton.style.color = 'white'; touchModeButton.style.border = 'none'; touchModeButton.style.cursor = 'pointer'; touchModeButton.style.margin = '20px'; touchModeButton.style.transition = 'background-color 0.3s'; touchModeButton.addEventListener('mouseover', () => { touchModeButton.style.backgroundColor = '#45a049'; }); touchModeButton.addEventListener('mouseout', () => { touchModeButton.style.backgroundColor = '#4CAF50'; }); startScreen.appendChild(touchModeButton); // Butonlara tıklandığında hangi kontrol tipi seçildiği belirlenir buttonModeButton.addEventListener('click', () => startGame('button', startScreen)); touchModeButton.addEventListener('click', () => startGame('touch', startScreen)); } // Oyun başladıktan sonra butonlar kaldırılır function startGame(controlType, startScreen) { startScreen.remove(); // Başlangıç ekranını kaldır // Oyun alanı oluşturulabilir ve kontrol türüne göre fonksiyonlar çalıştırılabilir if (controlType === 'button') { addButtonControls(); // Buton kontrolü fonksiyonu } else if (controlType === 'touch') { addTouchControls(); // Dokunma kontrolü fonksiyonu } } // Butonlarla karakter hareketi function addButtonControls() { const leftButton = document.createElement('button'); leftButton.innerText = 'Left'; leftButton.style.position = 'absolute'; leftButton.style.left = '20px'; leftButton.style.top = '100px'; document.body.appendChild(leftButton); const rightButton = document.createElement('button'); rightButton.innerText = 'Right'; rightButton.style.position = 'absolute'; rightButton.style.left = '100px'; rightButton.style.top = '100px'; document.body.appendChild(rightButton); leftButton.addEventListener('click', () => movePlayer('left')); rightButton.addEventListener('click', () => movePlayer('right')); } // Dokunarak karakter hareketi function addTouchControls() { window.addEventListener('touchstart', (e) => { const touchX = e.touches[0].clientX; const touchY = e.touches[0].clientY; movePlayerTouch(touchX, touchY); }); } // Karakteri butonlarla hareket ettir function movePlayer(direction) { const player = document.getElementById('player'); const playerRect = player.getBoundingClientRect(); let newX = playerRect.left; let newY = playerRect.top; if (direction === 'left') { newX -= 10; } else if (direction === 'right') { newX += 10; } // Sahnenin sınırlarını kontrol et if (newX < 0) newX = 0; if (newX > window.innerWidth - playerRect.width) newX = window.innerWidth - playerRect.width; player.style.left = `${newX}px`; player.style.top = `${newY}px`; } // Karakteri dokunarak hareket ettir function movePlayerTouch(x, y) { const player = document.getElementById('player'); player.style.left = `${x - 25}px`; // Karakterin ortası player.style.top = `${y - 25}px`; // Karakterin ortası } // Sayfa yüklendiğinde butonları oluştur window.onload = createControlButtons; Koda ekle
User prompt
Aşağı butonunu kullanırsak karakterimizi dokunarak hareket etme özelliği oyundan kaldırılsın
User prompt
Sağ butonu kullanırsak karakterimizi dokunarak hareket etme özelliği oyundan kaldırılsın
/**** * Classes ****/ // Define a class for the down button var DownButton = Container.expand(function () { var self = Container.call(this); var buttonGraphics = self.attachAsset('downButton', { anchorX: 0.5, anchorY: 0.5 }); self.down = function (x, y, obj) { LK.getSound('Kok').play(); // Play 'Kok' sound when button is pressed if (player.y + 100 <= 2732) { player.y += 100; // Check if player is intersecting with NewEnemy for (var i = 0; i < enemies.length; i++) { if (enemies[i] instanceof NewEnemy && player.intersects(enemies[i])) { LK.setScore(LK.getScore() + 10); // Increase score by 10 scoreTxt.setText(LK.getScore()); // Update the score text display break; // Exit loop after finding the first intersecting NewEnemy } } } }; }); // Define a class for enemies var Enemy = Container.expand(function () { var self = Container.call(this); var enemyGraphics = self.attachAsset('enemy', { anchorX: 0.5, anchorY: 0.5 }); self.speed = Math.random() * 2 + 1; // Random speed between 1 and 3 self.update = function () { self.x -= self.speed; // Move from right to left self.y += Math.sin(self.x / 150) * 15; // Further reduce vertical oscillation amplitude if (self.y < 0) { self.y = 0; // Prevent moving above the top of the scene } if (self.x < -50) { self.destroy(); } }; }); var Flower = Container.expand(function () { var self = Container.call(this); var flowerGraphics = self.attachAsset('flower', { anchorX: 0.5, anchorY: 0.5 }); self.speed = Math.random() * 3 + 2; // Random speed between 2 and 5 self.update = function () { self.y += self.speed; self.x += Math.sin(self.y / 100) * 20; // Increased sine wave amplitude flowerGraphics.rotation += 0.05; // Rotate the flower if (self.y > 2732) { self.destroy(); } }; }); // Define a class for the left button var LeftButton = Container.expand(function () { var self = Container.call(this); var buttonGraphics = self.attachAsset('leftButton', { anchorX: 0.5, anchorY: 0.5 }); self.down = function (x, y, obj) { LK.getSound('Kok').play(); // Play 'Kok' sound when button is pressed character.speedX = -moveSpeed; character.removeChild(character.children[0]); // Remove current player image character.attachAsset('leftImage', { // Change character image to 'leftImage' anchorX: 0.5, anchorY: 0.5 }); }; self.up = function (x, y, obj) { character.speedX = 0; character.removeChild(character.children[0]); // Remove current leftImage character.attachAsset('player', { // Revert character image to original anchorX: 0.5, anchorY: 0.5 }); }; }); var NewEnemy = Container.expand(function () { var self = Container.call(this); var newEnemyGraphics = self.attachAsset('newEnemy', { anchorX: 0.5, anchorY: 0.5 }); self.speed = Math.random() * 2 + 2; // Random speed between 2 and 4 self.update = function () { self.y += self.speed; // Move downwards self.x += Math.sin(self.y / 150) * 20; // Reduced frequency for slower oscillation if (self.y < 0) { self.y = 0; // Prevent moving above the top of the scene } if (self.y > 2732) { self.destroy(); } }; }); //<Assets used in the game will automatically appear here> // Define a class for the player character var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 5; self.jumpHeight = 15; self.isJumping = false; self.velocityY = 0; self.update = function () { // Check if the player is outside the scene boundaries if (self.isJumping) { if (self.lastY > self.y) { LK.getSound('Fly').play(); // Play 'Fly' sound when moving upwards } self.lastY = self.y; // Update lastY to current y position self.y -= self.velocityY; self.velocityY -= gravity; if (self.velocityY <= 0 && self.y < 1366) { self.x += 7; // Move right by 7 units at peak } if (self.y >= 1366) { self.y = 1366; self.isJumping = false; self.velocityY = 0; } } // Check if the player touches the left or right edge of the screen if (self.x <= 0 || self.x >= 2048) { LK.effects.flashScreen(0xff0000, 1000); // Flash red light across the entire scene LK.showGameOver(); // End the game if the player touches the edges } self.x += self.speedX; if (!self.isJumping && self.speedX === 0) { self.y += Math.sin(LK.ticks / 20) * 5; // Increase oscillation amplitude for more movement } if (self.isJumping) { self.y -= self.velocityY; self.velocityY -= gravity; if (self.y >= 1366) { self.y = 1366; self.isJumping = false; self.velocityY = 0; } // Check if the player touches the top edge of the screen if (self.y <= 0) { LK.effects.flashScreen(0xff0000, 1000); // Flash red light across the entire scene LK.showGameOver(); // End the game if the player touches the top edge } } }; self.jump = function () { if (!self.isJumping && self.y > 0) { self.isJumping = true; self.velocityY = 20; // Set initial jump velocity self.speedX = 0; // Reset horizontal speed } }; }); // Define a class for the right button var RightButton = Container.expand(function () { var self = Container.call(this); var buttonGraphics = self.attachAsset('rightButton', { anchorX: 0.5, anchorY: 0.5 }); self.down = function (x, y, obj) { LK.getSound('Kok').play(); // Play 'Kok' sound when button is pressed character.speedX = moveSpeed; character.removeChild(character.children[0]); // Remove current player image character.attachAsset('rightImage', { anchorX: 0.5, anchorY: 0.5 }); // Change character image to 'rightImage' }; self.up = function (x, y, obj) { character.speedX = 0; character.removeChild(character.children[0]); // Remove current rightImage character.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); // Revert character image to original }; }); // Define a class for the sine wave enemy var SineWaveEnemy = Container.expand(function () { var self = Container.call(this); var enemyGraphics = self.attachAsset('enemy', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 3; // Constant speed self.amplitude = 50; // Amplitude of the sine wave self.frequency = 100; // Frequency of the sine wave self.update = function () { self.x -= self.speed; self.y += Math.sin(self.x / self.frequency) * self.amplitude; if (self.x < -50) { self.destroy(); } }; }); // Define a class for the up button var UpButton = Container.expand(function () { var self = Container.call(this); var buttonGraphics = self.attachAsset('upButton', { anchorX: 0.5, anchorY: 0.5 }); self.down = function (x, y, obj) { LK.getSound('Kok').play(); // Play 'Kok' sound when button is pressed player.jump(); }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87CEEB // Sky blue background }); /**** * Game Code ****/ // Add 'seçenek1' and 'seçenek2' assets to the game scene, centered and side by side var seçenek1 = LK.getAsset('seenek1', { anchorX: 0.5, anchorY: 0.5 }); var seçenek2 = LK.getAsset('seenek2', { anchorX: 0.5, anchorY: 0.5 }); seçenek1.x = 2048 / 2 - 130; // Move 20 units to the left seçenek1.y = 2732 / 2; seçenek2.x = 2048 / 2 + 110; // Centered with a slight right offset seçenek2.y = 2732 / 2; game.addChild(seçenek1); game.addChild(seçenek2); seçenek1.visible = true; seçenek2.visible = true; // Add the background image to the game var background = LK.getAsset('arkaplan', { anchorX: 0.5, anchorY: 0.5 }); background.x = 2048 / 2; background.y = 2732 / 2; game.addChildAt(background, 0); // Add background at the bottom layer function spawnStar() { // Create a new star asset var star = LK.getAsset('star', { anchorX: 0.5, anchorY: 0.5 }); // Initial position (right side of the center of the scene) var startX = 2048 * 0.85; var startY = 2732 / 2; star.x = startX; star.y = startY; star.width = 80; // Decrease initial width star.height = 80; // Decrease initial height game.addChild(star); var velocityX = (Math.random() - 0.5) * 6; // Random horizontal deviation var velocityY = -Math.random() * 15 - 10; // Upward motion var gravity = 0.5; // Function to animate the star function animate() { velocityY += gravity; star.x += velocityX; star.y += velocityY; // Gradually increase the size of the star star.scale.x += 0.01; star.scale.y += 0.01; // Remove star if it goes off-screen if (star.y > 2732) { star.destroy(); } else { LK.setTimeout(animate, 16); } } animate(); } // Set interval to spawn stars every 2 seconds LK.setInterval(spawnStar, 2000); // Function to create sine wave enemies function createSineWaveEnemy() { var enemy = new SineWaveEnemy(); enemy.x = 2048; // Start from the right edge of the screen enemy.y = Math.random() * 2732; // Random vertical position game.addChild(enemy); enemies.push(enemy); } // Set interval to spawn sine wave enemies LK.setInterval(createSineWaveEnemy, 5000); // Spawn every 5 seconds // Function to create enemies with different types and behaviors function createEnemy() { var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "enemy"; var enemy; if (type === "newEnemy") { enemy = new NewEnemy(); } else { enemy = new Enemy(); } enemy.x = 2048; // Start from the right edge of the screen enemy.y = Math.random() * 2732; // Random vertical position game.addChild(enemy); enemies.push(enemy); } // Set intervals to spawn enemies LK.setInterval(function () { createEnemy("enemy"); // Normal enemy every 4 seconds }, 4000); LK.setInterval(function () { createEnemy("newEnemy"); // New enemy every 20 seconds }, 20000); // Function to spawn flowers on the screen function spawnFlowers() { // Number of flowers to spawn for (var i = 0; i < Math.floor(Math.random() * 6) + 5; i++) { // Create a new flower object var flower = new Flower(); // Set random initial position flower.x = Math.random() * 2048; // Random horizontal position flower.y = -50; // Start above the screen // Add flower to the game scene game.addChild(flower); } } // Call spawnFlowers at intervals LK.setInterval(spawnFlowers, 5000); // Spawn flowers every 5 seconds // Variable to track game over state var gameOver = false; // Play background music when the game starts LK.playMusic('gameMusic', { volume: 0.8, loop: true }); // Variable to track power-up states var powerUpActive = false; var powerUpCooldown = false; // Function to spawn a super power-up function spawnSuperPowerUp() { if (powerUpActive || powerUpCooldown) { return; } // Create a new power-up asset var powerUp = LK.getAsset('powerUp', { anchorX: 0.5, anchorY: 0.5 }); // Random x position within the scene width var x = Math.random() * (2048 - 50); powerUp.x = x; powerUp.y = -60; // Start above the screen // Add power-up to the game scene game.addChild(powerUp); // Move the power-up downwards var fall = LK.setInterval(function () { powerUp.y += 4; powerUp.x += Math.sin(powerUp.y / 100) * 10; // Sine wave pattern // Remove power-up if it goes off-screen if (powerUp.y > 2732) { LK.clearInterval(fall); powerUp.destroy(); } // Check for collision with player if (player.intersects(powerUp)) { LK.clearInterval(fall); powerUp.destroy(); activateSuperPower(); } }, 16); } // Function to activate the super power function activateSuperPower() { if (powerUpActive) { return; } powerUpActive = true; // Temporarily increase flower spawn rate var originalFlowerInterval = 5000; var increasedFlowerInterval = originalFlowerInterval / 4; // 4x increase var flowerIntervalId = LK.setInterval(spawnFlowers, increasedFlowerInterval); // Revert flower spawn rate after 30 seconds LK.setTimeout(function () { LK.clearInterval(flowerIntervalId); LK.setInterval(spawnFlowers, originalFlowerInterval); }, 30000); powerUpCooldown = true; // Scale up the player player.scale.set(4); // Revert player scale after 30 seconds LK.setTimeout(function () { player.scale.set(1); powerUpActive = false; // Cooldown before another power-up can spawn LK.setTimeout(function () { powerUpCooldown = false; }, 60000); // Set to 1 minute if player collects the power-up }, 30000); } // Attempt to spawn a power-up every 40 seconds, ensuring only one is active at a time if (!powerUpActive && !powerUpCooldown) { LK.setTimeout(spawnSuperPowerUp, 40000); } // Array to hold spikes var spikes = []; // Function to create spikes function createSpikes() { var spikeHeight = 100; // Height of each spike var spikeWidth = 30; // Width of each spike var gap = 50; // Gap between spikes // Create fixed spikes on the left edge of the scene for (var y = 0; y < 2732; y += spikeHeight + gap) { var spike = LK.getAsset('spike', { anchorX: 0.5, anchorY: 0.5 }); // Spike starting position (fixed to the left edge) var startX = -spikeWidth; // Left edge var startY = y; // Arranged with gap between them spike.x = startX; spike.y = startY; // Add spikes to the game scene game.addChild(spike); // Add spike object to the array spikes.push(spike); } } // Create spikes (only run once) createSpikes(); var clouds = []; // Function to create a cloud function createCloud() { // Create a new cloud asset var cloud = LK.getAsset('cloud', { anchorX: 0.5, anchorY: 0.5 }); // Cloud starting position (from the right) var startX = 2048 + 100; // Cloud starts from the right var startY = Math.random() * 200; // Random height (upper part) cloud.x = startX; cloud.y = startY; // Add cloud to the game scene game.addChild(cloud); // Start moving the cloud moveCloud(cloud); // Add cloud object to the array clouds.push(cloud); } // Function to move the cloud to the left function moveCloud(cloud) { var speed = 1; // Cloud movement speed LK.setInterval(function () { // Cloud moves to the left cloud.x -= speed; // If the cloud reaches the left edge of the screen, remove it if (cloud.x < -100) { // When the cloud is completely off-screen cloud.destroy(); // Remove the cloud clouds.splice(clouds.indexOf(cloud), 1); // Remove from array } }, 16); // Update every 16ms for 60 FPS } // Create new clouds at intervals LK.setInterval(createCloud, 3000); // Add a new cloud every 3 seconds // Create and initialize the score text display var scoreTxt = new Text2('0', { size: 200, // Increased size fill: 0x000000 // Black color for the score text }); // Set the initial score text to zero scoreTxt.setText(LK.getScore()); // Center the score text horizontally at the top of the screen scoreTxt.anchor.set(0.5, 0); // Anchor at the center of the top edge // Add the score text to the GUI overlay at the top-center position LK.gui.top.addChild(scoreTxt); var moveSpeed = 5; // Speed for character movement var gravity = 0.8; // Decrease gravity for a lighter effect var windSpeed = 2; // Reduce wind speed for horizontal movement // Initialize player at the center of the screen var player = game.addChild(new Player()); var character = player; // Define character as a reference to player player.x = 1024; player.y = 1366; player.speedX = 0; // Prevent movement on spawn player.speedY = 0; // Prevent movement on spawn player.isJumping = false; player.velocityY = 0; // Initialize up button var upButton = game.addChild(new UpButton()); upButton.x = 2048 / 2 - 500; // Middle point's x coordinate minus button width upButton.y = 2732 / 2 + 600; // Middle point's y coordinate plus button height plus additional 100 pixels // Add scaling effect to the up button when pressed and released upButton.down = function () { upButton.scale.set(0.9); // Scale down by 10% }; upButton.up = function () { upButton.scale.set(1); // Reset to original size }; upButton.move = function () { upButton.scale.set(1); // Reset to original size if mouse leaves }; // Initialize left button var leftButton = game.addChild(new LeftButton()); leftButton.x = 300; // Move slightly more to the right leftButton.y = 2732 - 250; // Move slightly more upwards // Initialize right button var rightButton = game.addChild(new RightButton()); rightButton.x = 2048 - 300; // Move slightly more to the left rightButton.y = 2732 - 250; // Move slightly more upwards // Initialize down button var downButton = game.addChild(new DownButton()); downButton.x = 2048 - 500 - 50; // Right edge minus button width and margin downButton.y = 2732 - 500 - 250; // Move the down button slightly more upwards // Initialize enemies var enemies = []; var enemySpawnInterval = 160; // Initial slower spawn rate for the first 30 seconds var enemySpawnIncreaseInterval = 40000; // Increase spawn rate every 40 seconds var enemySpawnCounter = 0; // Variables to track button presses var isPressingUp = false; var isPressingDown = false; // Event listeners for button presses upButton.down = function () { isPressingUp = true; character.removeChild(character.children[0]); // Remove current player image character.attachAsset('playerup', { anchorX: 0.5, anchorY: 0.5 }); // Change character image to 'up' }; upButton.up = function () { isPressingUp = false; character.removeChild(character.children[0]); // Remove current playerup image character.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); // Revert character image to original }; downButton.down = function () { isPressingDown = true; character.removeChild(character.children[0]); // Remove current player image character.attachAsset('player_down', { anchorX: 0.5, anchorY: 0.5 }); // Change character image to 'dow' character.y += 50; // Move character down by 50px character.x += 160; // Move character right by 160px }; downButton.up = function () { isPressingDown = false; character.removeChild(character.children[0]); // Remove current player_down image character.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); // Revert character image to original character.y -= 50; // Move character back to original position }; // Update player movement based on button presses function updatePlayerMovement() { if (isPressingUp) { player.velocityY = -20; // Increase upward speed player.x += 8; // Move right by 8 units } // Removed upward movement when the down button is pressed player.y += player.velocityY; if (!isPressingUp && !isPressingDown) { player.velocityY += gravity; } if (player.y > 1366) { player.y = 1366; player.velocityY = 0; } if (player.y < 0) { player.y = 0; player.velocityY = 0; } } // Set interval for updating player movement LK.setInterval(updatePlayerMovement, 16); // Set interval to increase enemy spawn rate LK.setInterval(function () { if (enemySpawnInterval > 20) { // Ensure a minimum spawn interval enemySpawnInterval -= 10; // Decrease interval to increase spawn rate } }, enemySpawnIncreaseInterval); // Set interval for updating player movement LK.setInterval(function () { player.update(); }, 16); // Handle game updates game.update = function () { player.update(); for (var i = game.children.length - 1; i >= 0; i--) { if (game.children[i] instanceof Flower) { var flower = game.children[i]; flower.update(); if (player.intersects(flower)) { flower.destroy(); // Remove flower from the scene LK.setScore(LK.getScore() + 1); // Increase score by 1 scoreTxt.setText(LK.getScore()); // Update the score text display } } } // Check if the player is completely out of the scene if (player.x < -player.width || player.x > 2048 + player.width || player.y < -player.height || player.y > 2732 + player.height) { LK.showGameOver(); // End the game if the player is completely out of bounds } player.x -= windSpeed; // Apply wind effect to move player left // Spawn enemies enemySpawnCounter++; if (enemySpawnCounter >= enemySpawnInterval * 6 && !powerUpActive) { if (LK.ticks >= 1800) { // 30 seconds * 60 FPS enemySpawnInterval = 80; // Increase spawn rate after 30 seconds } if (enemySpawnCounter % 2 === 0) { // Introduce a delay between spawns return; } // Increase interval to reduce new enemy spawn rate var enemy = new Enemy(); enemy.x = 2048; // Spawn from the right edge of the screen enemy.y = Math.random() * (2732 / 2) + 100; // Random y position slightly lower from the top half of the screen enemies.push(enemy); game.addChild(enemy); var newEnemy = new NewEnemy(); newEnemy.x = Math.random() * 2048; // Random horizontal position newEnemy.y = -50; // Start from the top edge of the screen enemies.push(newEnemy); game.addChild(newEnemy); enemySpawnCounter = 0; } // Update enemies for (var j = enemies.length - 1; j >= 0; j--) { enemies[j].update(); if (player.intersects(enemies[j])) { LK.getSound('Kick').play(); // Play 'Kick' sound when player intersects with an enemy if (enemies[j] instanceof NewEnemy) { LK.effects.flashScreen(0xff0000, 1000); // Flash red light across the entire scene if (LK.ticks >= 3600) { // 60 seconds * 60 FPS LK.setScore(LK.getScore() - 10); // Decrease score by 10 after 60 seconds } else { LK.setScore(LK.getScore() - 3); // Decrease score by 3 for newEnemy } if (LK.getScore() < 0) { LK.getSound('End').play(); // Play 'End' sound LK.showGameOver(); // End the game if the score goes below zero } } else { LK.setScore(LK.getScore() + 2); // Increase score by 2 for regular enemies } enemies[j].destroy(); // Remove enemy from the scene enemies.splice(j, 1); // Remove enemy from the array scoreTxt.setText(LK.getScore()); // Update the score text display if (LK.getScore() % 20 === 0) { LK.effects.flashScreen(0x00FF00, 500); // Flash green on screen for 0.5 seconds enemySpawnInterval = Math.max(20, enemySpawnInterval - 10); // Increase spawn rate by decreasing interval } if (LK.getScore() >= 40) { enemySpawnInterval = Math.max(10, enemySpawnInterval - 5); // Further increase spawn rate when score is 40 or more } } } }; // Handle player jump game.down = function (x, y, obj) { if (!isPressingUp && !isPressingDown) { player.x = x; player.y = y; } }; game.move = function (x, y, obj) { if (!isPressingUp && !isPressingDown) { player.x = x; player.y = y; } };
===================================================================
--- original.js
+++ change.js
@@ -239,9 +239,9 @@
var seçenek2 = LK.getAsset('seenek2', {
anchorX: 0.5,
anchorY: 0.5
});
-seçenek1.x = 2048 / 2 + 110; // Move to the right of the center point
+seçenek1.x = 2048 / 2 - 130; // Move 20 units to the left
seçenek1.y = 2732 / 2;
seçenek2.x = 2048 / 2 + 110; // Centered with a slight right offset
seçenek2.y = 2732 / 2;
game.addChild(seçenek1);