User prompt
oyunu bitirince you win olarak açılan ekrana play againin altına aynı şekilde next level diye bi button ekle görünür şekilde o butona basınca bir sonraki levele geçsin
User prompt
ağaçlar ve binalar yukarıdan inmesin daha güzel yap gerçekçi olsun biraz ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
şimdi oyunumuzun arka planında düzenlemeler yapalım daha gerçekçi olsun herşey yapabildiğin en iyi arka planı yaparmısın
User prompt
buton gözükmüyor düzeltirmisin
User prompt
oyunu durdurma butonu ekle ekrana o butona basınca bi menü açılsın oyuna devam et ana menüye dön yaparmısın
User prompt
sol üstte oyunu durdurma butonuna basınca oyuna devam et ana menüye dön gibi seçenekler çıksın
User prompt
oyunu kazanınca next level diye buton oluştur o butona basınca bir sonraki level atsın
User prompt
şimdi oyuna başlayan herkes level 1 den başlıcak level 1 i geçemeden level 2 yi select levelden oynayamasın bu level 100e kadar geçerli bir önceki oyunu bitirmeden diğer oyunu oynayamasın ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
level arttığında + x işaretleri çok az çıkıyor hepsi aynı orantıda çıksın ve leveller biraz daha zor olsun growth yüksek time az mesela
User prompt
100e kadar leveller ekle her level birbirinden zor olsun
User prompt
growth arttıkça oyun çok hızlanıyor bu düşsün yavaş yavaş hızlansın
User prompt
yıkarıda speed derecesi yazmasın orayı kaldır
User prompt
bu skor growth arttıkça oyun hızlansın zor bi hale gelsin
User prompt
oyunu kazanınca level 2 oyununa girsin burda growth 200 olsun 200 yapınca oyunu kazansın
User prompt
Please fix the bug: 'ReferenceError: gameDistance is not defined' in or related to this line: 'gameDistance++;' Line Number: 743
User prompt
play tıklayınca girmiyor düzeltirmisin play basınca oyunumuza girelim
User prompt
play e tıklayınca oyuna girsin select levele basınca level seçme ekranı gelsin ve ilk yaptığımız oyun level 1 olsun
User prompt
tamam şimdi ana ekran yapalım play level seçme gibi
User prompt
hamburgerlerde + işareti farklı bir hamburger görseli x işareti farklı bir hamburger görseli ve diğer işaretlerde hepsi birbirinden farklı belirgin olsun
User prompt
alttaki hamburgerleri toplayan adam kaç sayı yaparsa growth tablosundada aynısı yazsın
User prompt
neden yapmıyorsun hamburgerleri toplayan karakterin sayısı 1 yazsın
User prompt
ana karakterimizdeki sayı 0 yerine 1 ile başlasın
User prompt
Let the number 0 in our main character model start as 1 at the beginning of each game
User prompt
The number on the man should start with 1 every time he starts the game.
User prompt
The score does not go over 2000 and when you pass through the hamburgers, it says x2, it does not increase by 2 times and let's say the number of the man is 1 at the beginning. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var MathBox = Container.expand(function (operation, value, lane) { var self = Container.call(this); self.operation = operation; self.value = value; self.lane = lane; self.speed = gameSpeed; // Create hamburger layers from bottom to top var bottomBun = self.attachAsset('hamburgerBun', { anchorX: 0.5, anchorY: 0.5, y: 40 }); var lettuce = self.attachAsset('hamburgerLettuce', { anchorX: 0.5, anchorY: 0.5, y: 25 }); var tomato = self.attachAsset('hamburgerTomato', { anchorX: 0.5, anchorY: 0.5, y: 15 }); var patty = self.attachAsset('hamburgerPatty', { anchorX: 0.5, anchorY: 0.5, y: 5 }); var cheese = self.attachAsset('hamburgerCheese', { anchorX: 0.5, anchorY: 0.5, y: -5 }); var topBun = self.attachAsset('hamburgerBun', { anchorX: 0.5, anchorY: 0.5, y: -20 }); // Store all hamburger parts for animation self.hamburgerParts = [bottomBun, lettuce, tomato, patty, cheese, topBun]; // Color hamburger based on operation var tintColor = 0xFFFFFF; if (operation === 'multiply') tintColor = 0x87CEEB; // Light blue tint else if (operation === 'add') tintColor = 0x90EE90; // Light green tint else if (operation === 'subtract') tintColor = 0xFFB6C1; // Light pink tint else if (operation === 'divide') tintColor = 0xFFE4B5; // Light orange tint // Apply subtle tint to top bun to indicate operation type topBun.tint = tintColor; // Create operation text with better styling and larger size var operationText = ''; if (operation === 'multiply') operationText = '×' + value;else if (operation === 'add') operationText = '+' + value;else if (operation === 'subtract') operationText = '-' + value;else if (operation === 'divide') operationText = '÷' + value; var textDisplay = new Text2(operationText, { size: 58, fill: 0x000000, stroke: 0xFFFFFF, strokeThickness: 3 }); textDisplay.anchor.set(0.5, 0.5); textDisplay.y = 10; // Position in center of hamburger self.addChild(textDisplay); // Add floating animation self.animationTimer = Math.random() * Math.PI * 2; self.update = function () { self.y += self.speed; // Add gentle floating animation self.animationTimer += 0.1; var floatOffset = Math.sin(self.animationTimer) * 2; for (var i = 0; i < self.hamburgerParts.length; i++) { self.hamburgerParts[i].y += floatOffset * 0.1; // Subtle float for all parts } textDisplay.y = 10 + floatOffset; }; return self; }); var Player = Container.expand(function () { var self = Container.call(this); // Create human character with body parts var legs = self.attachAsset('runnerLegs', { anchorX: 0.5, anchorY: 1.0, y: 0 }); var body = self.attachAsset('runnerBody', { anchorX: 0.5, anchorY: 1.0, y: -60 }); var head = self.attachAsset('runnerHead', { anchorX: 0.5, anchorY: 1.0, y: -140 }); self.targetX = 1024; // Center position self.moveSpeed = 8; self.animationTimer = 0; self.currentScale = 1.0; // Track current scale self.bodyParts = [legs, body, head]; // Store references for scaling // Method to grow character smoothly based on multiplication and addition self.grow = function (value, operation) { var growthFactor = 1; if (operation === 'multiply') { growthFactor = 1 + value * 0.15; // Grow based on multiplication value } else if (operation === 'add') { growthFactor = 1 + value * 0.01; // Small growth based on addition value } var newScale = self.currentScale * growthFactor; newScale = Math.max(0.3, Math.min(newScale, 3.0)); // Clamp between 0.3x and 3x if (newScale !== self.currentScale) { // Calculate growth increase based on actual player number change var growthIncrease = playerNumber * 100; // Use actual player number for growth currentGrowth += Math.round(growthIncrease); // Animate scale change smoothly for (var i = 0; i < self.bodyParts.length; i++) { tween(self.bodyParts[i], { scaleX: newScale, scaleY: newScale }, { duration: 400, easing: tween.easeOut }); } self.currentScale = newScale; } }; // Method to shrink character smoothly based on subtraction and division self.shrink = function (value, operation) { var shrinkFactor = 1; if (operation === 'subtract') { shrinkFactor = 1 + value * 0.01; // Shrink based on subtraction value } else if (operation === 'divide') { shrinkFactor = 1 + value * 0.1; // Shrink based on division value } var newScale = self.currentScale / shrinkFactor; newScale = Math.max(0.3, Math.min(newScale, 3.0)); // Clamp between 0.3x and 3x if (newScale !== self.currentScale) { // Calculate growth decrease based on player number loss var growthDecrease = Math.max(0, playerNumber * 50); // Smaller penalty for shrinking currentGrowth = Math.max(0, currentGrowth - Math.round(growthDecrease)); // Animate scale change smoothly for (var i = 0; i < self.bodyParts.length; i++) { tween(self.bodyParts[i], { scaleX: newScale, scaleY: newScale }, { duration: 400, easing: tween.easeOut }); } self.currentScale = newScale; } }; self.update = function () { // Smooth movement towards target position var diff = self.targetX - self.x; if (Math.abs(diff) > 2) { self.x += diff * 0.15; } else { self.x = self.targetX; } // Simple running animation - bob the character self.animationTimer += 0.3; var bobOffset = Math.sin(self.animationTimer) * 3; head.y = -140 + bobOffset; body.y = -60 + bobOffset * 0.5; legs.y = bobOffset * 0.3; // Leg movement animation legs.rotation = Math.sin(self.animationTimer * 2) * 0.1; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87CEEB // Sky blue background }); /**** * Game Code ****/ // Golden frame // Larger red box // Larger blue box // Larger green box // Enhanced math boxes with better styling // City buildings // White clouds // Tree leaves // Tree trunk // Green grass // White road markings // Dark asphalt // Realistic environment // Dark pants // Blue shirt // Skin tone head // Brown silhouette // Realistic human character // Game variables var player; var playerNumber = 1; // Always start with 1 var gameSpeed = 6; var mathBoxes = []; var lanes = [600, 1024, 1448]; // Left, center, right lanes var currentLane = 1; // Start in center var spawnTimer = 0; var spawnInterval = 120; // Spawn every 2 seconds at 60fps var gameDistance = 0; var speedIncreaseTimer = 0; var environmentObjects = []; // Level system variables var levelTimer = 30 * 60; // 30 seconds at 60fps var initialScale = 1.0; // Track initial player scale var currentGrowth = 0; // Track total growth achieved var targetGrowth = 100; // Target growth to win level (reasonable for player number) // Reset game state to ensure fresh start playerNumber = 1; // Explicitly reset to 1 at game initialization // Create realistic environment layers // Sky background (already set in game initialization) // Add moving clouds for (var i = 0; i < 3; i++) { var cloud = game.addChild(LK.getAsset('cloud', { anchorX: 0.5, anchorY: 0.5, x: Math.random() * 2048, y: 200 + Math.random() * 300, alpha: 0.8 })); cloud.moveSpeed = 0.5 + Math.random() * 0.5; environmentObjects.push({ type: 'cloud', obj: cloud }); } // Create grass background var grassBackground = game.addChild(LK.getAsset('grass', { anchorX: 0.5, anchorY: 1.0, x: 1024, y: 2732 })); // Create road surface var road = game.addChild(LK.getAsset('road', { anchorX: 0.5, anchorY: 1.0, x: 1024, y: 2732 })); // Add road lane markings var roadMarkings = []; for (var i = 0; i < 8; i++) { var marking = game.addChild(LK.getAsset('roadLine', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 200 + i * 350 })); roadMarkings.push(marking); } // Add trees along the sides for (var i = 0; i < 4; i++) { // Left side trees var leftTree = game.addChild(LK.getAsset('tree', { anchorX: 0.5, anchorY: 1.0, x: 200, y: 1000 + i * 800 })); var leftFoliage = game.addChild(LK.getAsset('treeFoliage', { anchorX: 0.5, anchorY: 1.0, x: 200, y: 900 + i * 800 })); // Right side trees var rightTree = game.addChild(LK.getAsset('tree', { anchorX: 0.5, anchorY: 1.0, x: 1848, y: 1200 + i * 800 })); var rightFoliage = game.addChild(LK.getAsset('treeFoliage', { anchorX: 0.5, anchorY: 1.0, x: 1848, y: 1100 + i * 800 })); environmentObjects.push({ type: 'tree', obj: leftTree }); environmentObjects.push({ type: 'foliage', obj: leftFoliage }); environmentObjects.push({ type: 'tree', obj: rightTree }); environmentObjects.push({ type: 'foliage', obj: rightFoliage }); } // Add city buildings in background for (var i = 0; i < 6; i++) { var building = game.addChild(LK.getAsset('building', { anchorX: 0.5, anchorY: 1.0, x: 100 + i * 350, y: 800, alpha: 0.3 })); building.scaleY = 0.5 + Math.random() * 0.8; environmentObjects.push({ type: 'building', obj: building }); } // Create player player = game.addChild(new Player()); player.x = lanes[currentLane]; player.y = 2400; // UI Elements var numberDisplay = new Text2(playerNumber.toString(), { size: 80, fill: 0xFFFFFF }); numberDisplay.anchor.set(0.5, 0.5); numberDisplay.x = 1024; numberDisplay.y = 300; game.addChild(numberDisplay); // Add timer display var timerDisplay = new Text2('Time: 30', { size: 50, fill: 0xFFFF00 }); timerDisplay.anchor.set(0.5, 0); timerDisplay.y = 60; LK.gui.top.addChild(timerDisplay); // Add growth display var growthDisplay = new Text2('Growth: 0 / 10000', { size: 40, fill: 0x00FF00 }); growthDisplay.anchor.set(0.5, 0); growthDisplay.y = 120; LK.gui.top.addChild(growthDisplay); // Generate random math operations with progressive difficulty function generateOperation() { var difficultyLevel = Math.floor(gameDistance / 1200); // Difficulty increases every 20 seconds var operations = ['multiply', 'add', 'subtract', 'divide']; // At higher difficulty, increase chance of subtract operations if (difficultyLevel > 3) { operations.push('subtract', 'subtract'); // More subtract operations } var operation = operations[Math.floor(Math.random() * operations.length)]; var value; if (operation === 'multiply') { value = Math.floor(Math.random() * (2 + difficultyLevel)) + 2; // 2-4 initially, grows with difficulty value = Math.min(value, 6); // Cap at 6x } else if (operation === 'add') { var baseAdd = 5 + Math.floor(difficultyLevel * 2); value = Math.floor(Math.random() * 15) + baseAdd; // Starting from 5-19, increases with difficulty } else if (operation === 'subtract') { var baseSub = 2 + Math.floor(difficultyLevel * 1.5); value = Math.floor(Math.random() * 8) + baseSub; // Starting from 2-9, increases with difficulty value = Math.min(value, 15); // Cap subtract at 15 } else if (operation === 'divide') { value = Math.floor(Math.random() * 4) + 2; // Random value between 2 and 5 for division } return { operation: operation, value: value }; } // Spawn math boxes function spawnMathBoxes() { // Spawn 2-3 boxes across different lanes var numBoxes = Math.floor(Math.random() * 2) + 2; // 2 or 3 boxes var usedLanes = []; for (var i = 0; i < numBoxes; i++) { var laneIndex; do { laneIndex = Math.floor(Math.random() * 3); } while (usedLanes.indexOf(laneIndex) !== -1); usedLanes.push(laneIndex); var operation = generateOperation(); var mathBox = new MathBox(operation.operation, operation.value, laneIndex); mathBox.x = lanes[laneIndex]; mathBox.y = -100; mathBoxes.push(mathBox); game.addChild(mathBox); } } // Handle player movement game.down = function (x, y, obj) { if (x < 1024 && currentLane > 0) { // Move left currentLane--; player.targetX = lanes[currentLane]; } else if (x >= 1024 && currentLane < 2) { // Move right currentLane++; player.targetX = lanes[currentLane]; } }; // Main game update game.update = function () { gameDistance++; // Update level timer levelTimer--; var secondsLeft = Math.ceil(levelTimer / 60); timerDisplay.setText('Time: ' + secondsLeft); // Update growth display to show same as player number growthDisplay.setText('Growth: ' + playerNumber + ' / ' + targetGrowth); // Check win condition if (playerNumber >= targetGrowth) { LK.setScore(playerNumber); LK.showYouWin(); return; } // Check time up condition if (levelTimer <= 0) { LK.setScore(playerNumber); LK.showGameOver(); return; } // Increase speed and difficulty more aggressively speedIncreaseTimer++; if (speedIncreaseTimer >= 300) { // Every 5 seconds instead of 10 var speedIncrease = 0.3 + gameDistance / 6000; // Gradually increase the increment gameSpeed += speedIncrease; speedIncreaseTimer = 0; // Visual feedback for speed increase LK.effects.flashScreen(0x00FF00, 200); // Quick green flash } // Spawn math boxes spawnTimer++; if (spawnTimer >= spawnInterval) { spawnMathBoxes(); spawnTimer = 0; // Aggressively decrease spawn interval for more difficulty if (spawnInterval > 45) { // Faster decrease rate based on distance traveled var decreaseRate = Math.max(1, Math.floor(gameDistance / 1800)); spawnInterval -= decreaseRate; spawnInterval = Math.max(45, spawnInterval); // Minimum interval of 45 frames } } // Update math boxes and check collisions for (var i = mathBoxes.length - 1; i >= 0; i--) { var box = mathBoxes[i]; if (box.lastY === undefined) box.lastY = box.y; // Remove boxes that are off screen if (box.lastY <= 2732 && box.y > 2732) { box.destroy(); mathBoxes.splice(i, 1); continue; } // Check collision with player if (box.intersects(player)) { // Apply operation var newNumber = playerNumber; if (box.operation === 'multiply') { newNumber = playerNumber * box.value; // Grow character based on multiplication value player.grow(box.value, 'multiply'); } else if (box.operation === 'add') { newNumber = playerNumber + box.value; // Grow character based on addition value player.grow(box.value, 'add'); } else if (box.operation === 'subtract') { newNumber = playerNumber - box.value; // Shrink character based on subtraction value player.shrink(box.value, 'subtract'); } else if (box.operation === 'divide') { newNumber = Math.floor(playerNumber / box.value); // Shrink character based on division value player.shrink(box.value, 'divide'); } // Update player number playerNumber = Math.max(1, newNumber); // Ensure playerNumber stays at least 1 numberDisplay.setText(playerNumber.toString()); // Check game over condition if (playerNumber <= 0) { LK.getSound('gameOver').play(); LK.setScore(Math.floor(gameDistance / 60)); LK.showGameOver(); return; } // Play collect sound and remove box LK.getSound('collect').play(); LK.effects.flashObject(box, 0xFFFFFF, 300); box.destroy(); mathBoxes.splice(i, 1); continue; } box.lastY = box.y; } // Update speed for all boxes for (var j = 0; j < mathBoxes.length; j++) { mathBoxes[j].speed = gameSpeed; } // Animate environment objects for (var k = 0; k < environmentObjects.length; k++) { var envObj = environmentObjects[k]; if (envObj.type === 'cloud') { envObj.obj.x += envObj.obj.moveSpeed; if (envObj.obj.x > 2200) { envObj.obj.x = -150; envObj.obj.y = 200 + Math.random() * 300; } } else if (envObj.type === 'tree' || envObj.type === 'foliage') { envObj.obj.y += gameSpeed * 0.3; // Trees move slower for parallax effect if (envObj.obj.y > 2800) { envObj.obj.y = -200; } } else if (envObj.type === 'building') { envObj.obj.y += gameSpeed * 0.1; // Buildings move even slower if (envObj.obj.y > 2800) { envObj.obj.y = -300; } } } // Animate road markings for (var m = 0; m < roadMarkings.length; m++) { roadMarkings[m].y += gameSpeed; if (roadMarkings[m].y > 2800) { roadMarkings[m].y = -50; } } // Update number display to show player number numberDisplay.setText(playerNumber.toString()); // Update number display position numberDisplay.y = player.y - 200; // Moved higher to accommodate taller character numberDisplay.x = player.x; };
===================================================================
--- original.js
+++ change.js
@@ -219,9 +219,9 @@
// Level system variables
var levelTimer = 30 * 60; // 30 seconds at 60fps
var initialScale = 1.0; // Track initial player scale
var currentGrowth = 0; // Track total growth achieved
-var targetGrowth = 10000; // Target growth to win level
+var targetGrowth = 100; // Target growth to win level (reasonable for player number)
// Reset game state to ensure fresh start
playerNumber = 1; // Explicitly reset to 1 at game initialization
// Create realistic environment layers
// Sky background (already set in game initialization)
@@ -419,19 +419,19 @@
// Update level timer
levelTimer--;
var secondsLeft = Math.ceil(levelTimer / 60);
timerDisplay.setText('Time: ' + secondsLeft);
- // Update growth display
- growthDisplay.setText('Growth: ' + currentGrowth + ' / ' + targetGrowth);
+ // Update growth display to show same as player number
+ growthDisplay.setText('Growth: ' + playerNumber + ' / ' + targetGrowth);
// Check win condition
- if (currentGrowth >= targetGrowth) {
- LK.setScore(currentGrowth);
+ if (playerNumber >= targetGrowth) {
+ LK.setScore(playerNumber);
LK.showYouWin();
return;
}
// Check time up condition
if (levelTimer <= 0) {
- LK.setScore(currentGrowth);
+ LK.setScore(playerNumber);
LK.showGameOver();
return;
}
// Increase speed and difficulty more aggressively