User prompt
Çizim alanını, Oyun ekranının alt ve üst kısımlarından %30 oranında daralt ve sınıra çizgi çek.
User prompt
Belirlenen alana yol çizemiyorum
User prompt
Please fix the bug: 'Cannot read properties of null (reading 'y')' in or related to this line: 'var drawingAreaBottom = car.y - 120; // 2 rows above car start position' Line Number: 3871
User prompt
Please fix the bug: 'Cannot read properties of null (reading 'y')' in or related to this line: 'var drawingAreaTop = refreshButton.y + 120; // 2 rows below refresh button' Line Number: 3870
User prompt
Yol çizim alanı ''Refresh butonunun 2 satır altı ile, araç başlama noktası 2 satır yukarısı'' olarak sınırlandır ve sınır çizgisi çek.
User prompt
Dumanı %3 oranında sola konumlandır.
User prompt
Brake ve Gas butonları, resimlerinin boyutları kadar işlev alanı olsun.
User prompt
Dumanı %3 oranında sola konumlandır.
User prompt
Dumanı %10 oranında sola konumlandır.
User prompt
Dumanı %50 oranında sola konumlandır.
User prompt
Biraz yer çekimi ekle ve araba yolda ki ince iniş çıkışlarda etkilenmemesini sağla. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Araca eklenen süspansiyon, yolu daha akıcı gitmesini sağlasın. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Yolu, yay şeklinde akıcı çizmemizi sağla. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Yol çizerken, nokta nokta değil de; yay şeklinde çizmemizi sağla.
User prompt
Süspansiyon sistemi, yolun kötü çizimini düzeltsin. daha akıcı ilerlesin yolda araba. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
suspension sistemi %100 oranında olsun. çizilen yolun engebesini süspansiyon engellesin ve araç resmi çok fazla hareket etmesin. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
suspension sistemi %100 oranında olsun. çizilen yolda araç resmi çok fazla hareket etmesin. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
suspension sistemi %100 oranında olsun. çizilen yolda araç resmi çok fazla hareket etmesin. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
tekerleğe Sübvansiyon ayarla. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Araba resmini %50 oranında yukarı kaldır.
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var Car = Container.expand(function () { var self = Container.call(this); var carBody = self.attachAsset('car', { anchorX: 0.5, anchorY: 0.5, y: -50 }); var wheelLeft = self.attachAsset('wheel', { anchorX: 0.5, anchorY: 0.5, x: -82.5, y: 20 }); var wheelRight = self.attachAsset('wheel', { anchorX: 0.5, anchorY: 0.5, x: 82.5, y: 20 }); self.velocityX = 0; self.velocityY = 0; self.speed = 2; self.gravity = 0.3; self.onGround = false; self.engineWorking = true; self.update = function () { // Only update physics if game has started if (!gameStarted) return; // Only apply gravity, no automatic movement self.velocityY += self.gravity; self.x += self.velocityX; self.y += self.velocityY; // Car moves as a whole unit - no wheel rotation }; self.setVelocity = function (vx, vy) { self.velocityX = vx; self.velocityY = vy; }; return self; }); var DrawnLine = Container.expand(function () { var self = Container.call(this); self.points = []; self.segments = []; self.addPoint = function (x, y) { self.points.push({ x: x, y: y }); if (self.points.length > 1) { var lastPoint = self.points[self.points.length - 2]; var currentPoint = self.points[self.points.length - 1]; var dx = currentPoint.x - lastPoint.x; var dy = currentPoint.y - lastPoint.y; var distance = Math.sqrt(dx * dx + dy * dy); var angle = Math.atan2(dy, dx); var segment = self.attachAsset('wall', { anchorX: 0, anchorY: 0.5, x: lastPoint.x, y: lastPoint.y, scaleX: distance / 200, scaleY: 0.1, rotation: angle, tint: 0x0000FF }); self.segments.push(segment); } }; self.getSegments = function () { var segmentData = []; for (var i = 0; i < self.points.length - 1; i++) { segmentData.push({ start: self.points[i], end: self.points[i + 1] }); } return segmentData; }; return self; }); var Fire = Container.expand(function () { var self = Container.call(this); var fireGraphics = self.attachAsset('fire', { anchorX: 0.5, anchorY: 0.5 }); // Add fire animation with scaling and color variation self.animationTimer = 0; self.update = function () { self.animationTimer += 0.2; // Flickering scale effect var scaleVariation = 1 + Math.sin(self.animationTimer) * 0.1; fireGraphics.scale.set(scaleVariation); // Color tinting animation between orange and red var tintVariation = Math.sin(self.animationTimer * 2) * 0.5 + 0.5; var red = Math.floor(255); var green = Math.floor(69 + tintVariation * 50); var blue = 0; fireGraphics.tint = red << 16 | green << 8 | blue; }; return self; }); var SmokeParticle = Container.expand(function () { var self = Container.call(this); var smokeGraphics = self.attachAsset('wheel', { anchorX: 0.5, anchorY: 0.5, tint: 0x999999, alpha: 0.6 }); self.init = function (x, y) { self.x = x * 0.97; // Position smoke 3% to the left self.y = y; self.scale.set(0.3); // Animate the smoke particle with auto-cleanup tween(self, { y: y - 50, alpha: 0 }, { duration: 600, easing: tween.easeOut, onFinish: function onFinish() { // Auto-destroy when animation completes if (self && self.destroy) { self.destroy(); // Remove from smokeParticles array for (var i = smokeParticles.length - 1; i >= 0; i--) { if (smokeParticles[i] === self) { smokeParticles.splice(i, 1); break; } } } } }); tween(self.scale, { x: 1.0, y: 1.0 }, { duration: 600, easing: tween.easeOut }); }; return self; }); var Trampoline = Container.expand(function () { var self = Container.call(this); var trampolineGraphics = self.attachAsset('trampoline', { anchorX: 0.5, anchorY: 0.5 }); self.bounce = function () { tween(trampolineGraphics, { scaleY: 0.7 }, { duration: 100, easing: tween.easeOut, onFinish: function onFinish() { tween(trampolineGraphics, { scaleY: 1 }, { duration: 200, easing: tween.bounceOut }); } }); }; return self; }); var Wall = Container.expand(function () { var self = Container.call(this); var wallGraphics = self.attachAsset('wall', { anchorX: 0.5, anchorY: 0.5 }); return self; }); var Water = Container.expand(function () { var self = Container.call(this); var waterGraphics = self.attachAsset('water', { anchorX: 0.5, anchorY: 0.5 }); // Add water animation with gentle wave motion self.animationTimer = 0; self.update = function () { self.animationTimer += 0.1; // Gentle wave motion var waveOffset = Math.sin(self.animationTimer) * 2; waterGraphics.y = waveOffset; // Slight alpha variation to simulate water flow var alphaVariation = 0.8 + Math.sin(self.animationTimer * 1.5) * 0.2; waterGraphics.alpha = alphaVariation; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0xE8E8E8 }); /**** * Game Code ****/ var currentLevel = storage.currentLevel || 1; var maxLevel = 20; var totalPoints = storage.totalPoints || 0; var speedUpgradeLevel = storage.speedUpgradeLevel || 0; var powerUpgradeLevel = storage.powerUpgradeLevel || 0; var pointsPerLevel = 100; var upgradeBaseCost = 100; var upgradeMultiplier = 1.5; var car = null; var walls = []; var trampolines = []; var drawnLine = null; var isDrawing = false; var levelComplete = false; var carCanMove = false; var gameStarted = false; var startButton = null; var startButtonText = null; var refreshButton = null; var refreshButtonText = null; var resetButton = null; var resetButtonText = null; var backButton = null; var backButtonText = null; var smokeParticles = []; var smokeTimer = 0; var drawnLines = []; // Array to store all drawn lines var maxLines = 999999; // Unlimited lines per level var currentLineCount = 0; // Current number of lines drawn var memoryCleanupTimer = 0; // Timer for regular memory cleanup var maxSmokeParticles = 10; // Reduce smoke particles limit to prevent memory buildup var activeTweens = []; // Track active tweens for cleanup var maxConcurrentTweens = 50; // Limit total concurrent tweens var tweenCount = 0; // Track current tween count var fireObstacles = []; var waterObstacles = []; var carSpeedReduction = 1.0; // 1.0 = normal speed, 0.5 = 50% speed var pedalButton = null; var pedalButtonText = null; var brakeButton = null; var brakeButtonText = null; var brakeButtonPressed = false; var brakeAcceleration = 0; var maxBrakeAcceleration = 3.0; var brakeAccelerationIncrement = 0.0037; // Reduced by 200% from 0.011 (0.011 / 3) var pedalButtonPressed = false; var pedalAcceleration = 0; var maxPedalAcceleration = 3.0; var pedalAccelerationIncrement = 0.0037; // Same reduced rate as brake var startPos = { x: 200, y: 863 }; var finishPos = { x: 1800, y: 1000 }; var levelText = new Text2('Level ' + currentLevel, { size: 80, fill: 0x333333 }); levelText.anchor.set(0.5, 0); LK.gui.top.addChild(levelText); var instructionText = new Text2('Draw a path from behind the car!', { size: 50, fill: 0x666666 }); instructionText.anchor.set(0.5, 0); instructionText.y = 100; LK.gui.top.addChild(instructionText); // Create points display if (!game.pointsText) { game.pointsText = new Text2('Points: ' + totalPoints, { size: 60, fill: 0xffd700 }); game.pointsText.anchor.set(1, 0); game.pointsText.x = 2000; game.pointsText.y = 50; LK.gui.top.addChild(game.pointsText); } game.pointsText.setText('Points: ' + totalPoints); // Create upgrade buttons and displays if (!game.speedUpgradeButton) { game.speedUpgradeButton = LK.gui.top.addChild(LK.getAsset('startButton', { anchorX: 0.5, anchorY: 0.5, x: 1600, y: 200, scaleX: 0.8, scaleY: 0.6 })); game.speedUpgradeText = new Text2('Speed+', { size: 30, fill: 0xffffff }); game.speedUpgradeText.anchor.set(0.5, 0.5); game.speedUpgradeText.x = 1600; game.speedUpgradeText.y = 180; LK.gui.top.addChild(game.speedUpgradeText); game.speedUpgradeCostText = new Text2('Cost: ' + Math.floor(upgradeBaseCost * Math.pow(upgradeMultiplier, speedUpgradeLevel)), { size: 25, fill: 0xffff00 }); game.speedUpgradeCostText.anchor.set(0.5, 0.5); game.speedUpgradeCostText.x = 1600; game.speedUpgradeCostText.y = 220; LK.gui.top.addChild(game.speedUpgradeCostText); game.speedLevelText = new Text2('Lv' + speedUpgradeLevel + ' (+' + speedUpgradeLevel * 5 + '%)', { size: 20, fill: 0x00ff00 }); game.speedLevelText.anchor.set(0.5, 0.5); game.speedLevelText.x = 1600; game.speedLevelText.y = 240; LK.gui.top.addChild(game.speedLevelText); } if (!game.powerUpgradeButton) { game.powerUpgradeButton = LK.gui.top.addChild(LK.getAsset('startButton', { anchorX: 0.5, anchorY: 0.5, x: 1800, y: 200, scaleX: 0.8, scaleY: 0.6 })); game.powerUpgradeText = new Text2('Power+', { size: 30, fill: 0xffffff }); game.powerUpgradeText.anchor.set(0.5, 0.5); game.powerUpgradeText.x = 1800; game.powerUpgradeText.y = 180; LK.gui.top.addChild(game.powerUpgradeText); game.powerUpgradeCostText = new Text2('Cost: ' + Math.floor(upgradeBaseCost * Math.pow(upgradeMultiplier, powerUpgradeLevel)), { size: 25, fill: 0xffff00 }); game.powerUpgradeCostText.anchor.set(0.5, 0.5); game.powerUpgradeCostText.x = 1800; game.powerUpgradeCostText.y = 220; LK.gui.top.addChild(game.powerUpgradeCostText); game.powerLevelText = new Text2('Lv' + powerUpgradeLevel + ' (+' + powerUpgradeLevel * 5 + '%)', { size: 20, fill: 0x00ff00 }); game.powerLevelText.anchor.set(0.5, 0.5); game.powerLevelText.x = 1800; game.powerLevelText.y = 240; LK.gui.top.addChild(game.powerLevelText); } // Update upgrade displays var speedCost = Math.floor(upgradeBaseCost * Math.pow(upgradeMultiplier, speedUpgradeLevel)); var powerCost = Math.floor(upgradeBaseCost * Math.pow(upgradeMultiplier, powerUpgradeLevel)); game.speedUpgradeCostText.setText('Cost: ' + speedCost); game.speedLevelText.setText('Lv' + speedUpgradeLevel + ' (+' + speedUpgradeLevel * 5 + '%)'); game.powerUpgradeCostText.setText('Cost: ' + powerCost); game.powerLevelText.setText('Lv' + powerUpgradeLevel + ' (+' + powerUpgradeLevel * 5 + '%)'); // Gray out buttons if not enough points if (totalPoints < speedCost) { game.speedUpgradeButton.tint = 0x666666; game.speedUpgradeText.tint = 0x666666; } else { game.speedUpgradeButton.tint = 0xffffff; game.speedUpgradeText.tint = 0xffffff; } if (totalPoints < powerCost) { game.powerUpgradeButton.tint = 0x666666; game.powerUpgradeText.tint = 0x666666; } else { game.powerUpgradeButton.tint = 0xffffff; game.powerUpgradeText.tint = 0xffffff; } // Create or update line counter text if (!game.lineCounterText) { game.lineCounterText = new Text2('Lines: Unlimited', { size: 40, fill: 0x666666 }); game.lineCounterText.anchor.set(0.5, 0); game.lineCounterText.y = 150; LK.gui.top.addChild(game.lineCounterText); } game.lineCounterText.setText('Lines: Unlimited'); function setupLevel(level) { // Clear existing objects with memory cleanup if (car) car.destroy(); for (var i = 0; i < walls.length; i++) { if (walls[i] && walls[i].destroy) walls[i].destroy(); } for (var i = 0; i < trampolines.length; i++) { if (trampolines[i] && trampolines[i].destroy) trampolines[i].destroy(); } for (var i = 0; i < fireObstacles.length; i++) { if (fireObstacles[i] && fireObstacles[i].destroy) fireObstacles[i].destroy(); } for (var i = 0; i < waterObstacles.length; i++) { if (waterObstacles[i] && waterObstacles[i].destroy) waterObstacles[i].destroy(); } if (drawnLine && drawnLine.destroy) drawnLine.destroy(); // Clear smoke particles with better cleanup for (var i = 0; i < smokeParticles.length; i++) { if (smokeParticles[i] && smokeParticles[i].destroy) { smokeParticles[i].destroy(); } } smokeParticles = []; // Clear all drawn lines with better cleanup for (var i = 0; i < drawnLines.length; i++) { if (drawnLines[i] && drawnLines[i].destroy) { drawnLines[i].destroy(); } } drawnLines = []; // Stop all active tweens to prevent memory leaks - tween.stopAll() is not available // Individual tween cleanup is handled below for each object type // Clean up tweens for walls with more thorough cleanup for (var i = 0; i < walls.length; i++) { if (walls[i]) { tween.stop(walls[i]); // Also stop any nested object tweens if (walls[i].children && walls[i].children[0]) { tween.stop(walls[i].children[0]); } } } // Clean up tweens for trampolines for (var i = 0; i < trampolines.length; i++) { if (trampolines[i]) { tween.stop(trampolines[i]); if (trampolines[i].children && trampolines[i].children[0]) { tween.stop(trampolines[i].children[0]); } } } // Clean up tweens for fire obstacles for (var i = 0; i < fireObstacles.length; i++) { if (fireObstacles[i]) { tween.stop(fireObstacles[i]); if (fireObstacles[i].children && fireObstacles[i].children[0]) { tween.stop(fireObstacles[i].children[0]); } } } // Clean up tweens for water obstacles for (var i = 0; i < waterObstacles.length; i++) { if (waterObstacles[i]) { tween.stop(waterObstacles[i]); if (waterObstacles[i].children && waterObstacles[i].children[0]) { tween.stop(waterObstacles[i].children[0]); } } } // Clean up tweens for car if it exists if (car) { tween.stop(car); if (car.scale) tween.stop(car.scale); } // Clean up tweens for smoke particles for (var i = 0; i < smokeParticles.length; i++) { if (smokeParticles[i]) { tween.stop(smokeParticles[i]); if (smokeParticles[i].scale) tween.stop(smokeParticles[i].scale); } } // Clean up any remaining display objects cleanupMemory(); walls = []; trampolines = []; fireObstacles = []; waterObstacles = []; carSpeedReduction = 1.0; drawnLine = null; isDrawing = false; levelComplete = false; carCanMove = false; gameStarted = false; currentLineCount = 0; // Reset line counter // Create ground var ground = game.addChild(LK.getAsset('ground', { anchorX: 0.5, anchorY: 0, x: 1024, y: 2532 })); // Create start and finish flags var startFlag = game.addChild(LK.getAsset('startFlag', { anchorX: 0.5, anchorY: 1, x: startPos.x, y: startPos.y + 50 })); var finishFlag = game.addChild(LK.getAsset('finishFlag', { anchorX: 0.5, anchorY: 1, x: finishPos.x, y: finishPos.y + 50 })); // Reset finish position to default for all levels finishPos.x = 1800; finishPos.y = 1000; finishFlag.x = finishPos.x; finishFlag.y = finishPos.y + 50; // Setup level-specific elements if (level === 1) { // Simple level - just draw from start to finish // Add fire obstacle var fire1 = new Fire(); fire1.x = 700; fire1.y = 1100; fireObstacles.push(fire1); game.addChild(fire1); // Add water obstacle var water1 = new Water(); water1.x = 1400; water1.y = 1200; waterObstacles.push(water1); game.addChild(water1); instructionText.setText('Draw a path, use PEDAL/BRAKE to control car!'); } else if (level === 2) { // Wall in the middle var wall = new Wall(); wall.x = 1024; wall.y = 1000; walls.push(wall); game.addChild(wall); // Add simplified horizontal movement safeTween(wall, { x: 1300 }, { duration: 4000, easing: tween.linear, onFinish: function onFinish() { safeTween(wall, { x: 1024 }, { duration: 4000, easing: tween.linear }); } }); // Add fire obstacle var fire1 = new Fire(); fire1.x = 1600; fire1.y = 1100; fireObstacles.push(fire1); game.addChild(fire1); // Add water obstacle var water1 = new Water(); water1.x = 1200; water1.y = 1200; waterObstacles.push(water1); game.addChild(water1); instructionText.setText('Draw around the moving wall! Avoid fire, slow down in water!'); } else if (level === 3) { // L-shaped obstacle var wall1 = new Wall(); wall1.x = 1024; wall1.y = 1000; wall1.scaleX = 2; walls.push(wall1); game.addChild(wall1); // Add vertical movement to wall1 tween(wall1, { y: 1200 }, { duration: 2500, easing: tween.linear, onFinish: function onFinish() { tween(wall1, { y: 1000 }, { duration: 2500, easing: tween.linear, onFinish: function onFinish() { // Loop the movement tween(wall1, { y: 1200 }, { duration: 2500, easing: tween.linear, onFinish: function onFinish() { tween(wall1, { y: 1000 }, { duration: 2500, easing: tween.linear }); } }); } }); } }); var wall2 = new Wall(); wall2.x = 1224; wall2.y = 900; wall2.rotation = Math.PI / 2; walls.push(wall2); game.addChild(wall2); // Add horizontal movement to wall2 tween(wall2, { x: 1400 }, { duration: 2000, easing: tween.linear, onFinish: function onFinish() { tween(wall2, { x: 1224 }, { duration: 2000, easing: tween.linear, onFinish: function onFinish() { // Loop the movement tween(wall2, { x: 1400 }, { duration: 2000, easing: tween.linear, onFinish: function onFinish() { tween(wall2, { x: 1224 }, { duration: 2000, easing: tween.linear }); } }); } }); } }); // Add fire obstacle var fire1 = new Fire(); fire1.x = 800; fire1.y = 1000; fireObstacles.push(fire1); game.addChild(fire1); // Add water obstacle var water1 = new Water(); water1.x = 1400; water1.y = 1150; waterObstacles.push(water1); game.addChild(water1); instructionText.setText('Navigate the moving L-shape!'); } else if (level === 4) { // Multiple trampolines with strategic positioning var wall1 = new Wall(); wall1.x = 600; wall1.y = 1000; wall1.scaleX = 1.5; walls.push(wall1); game.addChild(wall1); // Add slow diagonal movement to wall1 tween(wall1, { x: 800, y: 1100 }, { duration: 3500, easing: tween.linear, onFinish: function onFinish() { tween(wall1, { x: 600, y: 1000 }, { duration: 3500, easing: tween.linear, onFinish: function onFinish() { // Loop the movement tween(wall1, { x: 800, y: 1100 }, { duration: 3500, easing: tween.linear, onFinish: function onFinish() { tween(wall1, { x: 600, y: 1000 }, { duration: 3500, easing: tween.linear }); } }); } }); } }); var wall2 = new Wall(); wall2.x = 1200; wall2.y = 1200; wall2.scaleY = 2; walls.push(wall2); game.addChild(wall2); // Add vertical movement to wall2 tween(wall2, { y: 1000 }, { duration: 2800, easing: tween.linear, onFinish: function onFinish() { tween(wall2, { y: 1200 }, { duration: 2800, easing: tween.linear, onFinish: function onFinish() { // Loop the movement tween(wall2, { y: 1000 }, { duration: 2800, easing: tween.linear, onFinish: function onFinish() { tween(wall2, { y: 1200 }, { duration: 2800, easing: tween.linear }); } }); } }); } }); var trampoline1 = new Trampoline(); trampoline1.x = 400; trampoline1.y = 1200; trampolines.push(trampoline1); game.addChild(trampoline1); var trampoline2 = new Trampoline(); trampoline2.x = 800; trampoline2.y = 800; trampolines.push(trampoline2); game.addChild(trampoline2); var trampoline3 = new Trampoline(); trampoline3.x = 1400; trampoline3.y = 1000; trampolines.push(trampoline3); game.addChild(trampoline3); // Add fire obstacles var fire1 = new Fire(); fire1.x = 850; fire1.y = 1150; fireObstacles.push(fire1); game.addChild(fire1); var fire2 = new Fire(); fire2.x = 1200; fire2.y = 850; fireObstacles.push(fire2); game.addChild(fire2); // Add water obstacles var water1 = new Water(); water1.x = 500; water1.y = 1000; waterObstacles.push(water1); game.addChild(water1); var water2 = new Water(); water2.x = 1600; water2.y = 1100; waterObstacles.push(water2); game.addChild(water2); instructionText.setText('Bounce through the obstacle course! Avoid fire, slow down in water!'); } else if (level === 5) { // Multi-stage obstacle course with steep climbs and precision jumps // Create ascending wall platforms var wall1 = new Wall(); wall1.x = 400; wall1.y = 1200; wall1.scaleX = 1.2; walls.push(wall1); game.addChild(wall1); var wall2 = new Wall(); wall2.x = 800; wall2.y = 1000; wall2.scaleX = 1.0; walls.push(wall2); game.addChild(wall2); var wall3 = new Wall(); wall3.x = 1200; wall3.y = 800; wall3.scaleX = 1.2; walls.push(wall3); game.addChild(wall3); var wall4 = new Wall(); wall4.x = 1500; wall4.y = 600; wall4.scaleX = 1.2; walls.push(wall4); game.addChild(wall4); // Create vertical barriers for added difficulty var wall5 = new Wall(); wall5.x = 550; wall5.y = 1100; wall5.scaleY = 1.5; walls.push(wall5); game.addChild(wall5); // Add horizontal movement to wall5 tween(wall5, { x: 750 }, { duration: 4000, easing: tween.linear, onFinish: function onFinish() { tween(wall5, { x: 550 }, { duration: 4000, easing: tween.linear, onFinish: function onFinish() { // Loop the movement tween(wall5, { x: 750 }, { duration: 4000, easing: tween.linear, onFinish: function onFinish() { tween(wall5, { x: 550 }, { duration: 4000, easing: tween.linear }); } }); } }); } }); var wall6 = new Wall(); wall6.x = 850; wall6.y = 900; wall6.scaleY = 2; walls.push(wall6); game.addChild(wall6); // Add vertical movement to wall6 tween(wall6, { y: 1100 }, { duration: 3200, easing: tween.linear, onFinish: function onFinish() { tween(wall6, { y: 900 }, { duration: 3200, easing: tween.linear, onFinish: function onFinish() { // Loop the movement tween(wall6, { y: 1100 }, { duration: 3200, easing: tween.linear, onFinish: function onFinish() { tween(wall6, { y: 900 }, { duration: 3200, easing: tween.linear }); } }); } }); } }); var wall7 = new Wall(); wall7.x = 1150; wall7.y = 700; wall7.scaleY = 1.8; walls.push(wall7); game.addChild(wall7); // Add diagonal movement to wall7 tween(wall7, { x: 1350, y: 900 }, { duration: 3600, easing: tween.linear, onFinish: function onFinish() { tween(wall7, { x: 1150, y: 700 }, { duration: 3600, easing: tween.linear, onFinish: function onFinish() { // Loop the movement tween(wall7, { x: 1350, y: 900 }, { duration: 3600, easing: tween.linear, onFinish: function onFinish() { tween(wall7, { x: 1150, y: 700 }, { duration: 3600, easing: tween.linear }); } }); } }); } }); // Add fire obstacles var fire1 = new Fire(); fire1.x = 650; fire1.y = 1000; fireObstacles.push(fire1); game.addChild(fire1); var fire2 = new Fire(); fire2.x = 1200; fire2.y = 800; fireObstacles.push(fire2); game.addChild(fire2); // Add water obstacles var water1 = new Water(); water1.x = 900; water1.y = 1200; waterObstacles.push(water1); game.addChild(water1); var water2 = new Water(); water2.x = 1500; water2.y = 600; waterObstacles.push(water2); game.addChild(water2); // Strategic trampoline placement for multi-bounce sequences var trampoline1 = new Trampoline(); trampoline1.x = 600; trampoline1.y = 1350; trampolines.push(trampoline1); game.addChild(trampoline1); var trampoline2 = new Trampoline(); trampoline2.x = 900; trampoline2.y = 1150; trampolines.push(trampoline2); game.addChild(trampoline2); var trampoline3 = new Trampoline(); trampoline3.x = 1200; trampoline3.y = 950; trampolines.push(trampoline3); game.addChild(trampoline3); var trampoline4 = new Trampoline(); trampoline4.x = 1500; trampoline4.y = 750; trampolines.push(trampoline4); game.addChild(trampoline4); instructionText.setText('Master the multi-stage climb! Precision required!'); } else if (level === 6) { // Multiple trampolines with walls var wall1 = new Wall(); wall1.x = 900; wall1.y = 1000; wall1.scaleY = 1.5; walls.push(wall1); game.addChild(wall1); // Add horizontal movement to wall1 tween(wall1, { x: 1000 }, { duration: 2700, easing: tween.linear, onFinish: function onFinish() { tween(wall1, { x: 800 }, { duration: 2700, easing: tween.linear, onFinish: function onFinish() { // Loop the movement tween(wall1, { x: 1000 }, { duration: 2700, easing: tween.linear, onFinish: function onFinish() { tween(wall1, { x: 800 }, { duration: 2700, easing: tween.linear }); } }); } }); } }); // Add fire obstacle var fire1 = new Fire(); fire1.x = 1200; fire1.y = 1100; fireObstacles.push(fire1); game.addChild(fire1); // Add water obstacle var water1 = new Water(); water1.x = 700; water1.y = 1200; waterObstacles.push(water1); game.addChild(water1); var trampoline1 = new Trampoline(); trampoline1.x = 600; trampoline1.y = 1300; trampolines.push(trampoline1); game.addChild(trampoline1); var trampoline2 = new Trampoline(); trampoline2.x = 1400; trampoline2.y = 800; trampolines.push(trampoline2); game.addChild(trampoline2); instructionText.setText('Bounce your way through!'); } else if (level === 7) { // Engine failure with multiple obstacles var wall1 = new Wall(); wall1.x = 600; wall1.y = 1100; wall1.rotation = Math.PI / 4; walls.push(wall1); game.addChild(wall1); // Add rotational movement to wall1 tween(wall1, { rotation: Math.PI / 4 + Math.PI / 2 }, { duration: 4000, easing: tween.linear, onFinish: function onFinish() { tween(wall1, { rotation: Math.PI / 4 }, { duration: 4000, easing: tween.linear, onFinish: function onFinish() { // Loop the movement tween(wall1, { rotation: Math.PI / 4 + Math.PI / 2 }, { duration: 4000, easing: tween.linear, onFinish: function onFinish() { tween(wall1, { rotation: Math.PI / 4 }, { duration: 4000, easing: tween.linear }); } }); } }); } }); var wall2 = new Wall(); wall2.x = 1400; wall2.y = 900; wall2.rotation = -Math.PI / 4; walls.push(wall2); game.addChild(wall2); // Add counter-rotational movement to wall2 tween(wall2, { rotation: -Math.PI / 4 - Math.PI / 2 }, { duration: 3500, easing: tween.linear, onFinish: function onFinish() { tween(wall2, { rotation: -Math.PI / 4 }, { duration: 3500, easing: tween.linear, onFinish: function onFinish() { // Loop the movement tween(wall2, { rotation: -Math.PI / 4 - Math.PI / 2 }, { duration: 3500, easing: tween.linear, onFinish: function onFinish() { tween(wall2, { rotation: -Math.PI / 4 }, { duration: 3500, easing: tween.linear }); } }); } }); } }); // Add fire obstacles var fire1 = new Fire(); fire1.x = 800; fire1.y = 1000; fireObstacles.push(fire1); game.addChild(fire1); var fire2 = new Fire(); fire2.x = 1200; fire2.y = 1000; fireObstacles.push(fire2); game.addChild(fire2); // Add water obstacle var water1 = new Water(); water1.x = 1000; water1.y = 1200; waterObstacles.push(water1); game.addChild(water1); instructionText.setText('Engine down! Tap car to push! Navigate moving obstacles!'); } else if (level === 8) { // Maze-like structure var wall1 = new Wall(); wall1.x = 450; wall1.y = 1000; wall1.scaleX = 1.2; wall1.rotation = Math.PI / 2; walls.push(wall1); game.addChild(wall1); // Add vertical movement to wall1 tween(wall1, { y: 1200 }, { duration: 3000, easing: tween.linear, onFinish: function onFinish() { tween(wall1, { y: 1000 }, { duration: 3000, easing: tween.linear, onFinish: function onFinish() { // Loop the movement tween(wall1, { y: 1200 }, { duration: 3000, easing: tween.linear, onFinish: function onFinish() { tween(wall1, { y: 1000 }, { duration: 3000, easing: tween.linear }); } }); } }); } }); var wall2 = new Wall(); wall2.x = 850; wall2.y = 800; wall2.scaleX = 1.2; walls.push(wall2); game.addChild(wall2); // Add horizontal movement to wall2 tween(wall2, { x: 1000 }, { duration: 2500, easing: tween.linear, onFinish: function onFinish() { tween(wall2, { x: 800 }, { duration: 2500, easing: tween.linear, onFinish: function onFinish() { // Loop the movement tween(wall2, { x: 1000 }, { duration: 2500, easing: tween.linear, onFinish: function onFinish() { tween(wall2, { x: 800 }, { duration: 2500, easing: tween.linear }); } }); } }); } }); var wall3 = new Wall(); wall3.x = 1300; wall3.y = 1200; wall3.scaleX = 1.2; wall3.rotation = Math.PI / 2; walls.push(wall3); game.addChild(wall3); // Add diagonal movement to wall3 tween(wall3, { x: 1400, y: 1000 }, { duration: 3200, easing: tween.linear, onFinish: function onFinish() { tween(wall3, { x: 1200, y: 1200 }, { duration: 3200, easing: tween.linear, onFinish: function onFinish() { // Loop the movement tween(wall3, { x: 1400, y: 1000 }, { duration: 3200, easing: tween.linear, onFinish: function onFinish() { tween(wall3, { x: 1200, y: 1200 }, { duration: 3200, easing: tween.linear }); } }); } }); } }); var wall4 = new Wall(); wall4.x = 1600; wall4.y = 900; wall4.scaleX = 1.2; walls.push(wall4); game.addChild(wall4); // Add fast vertical movement to wall4 tween(wall4, { y: 1100 }, { duration: 1800, easing: tween.linear, onFinish: function onFinish() { tween(wall4, { y: 900 }, { duration: 1800, easing: tween.linear, onFinish: function onFinish() { // Loop the movement tween(wall4, { y: 1100 }, { duration: 1800, easing: tween.linear, onFinish: function onFinish() { tween(wall4, { y: 900 }, { duration: 1800, easing: tween.linear }); } }); } }); } }); // Add fire obstacle var fire1 = new Fire(); fire1.x = 850; fire1.y = 800; fireObstacles.push(fire1); game.addChild(fire1); // Add water obstacle var water1 = new Water(); water1.x = 1200; water1.y = 1000; waterObstacles.push(water1); game.addChild(water1); // Add fire obstacles var fire1 = new Fire(); fire1.x = 650; fire1.y = 1100; fireObstacles.push(fire1); game.addChild(fire1); var fire2 = new Fire(); fire2.x = 1350; fire2.y = 900; fireObstacles.push(fire2); game.addChild(fire2); // Add water obstacles var water1 = new Water(); water1.x = 950; water1.y = 900; waterObstacles.push(water1); game.addChild(water1); var water2 = new Water(); water2.x = 1250; water2.y = 1100; waterObstacles.push(water2); game.addChild(water2); instructionText.setText('Navigate the moving maze!'); } else if (level === 9) { // Trampoline sequence var trampoline1 = new Trampoline(); trampoline1.x = 400; trampoline1.y = 1200; trampolines.push(trampoline1); game.addChild(trampoline1); var trampoline2 = new Trampoline(); trampoline2.x = 700; trampoline2.y = 900; trampolines.push(trampoline2); game.addChild(trampoline2); var trampoline3 = new Trampoline(); trampoline3.x = 1000; trampoline3.y = 700; trampolines.push(trampoline3); game.addChild(trampoline3); var trampoline4 = new Trampoline(); trampoline4.x = 1300; trampoline4.y = 1100; trampolines.push(trampoline4); game.addChild(trampoline4); instructionText.setText('Bounce through the sequence!'); } else if (level === 10) { var trampoline1 = new Trampoline(); trampoline1.x = 500; trampoline1.y = 1300; trampoline1.moveDirection = 1; trampoline1.moveSpeed = 2; trampoline1.minX = 400; trampoline1.maxX = 700; trampolines.push(trampoline1); game.addChild(trampoline1); var trampoline2 = new Trampoline(); trampoline2.x = 1000; trampoline2.y = 1000; trampoline2.moveDirection = -1; trampoline2.moveSpeed = 3; trampoline2.minX = 800; trampoline2.maxX = 1200; trampolines.push(trampoline2); game.addChild(trampoline2); var trampoline3 = new Trampoline(); trampoline3.x = 1400; trampoline3.y = 700; trampoline3.moveDirection = 1; trampoline3.moveSpeed = 2.5; trampoline3.minX = 1200; trampoline3.maxX = 1600; trampolines.push(trampoline3); game.addChild(trampoline3); // Add walls to create platforms var wall1 = new Wall(); wall1.x = 600; wall1.y = 1200; wall1.scaleX = 2; walls.push(wall1); game.addChild(wall1); // Add slow horizontal movement to wall1 tween(wall1, { x: 800 }, { duration: 4000, easing: tween.linear, onFinish: function onFinish() { tween(wall1, { x: 600 }, { duration: 4000, easing: tween.linear, onFinish: function onFinish() { // Loop the movement tween(wall1, { x: 800 }, { duration: 4000, easing: tween.linear, onFinish: function onFinish() { tween(wall1, { x: 600 }, { duration: 4000, easing: tween.linear }); } }); } }); } }); var wall2 = new Wall(); wall2.x = 1100; wall2.y = 900; wall2.scaleX = 2; walls.push(wall2); game.addChild(wall2); // Add vertical movement to wall2 tween(wall2, { y: 1100 }, { duration: 3500, easing: tween.linear, onFinish: function onFinish() { tween(wall2, { y: 900 }, { duration: 3500, easing: tween.linear, onFinish: function onFinish() { // Loop the movement tween(wall2, { y: 1100 }, { duration: 3500, easing: tween.linear, onFinish: function onFinish() { tween(wall2, { y: 900 }, { duration: 3500, easing: tween.linear }); } }); } }); } }); var wall3 = new Wall(); wall3.x = 1500; wall3.y = 600; wall3.scaleX = 2; walls.push(wall3); game.addChild(wall3); // Add diagonal movement to wall3 tween(wall3, { x: 1700, y: 800 }, { duration: 3000, easing: tween.linear, onFinish: function onFinish() { tween(wall3, { x: 1500, y: 600 }, { duration: 3000, easing: tween.linear, onFinish: function onFinish() { // Loop the movement tween(wall3, { x: 1700, y: 800 }, { duration: 3000, easing: tween.linear, onFinish: function onFinish() { tween(wall3, { x: 1500, y: 600 }, { duration: 3000, easing: tween.linear }); } }); } }); } }); // Add fire obstacles var fire1 = new Fire(); fire1.x = 650; fire1.y = 1150; fireObstacles.push(fire1); game.addChild(fire1); var fire2 = new Fire(); fire2.x = 1250; fire2.y = 850; fireObstacles.push(fire2); game.addChild(fire2); // Add water obstacles var water1 = new Water(); water1.x = 900; water1.y = 1200; waterObstacles.push(water1); game.addChild(water1); var water2 = new Water(); water2.x = 1450; water2.y = 700; waterObstacles.push(water2); game.addChild(water2); instructionText.setText('Time your jumps! Moving trampolines! Engine failed! Tap car to push!'); } else if (level === 11) { // Complex obstacle course var wall1 = new Wall(); wall1.x = 350; wall1.y = 1000; wall1.scaleY = 2.5; walls.push(wall1); game.addChild(wall1); // Add vertical movement to wall1 tween(wall1, { y: 1300 }, { duration: 3800, easing: tween.linear, onFinish: function onFinish() { tween(wall1, { y: 1000 }, { duration: 3800, easing: tween.linear, onFinish: function onFinish() { // Loop the movement tween(wall1, { y: 1300 }, { duration: 3800, easing: tween.linear, onFinish: function onFinish() { tween(wall1, { y: 1000 }, { duration: 3800, easing: tween.linear }); } }); } }); } }); var wall2 = new Wall(); wall2.x = 900; wall2.y = 800; wall2.scaleX = 1.5; walls.push(wall2); game.addChild(wall2); // Add horizontal movement to wall2 tween(wall2, { x: 1000 }, { duration: 2800, easing: tween.linear, onFinish: function onFinish() { tween(wall2, { x: 800 }, { duration: 2800, easing: tween.linear, onFinish: function onFinish() { // Loop the movement tween(wall2, { x: 1000 }, { duration: 2800, easing: tween.linear, onFinish: function onFinish() { tween(wall2, { x: 800 }, { duration: 2800, easing: tween.linear }); } }); } }); } }); var wall3 = new Wall(); wall3.x = 1400; wall3.y = 1200; wall3.scaleY = 1.5; walls.push(wall3); game.addChild(wall3); // Add circular movement to wall3 tween(wall3, { x: 1400 }, { duration: 2000, easing: tween.linear, onFinish: function onFinish() { tween(wall3, { y: 1000 }, { duration: 2000, easing: tween.linear, onFinish: function onFinish() { tween(wall3, { x: 1200 }, { duration: 2000, easing: tween.linear, onFinish: function onFinish() { tween(wall3, { y: 1200 }, { duration: 2000, easing: tween.linear }); } }); } }); } }); // Add fire obstacle var fire1 = new Fire(); fire1.x = 1000; fire1.y = 1000; fireObstacles.push(fire1); game.addChild(fire1); // Add water obstacle var water1 = new Water(); water1.x = 800; water1.y = 1200; waterObstacles.push(water1); game.addChild(water1); var trampoline = new Trampoline(); trampoline.x = 600; trampoline.y = 1300; trampolines.push(trampoline); game.addChild(trampoline); instructionText.setText('Navigate the obstacle course!'); } else if (level === 12) { // Multiple gaps with trampolines and moving walls var trampoline1 = new Trampoline(); trampoline1.x = 500; trampoline1.y = 1200; trampolines.push(trampoline1); game.addChild(trampoline1); var trampoline2 = new Trampoline(); trampoline2.x = 900; trampoline2.y = 1000; trampolines.push(trampoline2); game.addChild(trampoline2); var trampoline3 = new Trampoline(); trampoline3.x = 1300; trampoline3.y = 1300; trampolines.push(trampoline3); game.addChild(trampoline3); // Add moving walls for level 12 var movingWall1 = new Wall(); movingWall1.x = 700; movingWall1.y = 1100; movingWall1.scaleX = 1.5; walls.push(movingWall1); game.addChild(movingWall1); // Horizontal movement tween(movingWall1, { x: 1000 }, { duration: 2500, easing: tween.linear, onFinish: function onFinish() { tween(movingWall1, { x: 700 }, { duration: 2500, easing: tween.linear, onFinish: function onFinish() { // Loop the movement tween(movingWall1, { x: 1000 }, { duration: 2500, easing: tween.linear, onFinish: function onFinish() { tween(movingWall1, { x: 700 }, { duration: 2500, easing: tween.linear }); } }); } }); } }); var movingWall2 = new Wall(); movingWall2.x = 1100; movingWall2.y = 900; movingWall2.scaleY = 2; walls.push(movingWall2); game.addChild(movingWall2); // Vertical movement tween(movingWall2, { y: 1200 }, { duration: 3000, easing: tween.linear, onFinish: function onFinish() { tween(movingWall2, { y: 900 }, { duration: 3000, easing: tween.linear, onFinish: function onFinish() { // Loop the movement tween(movingWall2, { y: 1200 }, { duration: 3000, easing: tween.linear, onFinish: function onFinish() { tween(movingWall2, { y: 900 }, { duration: 3000, easing: tween.linear }); } }); } }); } }); var movingWall3 = new Wall(); movingWall3.x = 400; movingWall3.y = 1400; movingWall3.scaleX = 1.2; movingWall3.rotation = Math.PI / 4; walls.push(movingWall3); game.addChild(movingWall3); // Diagonal movement tween(movingWall3, { x: 600, y: 1200 }, { duration: 2000, easing: tween.linear, onFinish: function onFinish() { tween(movingWall3, { x: 400, y: 1400 }, { duration: 2000, easing: tween.linear, onFinish: function onFinish() { // Loop the movement tween(movingWall3, { x: 600, y: 1200 }, { duration: 2000, easing: tween.linear, onFinish: function onFinish() { tween(movingWall3, { x: 400, y: 1400 }, { duration: 2000, easing: tween.linear }); } }); } }); } }); var movingWall4 = new Wall(); movingWall4.x = 1500; movingWall4.y = 1150; movingWall4.scaleY = 1.5; walls.push(movingWall4); game.addChild(movingWall4); // Fast horizontal movement tween(movingWall4, { x: 1200 }, { duration: 1500, easing: tween.linear, onFinish: function onFinish() { tween(movingWall4, { x: 1500 }, { duration: 1500, easing: tween.linear, onFinish: function onFinish() { // Loop the movement tween(movingWall4, { x: 1200 }, { duration: 1500, easing: tween.linear, onFinish: function onFinish() { tween(movingWall4, { x: 1500 }, { duration: 1500, easing: tween.linear }); } }); } }); } }); // Add fire obstacles var fire1 = new Fire(); fire1.x = 800; fire1.y = 1050; fireObstacles.push(fire1); game.addChild(fire1); var fire2 = new Fire(); fire2.x = 1200; fire2.y = 1200; fireObstacles.push(fire2); game.addChild(fire2); // Add water obstacles var water1 = new Water(); water1.x = 600; water1.y = 1300; waterObstacles.push(water1); game.addChild(water1); var water2 = new Water(); water2.x = 1400; water2.y = 1000; waterObstacles.push(water2); game.addChild(water2); instructionText.setText('Bridge multiple gaps! Dodge moving walls!'); } else if (level === 13) { // Simplified level with basic platforms and reasonable difficulty // Create simple ascending platforms var wall1 = new Wall(); wall1.x = 600; wall1.y = 1100; wall1.scaleX = 1.5; walls.push(wall1); game.addChild(wall1); // Add slow horizontal movement to wall1 tween(wall1, { x: 750 }, { duration: 3500, easing: tween.linear, onFinish: function onFinish() { tween(wall1, { x: 600 }, { duration: 3500, easing: tween.linear, onFinish: function onFinish() { // Loop the movement tween(wall1, { x: 750 }, { duration: 3500, easing: tween.linear, onFinish: function onFinish() { tween(wall1, { x: 600 }, { duration: 3500, easing: tween.linear }); } }); } }); } }); var wall2 = new Wall(); wall2.x = 1000; wall2.y = 900; wall2.scaleX = 1.5; walls.push(wall2); game.addChild(wall2); // Add vertical movement to wall2 tween(wall2, { y: 1050 }, { duration: 3000, easing: tween.linear, onFinish: function onFinish() { tween(wall2, { y: 900 }, { duration: 3000, easing: tween.linear, onFinish: function onFinish() { // Loop the movement tween(wall2, { y: 1050 }, { duration: 3000, easing: tween.linear, onFinish: function onFinish() { tween(wall2, { y: 900 }, { duration: 3000, easing: tween.linear }); } }); } }); } }); var wall3 = new Wall(); wall3.x = 1300; wall3.y = 700; wall3.scaleX = 1.5; walls.push(wall3); game.addChild(wall3); // Add diagonal movement to wall3 tween(wall3, { x: 1450, y: 850 }, { duration: 4000, easing: tween.linear, onFinish: function onFinish() { tween(wall3, { x: 1300, y: 700 }, { duration: 4000, easing: tween.linear, onFinish: function onFinish() { // Loop the movement tween(wall3, { x: 1450, y: 850 }, { duration: 4000, easing: tween.linear, onFinish: function onFinish() { tween(wall3, { x: 1300, y: 700 }, { duration: 4000, easing: tween.linear }); } }); } }); } }); // Add fire obstacle var fire1 = new Fire(); fire1.x = 750; fire1.y = 975; fireObstacles.push(fire1); game.addChild(fire1); // Add water obstacle var water1 = new Water(); water1.x = 1200; water1.y = 750; waterObstacles.push(water1); game.addChild(water1); // Add two trampolines for reasonable jumping var trampoline1 = new Trampoline(); trampoline1.x = 450; trampoline1.y = 1250; trampolines.push(trampoline1); game.addChild(trampoline1); var trampoline2 = new Trampoline(); trampoline2.x = 850; trampoline2.y = 1050; trampolines.push(trampoline2); game.addChild(trampoline2); var trampoline3 = new Trampoline(); trampoline3.x = 1150; trampoline3.y = 850; trampolines.push(trampoline3); game.addChild(trampoline3); instructionText.setText('Jump up the moving platforms! Engine failed! Tap car to push!'); } else if (level === 14) { // Tower climbing var wall1 = new Wall(); wall1.x = 450; wall1.y = 1200; walls.push(wall1); game.addChild(wall1); // Add horizontal movement to wall1 tween(wall1, { x: 650 }, { duration: 2500, easing: tween.linear, onFinish: function onFinish() { tween(wall1, { x: 500 }, { duration: 2500, easing: tween.linear, onFinish: function onFinish() { // Loop the movement tween(wall1, { x: 650 }, { duration: 2500, easing: tween.linear, onFinish: function onFinish() { tween(wall1, { x: 500 }, { duration: 2500, easing: tween.linear }); } }); } }); } }); var wall2 = new Wall(); wall2.x = 800; wall2.y = 1000; walls.push(wall2); game.addChild(wall2); // Add vertical movement to wall2 tween(wall2, { y: 1150 }, { duration: 3000, easing: tween.linear, onFinish: function onFinish() { tween(wall2, { y: 1000 }, { duration: 3000, easing: tween.linear, onFinish: function onFinish() { // Loop the movement tween(wall2, { y: 1150 }, { duration: 3000, easing: tween.linear, onFinish: function onFinish() { tween(wall2, { y: 1000 }, { duration: 3000, easing: tween.linear }); } }); } }); } }); var wall3 = new Wall(); wall3.x = 1100; wall3.y = 800; walls.push(wall3); game.addChild(wall3); // Add diagonal movement to wall3 tween(wall3, { x: 1050, y: 950 }, { duration: 2800, easing: tween.linear, onFinish: function onFinish() { tween(wall3, { x: 900, y: 800 }, { duration: 2800, easing: tween.linear, onFinish: function onFinish() { // Loop the movement tween(wall3, { x: 1050, y: 950 }, { duration: 2800, easing: tween.linear, onFinish: function onFinish() { tween(wall3, { x: 900, y: 800 }, { duration: 2800, easing: tween.linear }); } }); } }); } }); var wall4 = new Wall(); wall4.x = 1400; wall4.y = 600; walls.push(wall4); game.addChild(wall4); // Add fast horizontal movement to wall4 tween(wall4, { x: 1300 }, { duration: 2000, easing: tween.linear, onFinish: function onFinish() { tween(wall4, { x: 1100 }, { duration: 2000, easing: tween.linear, onFinish: function onFinish() { // Loop the movement tween(wall4, { x: 1300 }, { duration: 2000, easing: tween.linear, onFinish: function onFinish() { tween(wall4, { x: 1100 }, { duration: 2000, easing: tween.linear }); } }); } }); } }); // Add fire obstacles var fire1 = new Fire(); fire1.x = 750; fire1.y = 1200; fireObstacles.push(fire1); game.addChild(fire1); var fire2 = new Fire(); fire2.x = 1150; fire2.y = 800; fireObstacles.push(fire2); game.addChild(fire2); // Add water obstacle var water1 = new Water(); water1.x = 900; water1.y = 1000; waterObstacles.push(water1); game.addChild(water1); var trampoline1 = new Trampoline(); trampoline1.x = 600; trampoline1.y = 1300; trampolines.push(trampoline1); game.addChild(trampoline1); var trampoline2 = new Trampoline(); trampoline2.x = 800; trampoline2.y = 1100; trampolines.push(trampoline2); game.addChild(trampoline2); var trampoline3 = new Trampoline(); trampoline3.x = 1000; trampoline3.y = 900; trampolines.push(trampoline3); game.addChild(trampoline3); instructionText.setText('Climb the tower!'); } else if (level === 15) { // Zigzag with engine failure var wall1 = new Wall(); wall1.x = 400; wall1.y = 1100; wall1.rotation = Math.PI / 3; wall1.scaleX = 1.5; walls.push(wall1); game.addChild(wall1); // Add rotational and positional movement to wall1 tween(wall1, { x: 550, rotation: Math.PI / 3 + Math.PI / 4 }, { duration: 3000, easing: tween.linear, onFinish: function onFinish() { tween(wall1, { x: 400, rotation: Math.PI / 3 }, { duration: 3000, easing: tween.linear, onFinish: function onFinish() { // Loop the movement tween(wall1, { x: 550, rotation: Math.PI / 3 + Math.PI / 4 }, { duration: 3000, easing: tween.linear, onFinish: function onFinish() { tween(wall1, { x: 400, rotation: Math.PI / 3 }, { duration: 3000, easing: tween.linear }); } }); } }); } }); var wall2 = new Wall(); wall2.x = 700; wall2.y = 900; wall2.rotation = -Math.PI / 3; wall2.scaleX = 1.5; walls.push(wall2); game.addChild(wall2); // Add counter-movement to wall2 tween(wall2, { y: 1050, rotation: -Math.PI / 3 - Math.PI / 4 }, { duration: 2500, easing: tween.linear, onFinish: function onFinish() { tween(wall2, { y: 900, rotation: -Math.PI / 3 }, { duration: 2500, easing: tween.linear, onFinish: function onFinish() { // Loop the movement tween(wall2, { y: 1050, rotation: -Math.PI / 3 - Math.PI / 4 }, { duration: 2500, easing: tween.linear, onFinish: function onFinish() { tween(wall2, { y: 900, rotation: -Math.PI / 3 }, { duration: 2500, easing: tween.linear }); } }); } }); } }); var wall3 = new Wall(); wall3.x = 1000; wall3.y = 1100; wall3.rotation = Math.PI / 3; wall3.scaleX = 1.5; walls.push(wall3); game.addChild(wall3); // Add diagonal movement to wall3 tween(wall3, { x: 1150, y: 950, rotation: Math.PI / 3 + Math.PI / 6 }, { duration: 3500, easing: tween.linear, onFinish: function onFinish() { tween(wall3, { x: 1000, y: 1100, rotation: Math.PI / 3 }, { duration: 3500, easing: tween.linear, onFinish: function onFinish() { // Loop the movement tween(wall3, { x: 1150, y: 950, rotation: Math.PI / 3 + Math.PI / 6 }, { duration: 3500, easing: tween.linear, onFinish: function onFinish() { tween(wall3, { x: 1000, y: 1100, rotation: Math.PI / 3 }, { duration: 3500, easing: tween.linear }); } }); } }); } }); var wall4 = new Wall(); wall4.x = 1300; wall4.y = 900; wall4.rotation = -Math.PI / 3; wall4.scaleX = 1.5; walls.push(wall4); game.addChild(wall4); // Add complex movement to wall4 tween(wall4, { x: 1450, y: 1050, rotation: -Math.PI / 3 - Math.PI / 6 }, { duration: 2800, easing: tween.linear, onFinish: function onFinish() { tween(wall4, { x: 1300, y: 900, rotation: -Math.PI / 3 }, { duration: 2800, easing: tween.linear, onFinish: function onFinish() { // Loop the movement tween(wall4, { x: 1450, y: 1050, rotation: -Math.PI / 3 - Math.PI / 6 }, { duration: 2800, easing: tween.linear, onFinish: function onFinish() { tween(wall4, { x: 1300, y: 900, rotation: -Math.PI / 3 }, { duration: 2800, easing: tween.linear }); } }); } }); } }); // Add fire obstacles var fire1 = new Fire(); fire1.x = 600; fire1.y = 1000; fireObstacles.push(fire1); game.addChild(fire1); var fire2 = new Fire(); fire2.x = 1200; fire2.y = 1000; fireObstacles.push(fire2); game.addChild(fire2); // Add water obstacles var water1 = new Water(); water1.x = 850; water1.y = 1100; waterObstacles.push(water1); game.addChild(water1); var water2 = new Water(); water2.x = 1400; water2.y = 800; waterObstacles.push(water2); game.addChild(water2); instructionText.setText('Zigzag through moving obstacles! Engine failed! Tap car to push!'); } else if (level === 16) { // Double trampoline jump var trampoline1 = new Trampoline(); trampoline1.x = 600; trampoline1.y = 1200; trampolines.push(trampoline1); game.addChild(trampoline1); var trampoline2 = new Trampoline(); trampoline2.x = 1000; trampoline2.y = 800; trampolines.push(trampoline2); game.addChild(trampoline2); var wall1 = new Wall(); wall1.x = 800; wall1.y = 1000; wall1.scaleX = 3; walls.push(wall1); game.addChild(wall1); instructionText.setText('Double bounce to reach the top!'); } else if (level === 17) { // Narrow passage with engine failure var wall1 = new Wall(); wall1.x = 800; wall1.y = 900; wall1.scaleY = 4; walls.push(wall1); game.addChild(wall1); var wall2 = new Wall(); wall2.x = 1200; wall2.y = 1100; wall2.scaleY = 4; walls.push(wall2); game.addChild(wall2); var trampoline = new Trampoline(); trampoline.x = 1000; trampoline.y = 1300; trampolines.push(trampoline); game.addChild(trampoline); instructionText.setText('Thread the needle! Engine failed! Tap car to push!'); } else if (level === 18) { // Multi-level platform var wall1 = new Wall(); wall1.x = 500; wall1.y = 1200; wall1.scaleX = 2; walls.push(wall1); game.addChild(wall1); var wall2 = new Wall(); wall2.x = 800; wall2.y = 1000; wall2.scaleX = 2; walls.push(wall2); game.addChild(wall2); var wall3 = new Wall(); wall3.x = 1100; wall3.y = 800; wall3.scaleX = 2; walls.push(wall3); game.addChild(wall3); var wall4 = new Wall(); wall4.x = 1400; wall4.y = 600; wall4.scaleX = 2; walls.push(wall4); game.addChild(wall4); var trampoline1 = new Trampoline(); trampoline1.x = 650; trampoline1.y = 1300; trampolines.push(trampoline1); game.addChild(trampoline1); var trampoline2 = new Trampoline(); trampoline2.x = 950; trampoline2.y = 1100; trampolines.push(trampoline2); game.addChild(trampoline2); var trampoline3 = new Trampoline(); trampoline3.x = 1250; trampoline3.y = 900; trampolines.push(trampoline3); game.addChild(trampoline3); instructionText.setText('Climb the platforms!'); } else if (level === 19) { // Extreme obstacle course with engine failure var wall1 = new Wall(); wall1.x = 400; wall1.y = 1100; wall1.rotation = Math.PI / 4; wall1.scaleX = 2; walls.push(wall1); game.addChild(wall1); var wall2 = new Wall(); wall2.x = 700; wall2.y = 800; wall2.rotation = -Math.PI / 4; wall2.scaleX = 2; walls.push(wall2); game.addChild(wall2); var wall3 = new Wall(); wall3.x = 1000; wall3.y = 1200; wall3.rotation = Math.PI / 6; wall3.scaleX = 2; walls.push(wall3); game.addChild(wall3); var wall4 = new Wall(); wall4.x = 1300; wall4.y = 700; wall4.rotation = -Math.PI / 6; wall4.scaleX = 2; walls.push(wall4); game.addChild(wall4); var trampoline1 = new Trampoline(); trampoline1.x = 550; trampoline1.y = 1300; trampolines.push(trampoline1); game.addChild(trampoline1); var trampoline2 = new Trampoline(); trampoline2.x = 850; trampoline2.y = 1000; trampolines.push(trampoline2); game.addChild(trampoline2); var trampoline3 = new Trampoline(); trampoline3.x = 1150; trampoline3.y = 900; trampolines.push(trampoline3); game.addChild(trampoline3); instructionText.setText('Ultimate challenge! Engine failed! Tap car to push!'); } else if (level === 16) { // Double trampoline jump var trampoline1 = new Trampoline(); trampoline1.x = 600; trampoline1.y = 1200; trampolines.push(trampoline1); game.addChild(trampoline1); var trampoline2 = new Trampoline(); trampoline2.x = 1000; trampoline2.y = 800; trampolines.push(trampoline2); game.addChild(trampoline2); var wall1 = new Wall(); wall1.x = 800; wall1.y = 1000; wall1.scaleX = 2.5; walls.push(wall1); game.addChild(wall1); // Add moving wall for level 16 var movingWall1 = new Wall(); movingWall1.x = 400; movingWall1.y = 900; movingWall1.scaleY = 2; walls.push(movingWall1); game.addChild(movingWall1); // Start slow movement tween(movingWall1, { y: 1100 }, { duration: 3000, easing: tween.linear, onFinish: function onFinish() { tween(movingWall1, { y: 900 }, { duration: 3000, easing: tween.linear, onFinish: function onFinish() { // Loop the movement tween(movingWall1, { y: 1100 }, { duration: 3000, easing: tween.linear, onFinish: function onFinish() { tween(movingWall1, { y: 900 }, { duration: 3000, easing: tween.linear }); } }); } }); } }); // Add fire obstacle var fire1 = new Fire(); fire1.x = 500; fire1.y = 1100; fireObstacles.push(fire1); game.addChild(fire1); // Add water obstacle var water1 = new Water(); water1.x = 1200; water1.y = 900; waterObstacles.push(water1); game.addChild(water1); instructionText.setText('Double bounce to reach the top! Avoid moving walls!'); } else if (level === 17) { // Narrow passage with engine failure var wall1 = new Wall(); wall1.x = 750; wall1.y = 900; wall1.scaleY = 3; walls.push(wall1); game.addChild(wall1); var wall2 = new Wall(); wall2.x = 1300; wall2.y = 1100; wall2.scaleY = 3; walls.push(wall2); game.addChild(wall2); // Add moving wall for level 17 var movingWall1 = new Wall(); movingWall1.x = 600; movingWall1.y = 1200; movingWall1.scaleX = 1.5; walls.push(movingWall1); game.addChild(movingWall1); // Start slow horizontal movement tween(movingWall1, { x: 900 }, { duration: 4000, easing: tween.linear, onFinish: function onFinish() { tween(movingWall1, { x: 600 }, { duration: 4000, easing: tween.linear, onFinish: function onFinish() { // Loop the movement tween(movingWall1, { x: 900 }, { duration: 4000, easing: tween.linear, onFinish: function onFinish() { tween(movingWall1, { x: 600 }, { duration: 4000, easing: tween.linear }); } }); } }); } }); // Add fire obstacle var fire1 = new Fire(); fire1.x = 750; fire1.y = 1150; fireObstacles.push(fire1); game.addChild(fire1); // Add water obstacle var water1 = new Water(); water1.x = 1100; water1.y = 1200; waterObstacles.push(water1); game.addChild(water1); var trampoline = new Trampoline(); trampoline.x = 1000; trampoline.y = 1300; trampolines.push(trampoline); game.addChild(trampoline); instructionText.setText('Thread the needle! Engine failed! Tap car to push!'); } else if (level === 18) { // Multi-level platform var wall1 = new Wall(); wall1.x = 450; wall1.y = 1200; wall1.scaleX = 1.5; walls.push(wall1); game.addChild(wall1); var wall2 = new Wall(); wall2.x = 850; wall2.y = 1000; wall2.scaleX = 1.5; walls.push(wall2); game.addChild(wall2); var wall3 = new Wall(); wall3.x = 1250; wall3.y = 800; wall3.scaleX = 1.5; walls.push(wall3); game.addChild(wall3); var wall4 = new Wall(); wall4.x = 1550; wall4.y = 600; wall4.scaleX = 1.5; walls.push(wall4); game.addChild(wall4); // Add moving wall for level 18 var movingWall1 = new Wall(); movingWall1.x = 700; movingWall1.y = 900; movingWall1.scaleY = 2; walls.push(movingWall1); game.addChild(movingWall1); // Start slow vertical movement tween(movingWall1, { y: 1100 }, { duration: 3500, easing: tween.linear, onFinish: function onFinish() { tween(movingWall1, { y: 900 }, { duration: 3500, easing: tween.linear, onFinish: function onFinish() { // Loop the movement tween(movingWall1, { y: 1100 }, { duration: 3500, easing: tween.linear, onFinish: function onFinish() { tween(movingWall1, { y: 900 }, { duration: 3500, easing: tween.linear }); } }); } }); } }); // Add fire obstacles var fire1 = new Fire(); fire1.x = 750; fire1.y = 1150; fireObstacles.push(fire1); game.addChild(fire1); var fire2 = new Fire(); fire2.x = 1350; fire2.y = 700; fireObstacles.push(fire2); game.addChild(fire2); // Add water obstacle var water1 = new Water(); water1.x = 1050; water1.y = 950; waterObstacles.push(water1); game.addChild(water1); var trampoline1 = new Trampoline(); trampoline1.x = 650; trampoline1.y = 1300; trampolines.push(trampoline1); game.addChild(trampoline1); var trampoline2 = new Trampoline(); trampoline2.x = 950; trampoline2.y = 1100; trampolines.push(trampoline2); game.addChild(trampoline2); var trampoline3 = new Trampoline(); trampoline3.x = 1250; trampoline3.y = 900; trampolines.push(trampoline3); game.addChild(trampoline3); instructionText.setText('Climb the platforms! Avoid moving obstacles!'); } else if (level === 19) { // Extreme obstacle course with engine failure var wall1 = new Wall(); wall1.x = 350; wall1.y = 1100; wall1.rotation = Math.PI / 4; wall1.scaleX = 1.5; walls.push(wall1); game.addChild(wall1); var wall2 = new Wall(); wall2.x = 800; wall2.y = 800; wall2.rotation = -Math.PI / 4; wall2.scaleX = 1.5; walls.push(wall2); game.addChild(wall2); var wall3 = new Wall(); wall3.x = 1200; wall3.y = 1200; wall3.rotation = Math.PI / 6; wall3.scaleX = 1.5; walls.push(wall3); game.addChild(wall3); var wall4 = new Wall(); wall4.x = 1500; wall4.y = 700; wall4.rotation = -Math.PI / 6; wall4.scaleX = 1.5; walls.push(wall4); game.addChild(wall4); // Add two moving walls for level 19 var movingWall1 = new Wall(); movingWall1.x = 600; movingWall1.y = 1000; movingWall1.scaleY = 1.5; walls.push(movingWall1); game.addChild(movingWall1); // Horizontal movement tween(movingWall1, { x: 900 }, { duration: 3000, easing: tween.linear, onFinish: function onFinish() { tween(movingWall1, { x: 600 }, { duration: 3000, easing: tween.linear, onFinish: function onFinish() { // Loop the movement tween(movingWall1, { x: 900 }, { duration: 3000, easing: tween.linear, onFinish: function onFinish() { tween(movingWall1, { x: 600 }, { duration: 3000, easing: tween.linear }); } }); } }); } }); var movingWall2 = new Wall(); movingWall2.x = 1100; movingWall2.y = 950; movingWall2.scaleX = 1.5; walls.push(movingWall2); game.addChild(movingWall2); // Vertical movement tween(movingWall2, { y: 1150 }, { duration: 2500, easing: tween.linear, onFinish: function onFinish() { tween(movingWall2, { y: 950 }, { duration: 2500, easing: tween.linear, onFinish: function onFinish() { // Loop the movement tween(movingWall2, { y: 1150 }, { duration: 2500, easing: tween.linear, onFinish: function onFinish() { tween(movingWall2, { y: 950 }, { duration: 2500, easing: tween.linear }); } }); } }); } }); // Add fire obstacles var fire1 = new Fire(); fire1.x = 750; fire1.y = 1150; fireObstacles.push(fire1); game.addChild(fire1); var fire2 = new Fire(); fire2.x = 1350; fire2.y = 800; fireObstacles.push(fire2); game.addChild(fire2); // Add water obstacles var water1 = new Water(); water1.x = 950; water1.y = 1050; waterObstacles.push(water1); game.addChild(water1); var water2 = new Water(); water2.x = 1200; water2.y = 950; waterObstacles.push(water2); game.addChild(water2); var trampoline1 = new Trampoline(); trampoline1.x = 550; trampoline1.y = 1300; trampolines.push(trampoline1); game.addChild(trampoline1); var trampoline2 = new Trampoline(); trampoline2.x = 850; trampoline2.y = 1000; trampolines.push(trampoline2); game.addChild(trampoline2); var trampoline3 = new Trampoline(); trampoline3.x = 1150; trampoline3.y = 900; trampolines.push(trampoline3); game.addChild(trampoline3); instructionText.setText('Ultimate challenge! Engine failed! Tap car to push!'); } else if (level === 20) { // Final boss level - completely restructured with moving elements var wall1 = new Wall(); wall1.x = 350; wall1.y = 1100; wall1.scaleX = 1.2; walls.push(wall1); game.addChild(wall1); // Add complex movement to wall1 tween(wall1, { x: 550, y: 1250 }, { duration: 2200, easing: tween.linear, onFinish: function onFinish() { tween(wall1, { x: 400, y: 1100 }, { duration: 2200, easing: tween.linear, onFinish: function onFinish() { // Loop the movement tween(wall1, { x: 550, y: 1250 }, { duration: 2200, easing: tween.linear, onFinish: function onFinish() { tween(wall1, { x: 400, y: 1100 }, { duration: 2200, easing: tween.linear }); } }); } }); } }); var wall2 = new Wall(); wall2.x = 800; wall2.y = 900; wall2.scaleY = 1.5; walls.push(wall2); game.addChild(wall2); // Add vertical oscillation to wall2 tween(wall2, { y: 1100 }, { duration: 1800, easing: tween.linear, onFinish: function onFinish() { tween(wall2, { y: 900 }, { duration: 1800, easing: tween.linear, onFinish: function onFinish() { // Loop the movement tween(wall2, { y: 1100 }, { duration: 1800, easing: tween.linear, onFinish: function onFinish() { tween(wall2, { y: 900 }, { duration: 1800, easing: tween.linear }); } }); } }); } }); var wall3 = new Wall(); wall3.x = 1200; wall3.y = 1300; wall3.rotation = Math.PI / 4; wall3.scaleX = 1.5; walls.push(wall3); game.addChild(wall3); // Add rotational and positional movement to wall3 tween(wall3, { x: 1200, y: 1100, rotation: Math.PI / 4 + Math.PI / 2 }, { duration: 2500, easing: tween.linear, onFinish: function onFinish() { tween(wall3, { x: 1000, y: 1300, rotation: Math.PI / 4 }, { duration: 2500, easing: tween.linear, onFinish: function onFinish() { // Loop the movement tween(wall3, { x: 1200, y: 1100, rotation: Math.PI / 4 + Math.PI / 2 }, { duration: 2500, easing: tween.linear, onFinish: function onFinish() { tween(wall3, { x: 1000, y: 1300, rotation: Math.PI / 4 }, { duration: 2500, easing: tween.linear }); } }); } }); } }); var wall4 = new Wall(); wall4.x = 1500; wall4.y = 800; wall4.rotation = -Math.PI / 3; wall4.scaleX = 1.4; walls.push(wall4); game.addChild(wall4); // Add fast complex movement to wall4 tween(wall4, { x: 1500, y: 1000, rotation: -Math.PI / 3 - Math.PI / 2 }, { duration: 2000, easing: tween.linear, onFinish: function onFinish() { tween(wall4, { x: 1300, y: 800, rotation: -Math.PI / 3 }, { duration: 2000, easing: tween.linear, onFinish: function onFinish() { // Loop the movement tween(wall4, { x: 1500, y: 1000, rotation: -Math.PI / 3 - Math.PI / 2 }, { duration: 2000, easing: tween.linear, onFinish: function onFinish() { tween(wall4, { x: 1300, y: 800, rotation: -Math.PI / 3 }, { duration: 2000, easing: tween.linear }); } }); } }); } }); // Add three moving walls for the final level var movingWall1 = new Wall(); movingWall1.x = 500; movingWall1.y = 1200; movingWall1.scaleX = 1.2; walls.push(movingWall1); game.addChild(movingWall1); // Slow circular movement var centerX1 = 500; var centerY1 = 1200; var radius1 = 100; var angle1 = 0; // Complex movement pattern tween(movingWall1, { x: centerX1 + radius1 }, { duration: 2000, easing: tween.linear, onFinish: function onFinish() { tween(movingWall1, { y: centerY1 + radius1 }, { duration: 2000, easing: tween.linear, onFinish: function onFinish() { tween(movingWall1, { x: centerX1 - radius1 }, { duration: 2000, easing: tween.linear, onFinish: function onFinish() { tween(movingWall1, { y: centerY1 - radius1 }, { duration: 2000, easing: tween.linear, onFinish: function onFinish() { // Loop back to start tween(movingWall1, { x: centerX1, y: centerY1 }, { duration: 2000, easing: tween.linear }); } }); } }); } }); } }); var movingWall2 = new Wall(); movingWall2.x = 900; movingWall2.y = 1000; movingWall2.scaleY = 2; walls.push(movingWall2); game.addChild(movingWall2); // Diagonal movement tween(movingWall2, { x: 1200, y: 1200 }, { duration: 3000, easing: tween.linear, onFinish: function onFinish() { tween(movingWall2, { x: 900, y: 1000 }, { duration: 3000, easing: tween.linear, onFinish: function onFinish() { // Loop the movement tween(movingWall2, { x: 1200, y: 1200 }, { duration: 3000, easing: tween.linear, onFinish: function onFinish() { tween(movingWall2, { x: 900, y: 1000 }, { duration: 3000, easing: tween.linear }); } }); } }); } }); var movingWall3 = new Wall(); movingWall3.x = 1400; movingWall3.y = 1100; movingWall3.scaleX = 1.5; movingWall3.rotation = Math.PI / 6; walls.push(movingWall3); game.addChild(movingWall3); // Vertical oscillation tween(movingWall3, { y: 1300 }, { duration: 2500, easing: tween.linear, onFinish: function onFinish() { tween(movingWall3, { y: 900 }, { duration: 2500, easing: tween.linear, onFinish: function onFinish() { // Loop the movement tween(movingWall3, { y: 1300 }, { duration: 2500, easing: tween.linear, onFinish: function onFinish() { tween(movingWall3, { y: 900 }, { duration: 2500, easing: tween.linear }); } }); } }); } }); // Add strategic trampolines var trampoline1 = new Trampoline(); trampoline1.x = 350; trampoline1.y = 1300; trampolines.push(trampoline1); game.addChild(trampoline1); var trampoline2 = new Trampoline(); trampoline2.x = 600; trampoline2.y = 1050; trampolines.push(trampoline2); game.addChild(trampoline2); var trampoline3 = new Trampoline(); trampoline3.x = 850; trampoline3.y = 750; trampolines.push(trampoline3); game.addChild(trampoline3); var trampoline4 = new Trampoline(); trampoline4.x = 1150; trampoline4.y = 1050; trampolines.push(trampoline4); game.addChild(trampoline4); var trampoline5 = new Trampoline(); trampoline5.x = 1500; trampoline5.y = 650; trampolines.push(trampoline5); game.addChild(trampoline5); // Add fire obstacles var fire1 = new Fire(); fire1.x = 650; fire1.y = 1150; fireObstacles.push(fire1); game.addChild(fire1); var fire2 = new Fire(); fire2.x = 1000; fire2.y = 950; fireObstacles.push(fire2); game.addChild(fire2); var fire3 = new Fire(); fire3.x = 1350; fire3.y = 800; fireObstacles.push(fire3); game.addChild(fire3); // Add water obstacles var water1 = new Water(); water1.x = 450; water1.y = 1200; waterObstacles.push(water1); game.addChild(water1); var water2 = new Water(); water2.x = 800; water2.y = 1000; waterObstacles.push(water2); game.addChild(water2); var water3 = new Water(); water3.x = 1200; water3.y = 1100; waterObstacles.push(water3); game.addChild(water3); instructionText.setText('FINAL BOSS! Navigate moving walls! Master all skills!'); } // Create car car = new Car(); car.x = startPos.x; car.y = startPos.y; car.engineWorking = false; // All levels now require manual control car.setVelocity(0, 0); // No automatic movement car.invulnerabilityTimer = 3000; // 3 seconds of invulnerability game.addChild(car); // Apply visual effect to show invulnerability tween(car, { alpha: 0.5 }, { duration: 200, easing: tween.linear, onFinish: function onFinish() { tween(car, { alpha: 1 }, { duration: 200, easing: tween.linear, onFinish: function onFinish() { // Continue flashing until invulnerability ends if (car.invulnerabilityTimer > 0) { tween(car, { alpha: 0.5 }, { duration: 200, easing: tween.linear, onFinish: function onFinish() { tween(car, { alpha: 1 }, { duration: 200, easing: tween.linear }); } }); } } }); } }); levelText.setText('Level ' + level); // Create start button if (startButton) startButton.destroy(); if (startButtonText) startButtonText.destroy(); startButton = game.addChild(LK.getAsset('startButton', { anchorX: 0.5, anchorY: 0.5, x: 150, y: 1366 })); startButtonText = new Text2('START', { size: 40, fill: 0xffffff }); startButtonText.anchor.set(0.5, 0.5); startButtonText.x = 150; startButtonText.y = 1366; game.addChild(startButtonText); // Create refresh button if (refreshButton) refreshButton.destroy(); if (refreshButtonText) refreshButtonText.destroy(); refreshButton = game.addChild(LK.getAsset('refreshButton', { anchorX: 0.5, anchorY: 0.5, x: 150, y: 1450 })); refreshButtonText = new Text2('REFRESH', { size: 35, fill: 0xffffff }); refreshButtonText.anchor.set(0.5, 0.5); refreshButtonText.x = 150; refreshButtonText.y = 1450; game.addChild(refreshButtonText); // Create reset button in top right corner if (resetButton) resetButton.destroy(); if (resetButtonText) resetButtonText.destroy(); resetButton = game.addChild(LK.getAsset('resetButton', { anchorX: 0.5, anchorY: 0.5, x: 1948, y: 100 })); resetButtonText = new Text2('RESET', { size: 30, fill: 0xffffff }); resetButtonText.anchor.set(0.5, 0.5); resetButtonText.x = 1948; resetButtonText.y = 100; game.addChild(resetButtonText); // Create back button next to level text if (backButton) backButton.destroy(); if (backButtonText) backButtonText.destroy(); backButton = game.addChild(LK.getAsset('backButton', { anchorX: 0.5, anchorY: 0.5, x: 320, y: 100 })); backButtonText = new Text2('BACK', { size: 30, fill: 0xffffff }); backButtonText.anchor.set(0.5, 0.5); backButtonText.x = 320; backButtonText.y = 100; game.addChild(backButtonText); // Create pedal button for all levels if (pedalButton) pedalButton.destroy(); if (pedalButtonText) pedalButtonText.destroy(); pedalButton = game.addChild(LK.getAsset('pedal', { anchorX: 0.5, anchorY: 0.5, x: 1900, y: 2600, scaleX: 2, scaleY: 2 })); pedalButtonText = new Text2('GAS', { size: 30, fill: 0xffffff }); pedalButtonText.anchor.set(0.5, 0.5); pedalButtonText.x = 1900; pedalButtonText.y = 2600; game.addChild(pedalButtonText); // Create brake button for all levels if (brakeButton) brakeButton.destroy(); if (brakeButtonText) brakeButtonText.destroy(); brakeButton = game.addChild(LK.getAsset('brake', { anchorX: 0.5, anchorY: 0.5, x: 150, y: 2600, scaleX: 2, scaleY: 2 })); brakeButtonText = new Text2('BRAKE', { size: 30, fill: 0xffffff }); brakeButtonText.anchor.set(0.5, 0.5); brakeButtonText.x = 150; brakeButtonText.y = 2600; game.addChild(brakeButtonText); // Create power indicator background var powerIndicatorBg = game.addChild(LK.getAsset('wall', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 2650, scaleX: 4, scaleY: 0.8, tint: 0x333333 })); // Create speed text if (game.speedText) game.speedText.destroy(); game.speedText = new Text2('Speed: 0.0', { size: 40, fill: 0x00ff00 }); game.speedText.anchor.set(0.5, 0.5); game.speedText.x = 800; game.speedText.y = 2650; game.addChild(game.speedText); // Create power text if (game.powerText) game.powerText.destroy(); game.powerText = new Text2('Power: 0.0', { size: 40, fill: 0xff6600 }); game.powerText.anchor.set(0.5, 0.5); game.powerText.x = 1248; game.powerText.y = 2650; game.addChild(game.powerText); } function checkLineCollision(line1Start, line1End, line2Start, line2End) { var x1 = line1Start.x; var y1 = line1Start.y; var x2 = line1End.x; var y2 = line1End.y; var x3 = line2Start.x; var y3 = line2Start.y; var x4 = line2End.x; var y4 = line2End.y; var denom = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4); if (Math.abs(denom) < 0.0001) return null; var t = ((x1 - x3) * (y3 - y4) - (y1 - y3) * (x3 - x4)) / denom; var u = -((x1 - x2) * (y1 - y3) - (y1 - y2) * (x1 - x3)) / denom; if (t >= 0 && t <= 1 && u >= 0 && u <= 1) { return { x: x1 + t * (x2 - x1), y: y1 + t * (y2 - y1) }; } return null; } function safeTween(target, properties, options) { // Only create tween if we haven't exceeded the limit if (tweenCount < maxConcurrentTweens) { tweenCount++; var originalOnFinish = options.onFinish; options.onFinish = function () { tweenCount--; if (originalOnFinish) originalOnFinish(); }; return tween(target, properties, options); } return null; // Return null if tween limit exceeded } function cleanupMemory() { // Clean up old smoke particles more aggressively for (var i = smokeParticles.length - 1; i >= 0; i--) { if (smokeParticles[i].alpha <= 0.1 || !smokeParticles[i].parent) { smokeParticles[i].destroy(); smokeParticles.splice(i, 1); } } // Limit smoke particles to prevent memory buildup while (smokeParticles.length > maxSmokeParticles) { var oldestSmoke = smokeParticles.shift(); if (oldestSmoke && oldestSmoke.destroy) { oldestSmoke.destroy(); } } // Clean up any orphaned display objects if (game && game.children) { for (var i = game.children.length - 1; i >= 0; i--) { var child = game.children[i]; if (child && child.alpha <= 0 && child !== car) { child.destroy(); } } } // Force garbage collection hint if (typeof global !== 'undefined' && global.gc) { global.gc(); } } function createCarDestructionEffect() { if (!car) return; // Stop car movement car.velocityX = 0; car.velocityY = 0; car.engineWorking = false; // Create multiple car fragments for explosion effect var fragments = []; for (var i = 0; i < 8; i++) { var fragment = game.addChild(LK.getAsset('car', { anchorX: 0.5, anchorY: 0.5, x: car.x, y: car.y, scaleX: 0.3, scaleY: 0.3, tint: 0xff0000 })); fragments.push(fragment); // Random explosion direction var angle = Math.PI * 2 * i / 8; var distance = 100 + Math.random() * 100; var targetX = car.x + Math.cos(angle) * distance; var targetY = car.y + Math.sin(angle) * distance; // Animate fragment explosion tween(fragment, { x: targetX, y: targetY, rotation: Math.random() * Math.PI * 4, alpha: 0 }, { duration: 800, easing: tween.easeOut, onFinish: function onFinish() { fragment.destroy(); } }); // Scale animation tween(fragment.scale, { x: 0, y: 0 }, { duration: 800, easing: tween.easeIn }); } // Hide original car and restart level after animation car.alpha = 0; LK.setTimeout(function () { setupLevel(currentLevel); }, 1000); } function handleCarPhysics() { if (!car || !drawnLine || levelComplete || !carCanMove || !gameStarted) return; // Update invulnerability timer (3 seconds at start) if (car.invulnerabilityTimer > 0) { car.invulnerabilityTimer -= 16.67; // Approximately 1 frame at 60fps } var carBottom = { x: car.x, y: car.y + 20 }; // Check collision with all drawn lines var onLine = false; var closestSegment = null; var closestDistance = Infinity; var closestCollision = null; for (var lineIndex = 0; lineIndex < drawnLines.length; lineIndex++) { var segments = drawnLines[lineIndex].getSegments(); for (var i = 0; i < segments.length; i++) { var segment = segments[i]; var carRay = { start: { x: car.x, y: car.y }, end: { x: car.x, y: car.y + 30 } }; var collision = checkLineCollision(carRay.start, carRay.end, segment.start, segment.end); if (collision) { var distance = Math.abs(collision.y - car.y); if (distance < closestDistance) { closestDistance = distance; closestSegment = segment; closestCollision = collision; onLine = true; } } } } // If car is on a line, constrain it to follow the path if (onLine && closestSegment && closestCollision) { car.y = closestCollision.y - 20; car.velocityY = 0; var dx = closestSegment.end.x - closestSegment.start.x; var dy = closestSegment.end.y - closestSegment.start.y; var angle = Math.atan2(dy, dx); // Constrain car movement to follow the line direction var lineLength = Math.sqrt(dx * dx + dy * dy); var normalizedDx = dx / lineLength; var normalizedDy = dy / lineLength; // Check if the line is too steep (near vertical) var absoluteAngle = Math.abs(angle); var isNearVertical = absoluteAngle > Math.PI * 0.4 && absoluteAngle < Math.PI * 0.6 || absoluteAngle > Math.PI * 1.4 && absoluteAngle < Math.PI * 1.6; // For steep angles, maintain minimum horizontal movement to prevent getting stuck if (isNearVertical) { // Ensure car maintains some horizontal velocity to keep moving along steep paths var minHorizontalVel = 0.5; if (Math.abs(car.velocityX) < minHorizontalVel) { car.velocityX = car.velocityX >= 0 ? minHorizontalVel : -minHorizontalVel; } } // Project car velocity onto the line direction var projectionMagnitude = car.velocityX * normalizedDx + car.velocityY * normalizedDy; car.velocityX = projectionMagnitude * normalizedDx; car.velocityY = projectionMagnitude * normalizedDy; // Apply slope physics with reduced intensity for steep angles var slopeIntensity = isNearVertical ? 0.1 : 0.2; var slopeAcceleration = Math.sin(angle) * slopeIntensity; car.velocityX += Math.cos(angle) * slopeAcceleration; car.velocityY += Math.sin(angle) * slopeAcceleration; // Apply general friction var frictionFactor = 0.98; if (Math.sin(angle) > 0) { // Going downhill - less friction frictionFactor = 0.995; } else if (Math.sin(angle) < 0) { // Going uphill - more friction, but less for steep angles to prevent stalling frictionFactor = isNearVertical ? 0.97 : 0.96; } car.velocityX *= frictionFactor; car.velocityY *= frictionFactor; // Limit rotation angle to prevent completely vertical orientation var maxRotation = Math.PI * 0.45; // 45 degrees max var targetRotation = angle; if (Math.abs(angle) > maxRotation && Math.abs(angle) < Math.PI - maxRotation) { targetRotation = angle > 0 ? maxRotation : -maxRotation; } else if (Math.abs(angle) > Math.PI + maxRotation && Math.abs(angle) < 2 * Math.PI - maxRotation) { targetRotation = angle > Math.PI ? Math.PI + maxRotation : Math.PI - maxRotation; } // Smooth rotation transition using tweening var rotationDifference = Math.abs(targetRotation - car.rotation); if (rotationDifference > 0.1) { // Only tween if there's a significant difference // Stop any existing rotation tween tween.stop(car, { rotation: true }); // Calculate appropriate tween duration based on rotation difference var tweenDuration = Math.min(300, rotationDifference * 200); // Max 300ms, scaled by angle difference // Smooth rotation tween tween(car, { rotation: targetRotation }, { duration: tweenDuration, easing: tween.easeOut }); } else { car.rotation = targetRotation; } } car.onGround = onLine; // Check collision with trampolines for (var i = 0; i < trampolines.length; i++) { if (car.intersects(trampolines[i])) { car.velocityY = -7.5; // Reduced from -15 to half trampolines[i].bounce(); LK.getSound('bounce').play(); // Skip wall collision check this frame to prevent explosion return; } } // Check collision with fire obstacles - only if not invulnerable if (car.invulnerabilityTimer <= 0) { for (var i = 0; i < fireObstacles.length; i++) { if (car.intersects(fireObstacles[i])) { // Car touches fire - destroy car LK.getSound('burn').play(); createCarDestructionEffect(); return; // Exit early to prevent further physics } } } // Check collision with water obstacles var inWater = false; for (var i = 0; i < waterObstacles.length; i++) { if (car.intersects(waterObstacles[i])) { inWater = true; LK.getSound('splash').play(); break; } } // Apply speed reduction if in water if (inWater) { carSpeedReduction = 0.5; // 50% speed reduction } else { carSpeedReduction = 1.0; // Normal speed } // Apply speed reduction to car velocity car.velocityX *= carSpeedReduction; car.velocityY *= carSpeedReduction; // Check if car reached finish var distToFinish = Math.sqrt(Math.pow(car.x - finishPos.x, 2) + Math.pow(car.y - finishPos.y, 2)); if (distToFinish < 100) { levelComplete = true; LK.getSound('success').play(); // Award points for completing level totalPoints += pointsPerLevel; storage.totalPoints = totalPoints; // Update points display if (game.pointsText) { game.pointsText.setText('Points: ' + totalPoints); } currentLevel++; storage.currentLevel = currentLevel; if (currentLevel > maxLevel) { LK.setScore(100); LK.showYouWin(); } else { LK.setTimeout(function () { setupLevel(currentLevel); }, 1500); } } // Check collision with walls - only trigger when car actually touches wall and not invulnerable if (car.invulnerabilityTimer <= 0) { for (var i = 0; i < walls.length; i++) { var wall = walls[i]; // Get the actual wall asset to determine real dimensions var wallAsset = wall.children[0]; // Get the wall graphics asset if (!wallAsset) continue; // Calculate actual wall bounds using asset dimensions and transformations var actualWallWidth = 200 * wall.scaleX; // 200 is the base wall asset width var actualWallHeight = 40 * wall.scaleY; // 40 is the base wall asset height // Apply rotation if present var wallBounds = { left: wall.x - actualWallWidth / 2, right: wall.x + actualWallWidth / 2, top: wall.y - actualWallHeight / 2, bottom: wall.y + actualWallHeight / 2 }; // For rotated walls, we need to check collision differently if (wall.rotation && Math.abs(wall.rotation) > 0.1) { // Use the intersects method for rotated walls as it handles rotation properly if (car.intersects(wall)) { createCarDestructionEffect(); return; // Exit early to prevent further physics } } else { // For non-rotated walls, use precise bounds checking var carLeft = car.x - 40; var carRight = car.x + 40; var carTop = car.y - 20; var carBottom = car.y + 20; // Check if car is actually touching the wall bounds var touchingHorizontally = carRight >= wallBounds.left && carLeft <= wallBounds.right; var touchingVertically = carBottom >= wallBounds.top && carTop <= wallBounds.bottom; if (touchingHorizontally && touchingVertically) { // Car is actually touching the wall - create destruction effect createCarDestructionEffect(); return; // Exit early to prevent further physics } } } } // Check if car fell off screen if (car.y > 2732) { setupLevel(currentLevel); } } game.down = function (x, y, obj) { if (levelComplete) return; // Check if start button clicked if (startButton && Math.abs(x - startButton.x) < 75 && Math.abs(y - startButton.y) < 30) { // Only start if we have drawn at least one line if (drawnLines.length > 0 && !gameStarted) { gameStarted = true; carCanMove = true; startButton.tint = 0x888888; } return; } // Check if refresh button clicked if (refreshButton && Math.abs(x - refreshButton.x) < 75 && Math.abs(y - refreshButton.y) < 30) { // Reset current level setupLevel(currentLevel); return; } // Check if reset button clicked if (resetButton && Math.abs(x - resetButton.x) < 60 && Math.abs(y - resetButton.y) < 25) { // Reset everything - go back to level 1 currentLevel = 1; storage.currentLevel = 1; setupLevel(currentLevel); return; } // Check if back button clicked if (backButton && Math.abs(x - 320) < 60 && Math.abs(y - backButton.y) < 25) { // Go back to previous level if not at level 1 if (currentLevel > 1) { currentLevel--; storage.currentLevel = currentLevel; setupLevel(currentLevel); } return; } // Check if pedal button clicked for all levels if (pedalButton && gameStarted && Math.abs(x - pedalButton.x) < 120 && Math.abs(y - pedalButton.y) < 80) { pedalButtonPressed = true; pedalAcceleration = 0.5; // Start with slow acceleration // Fade button to indicate it's pressed tween(pedalButton, { alpha: 0.5 }, { duration: 100, easing: tween.easeOut }); tween(pedalButtonText, { alpha: 0.5 }, { duration: 100, easing: tween.easeOut }); return; } // Check if brake button clicked for all levels if (brakeButton && gameStarted && Math.abs(x - brakeButton.x) < 120 && Math.abs(y - brakeButton.y) < 80) { brakeButtonPressed = true; brakeAcceleration = 0.5; // Start with slow acceleration // Fade button to indicate it's pressed tween(brakeButton, { alpha: 0.5 }, { duration: 100, easing: tween.easeOut }); tween(brakeButtonText, { alpha: 0.5 }, { duration: 100, easing: tween.easeOut }); return; } // Check if speed upgrade button clicked if (game.speedUpgradeButton && Math.abs(x - 1600) < 60 && Math.abs(y - 200) < 40) { var speedCost = Math.floor(upgradeBaseCost * Math.pow(upgradeMultiplier, speedUpgradeLevel)); if (totalPoints >= speedCost) { totalPoints -= speedCost; speedUpgradeLevel++; storage.totalPoints = totalPoints; storage.speedUpgradeLevel = speedUpgradeLevel; // Update displays setupLevel(currentLevel); } return; } // Check if power upgrade button clicked if (game.powerUpgradeButton && Math.abs(x - 1800) < 60 && Math.abs(y - 200) < 40) { var powerCost = Math.floor(upgradeBaseCost * Math.pow(upgradeMultiplier, powerUpgradeLevel)); if (totalPoints >= powerCost) { totalPoints -= powerCost; powerUpgradeLevel++; storage.totalPoints = totalPoints; storage.powerUpgradeLevel = powerUpgradeLevel; // Update displays setupLevel(currentLevel); } return; } // Check if starting from behind the car (unlimited lines) if (x < car.x - 50 && !gameStarted) { isDrawing = true; drawnLine = new DrawnLine(); game.addChild(drawnLine); drawnLine.addPoint(x, y); } }; game.move = function (x, y, obj) { if (isDrawing && drawnLine) { drawnLine.addPoint(x, y); } }; game.up = function (x, y, obj) { if (isDrawing && drawnLine) { // Don't automatically allow car to move - wait for start button // Store the completed line and increment counter drawnLines.push(drawnLine); currentLineCount++; // Update line counter display if (game.lineCounterText) { game.lineCounterText.setText('Lines: Unlimited'); } } // Reset brake and pedal button states when mouse/touch is released brakeButtonPressed = false; brakeAcceleration = 0; pedalButtonPressed = false; pedalAcceleration = 0; // Restore button alpha when released if (brakeButton) { tween(brakeButton, { alpha: 1.0 }, { duration: 150, easing: tween.easeOut }); tween(brakeButtonText, { alpha: 1.0 }, { duration: 150, easing: tween.easeOut }); } if (pedalButton) { tween(pedalButton, { alpha: 1.0 }, { duration: 150, easing: tween.easeOut }); tween(pedalButtonText, { alpha: 1.0 }, { duration: 150, easing: tween.easeOut }); } isDrawing = false; }; game.update = function () { // Handle brake button progressive acceleration if (brakeButtonPressed && gameStarted && car) { // Gradually increase brake acceleration while button is held if (brakeAcceleration < maxBrakeAcceleration) { brakeAcceleration += brakeAccelerationIncrement; } // Apply upgrades to braking power var powerMultiplier = 1 + powerUpgradeLevel * 0.05; // 5% increase per level var enhancedBraking = brakeAcceleration * powerMultiplier; // Apply backward movement force instead of just slowing down car.velocityX -= enhancedBraking * 0.8; // Move backward horizontally car.velocityY += enhancedBraking * 0.3; // Small downward component for realistic movement } // Handle pedal button progressive acceleration if (pedalButtonPressed && gameStarted && car) { // Gradually increase pedal acceleration while button is held if (pedalAcceleration < maxPedalAcceleration) { pedalAcceleration += pedalAccelerationIncrement; } // Apply upgrades to acceleration var speedMultiplier = 1 + speedUpgradeLevel * 0.05; // 5% increase per level var powerMultiplier = 1 + powerUpgradeLevel * 0.05; // 5% increase per level var enhancedAcceleration = pedalAcceleration * powerMultiplier; // Apply forward movement with enhanced acceleration car.velocityX += enhancedAcceleration * speedMultiplier; car.velocityY -= enhancedAcceleration * speedMultiplier * 0.4; // Small upward component } handleCarPhysics(); // Move trampolines if they have movement properties for (var i = 0; i < trampolines.length; i++) { var trampoline = trampolines[i]; if (trampoline.moveDirection !== undefined) { trampoline.x += trampoline.moveDirection * trampoline.moveSpeed; // Bounce off boundaries if (trampoline.x <= trampoline.minX || trampoline.x >= trampoline.maxX) { trampoline.moveDirection *= -1; } } } // Update fire obstacles animation for (var i = 0; i < fireObstacles.length; i++) { if (fireObstacles[i] && fireObstacles[i].update) { fireObstacles[i].update(); } } // Update water obstacles animation for (var i = 0; i < waterObstacles.length; i++) { if (waterObstacles[i] && waterObstacles[i].update) { waterObstacles[i].update(); } } // Create smoke particles when car is moving (with memory management) if (car && gameStarted && carCanMove && (Math.abs(car.velocityX) > 0.5 || Math.abs(car.velocityY) > 0.5)) { smokeTimer++; if (smokeTimer % 6 === 0 && smokeParticles.length < maxSmokeParticles) { // Reduced frequency and added limit // Create smoke every 6 frames instead of 4, and only if under limit var smoke = new SmokeParticle(); // Position smoke behind the car based on its rotation var offsetX = -Math.cos(car.rotation) * 40; var offsetY = -Math.sin(car.rotation) * 40; smoke.init(car.x + offsetX, car.y + offsetY); game.addChild(smoke); smokeParticles.push(smoke); } } // Clean up old smoke particles with better memory management for (var i = smokeParticles.length - 1; i >= 0; i--) { if (smokeParticles[i] && (smokeParticles[i].alpha <= 0.1 || !smokeParticles[i].parent)) { smokeParticles[i].destroy(); smokeParticles.splice(i, 1); } } // Regular memory cleanup every 600 frames (10 seconds at 60fps) - less frequent memoryCleanupTimer++; if (memoryCleanupTimer >= 600) { memoryCleanupTimer = 0; cleanupMemory(); } // Update power indicator if (car && game.speedText && game.powerText) { // Calculate speed from velocity var speed = Math.sqrt(car.velocityX * car.velocityX + car.velocityY * car.velocityY); game.speedText.setText('Speed: ' + speed.toFixed(1)); // Calculate power based on current acceleration states var currentPower = 0; if (pedalButtonPressed) { currentPower = pedalAcceleration; } else if (brakeButtonPressed) { currentPower = -brakeAcceleration; } game.powerText.setText('Power: ' + currentPower.toFixed(1)); // Keep power text visible with consistent color - no color changes game.powerText.alpha = 1; // Ensure full opacity // Keep speed text visible with consistent color - no color changes game.speedText.alpha = 1; // Ensure full opacity } }; // Initialize first level setupLevel(currentLevel);
===================================================================
--- original.js
+++ change.js
@@ -118,9 +118,9 @@
tint: 0x999999,
alpha: 0.6
});
self.init = function (x, y) {
- self.x = x;
+ self.x = x * 0.97; // Position smoke 3% to the left
self.y = y;
self.scale.set(0.3);
// Animate the smoke particle with auto-cleanup
tween(self, {
@@ -4008,11 +4008,9 @@
var smoke = new SmokeParticle();
// Position smoke behind the car based on its rotation
var offsetX = -Math.cos(car.rotation) * 40;
var offsetY = -Math.sin(car.rotation) * 40;
- // Position smoke 10% to the left by adjusting base position
- var smokeBaseX = car.x - car.x * 0.1;
- smoke.init(smokeBaseX + offsetX, car.y + offsetY);
+ smoke.init(car.x + offsetX, car.y + offsetY);
game.addChild(smoke);
smokeParticles.push(smoke);
}
}
Bitiş bayrağı, yazısız, 3d, gerçekçi. In-Game asset. 2d. High contrast. No shadows
araba gaz pedalı, yazısız, 3d, gerçekçi. In-Game asset. 2d. High contrast. No shadows. In-Game asset. 2d. High contrast. No shadows
araba, yazısız, 3d, gerçekçi, yandan görünüm, In-Game asset. 2d. High contrast. No shadows. In-Game asset. 2d. High contrast. No shadows
ateş, 3d, yazısız. In-Game asset. 2d. High contrast. No shadows
water, 3d, yazısız. In-Game asset. 2d. High contrast. No shadows
wall, 3d, yazısız. In-Game asset. 2d. High contrast. No shadows
trampoline, 3d, yazısız. In-Game asset. 2d. High contrast. No shadows