User prompt
Arabanın otomatik hareketini tamamen kaldır. Brake ve pedal butonları ile araç kontrolü sağlansın.
User prompt
Sol altta, Brake butonu oluştur. Pedal butonunun tersini yapsın, giden arabaya fren ve duran arabayı geriye gitmesini sağlasın.
User prompt
Pedal bütün bölümlerde olsun.
User prompt
Motor arızalı bölümlerde sağ alta pedal gelsin. Ona tıklayarak aracın gitmesini sağlayalım.
User prompt
Motor arızalı bölümlerde, arabaya tıklayarak gitmesini sağlayalım.
User prompt
Motor arızalı bölümlerde, araba yokuş aşağı hızlansın, yokuş yukarı yavaşlasın.
User prompt
Motor arızalı bölümlerde, araba ileri doğru çıkmasın, başladığı yerde aşağı düşsün.
User prompt
Level 13 çok zor. Daha kolay olsun
User prompt
Level 13'ü yeniden tasarla.
User prompt
Level başı en fazla 3 çizgi çekebilelim.
User prompt
Level 13'ü yeniden tasarla.
User prompt
Duvarların etki alanı, yalnızca resim boyutları kadar olsun.
User prompt
Duvara çarpan araba parçalansın ve yok olsun. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Bütün bölümlerde, sadece 1 tane bitiş yeri olsun.
User prompt
Bazı bölümlerde neden 2 tane bitiş yeri var? Yalnızca 1 bitiş yeri olsun tamamen.
User prompt
Level 5'i yeniden tasarla.
User prompt
Level 5'i yeniden tasarla.
User prompt
Back butonunu 1 satır sağa konumlandır.
User prompt
Level yazısının sol satırına "Back" butonu ekle. Basınca bir önceki bölüme gitsin.
User prompt
Level 4'ü yeniden tasarlandır.
User prompt
Sağ üst köşeye Reset butonu ekle. Basınca herşey sıfırlansın.
User prompt
Level 10 yeniden tasarla
User prompt
Level 5'den sonra, aynı zorluklar ile ve farklı özellikler ile 15 bölüm daha oluştur.
User prompt
Tramboline zıplama oranını yarıya indir.
User prompt
"" *Aşırı sürtünme etkisi** - Motor bozuk olduğunda araç çok hızlı duraksıyor 2. **Başlangıç hızı yetersiz** - Sadece (5, 0) hızla başlıyor, bu tramboline ulaşmak için yeterli değil 3. **Fizik hesaplama sorunu** - Çizgi üzerinde hareket ederken bile sürtünme devam ediyor. "" bunları biraz daha kolay olması için düzenle.
/**** * 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 }); var wheelLeft = self.attachAsset('wheel', { anchorX: 0.5, anchorY: 0.5, x: -25, y: 20 }); var wheelRight = self.attachAsset('wheel', { anchorX: 0.5, anchorY: 0.5, x: 25, 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; if (!self.engineWorking) { self.velocityX *= 0.995; // Much less aggressive friction } self.velocityY += self.gravity; self.x += self.velocityX; self.y += self.velocityY; wheelLeft.rotation += self.velocityX * 0.1; wheelRight.rotation += self.velocityX * 0.1; }; 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 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; self.y = y; self.scale.set(0.3); // Animate the smoke particle tween(self, { y: y - 50, alpha: 0 }, { duration: 800, easing: tween.easeOut }); tween(self.scale, { x: 1.2, y: 1.2 }, { duration: 800, 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; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0xE8E8E8 }); /**** * Game Code ****/ var currentLevel = storage.currentLevel || 1; var maxLevel = 20; 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 smokeParticles = []; var smokeTimer = 0; var startPos = { x: 200, y: 1000 }; 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); function setupLevel(level) { // Clear existing objects if (car) car.destroy(); for (var i = 0; i < walls.length; i++) { walls[i].destroy(); } for (var i = 0; i < trampolines.length; i++) { trampolines[i].destroy(); } if (drawnLine) drawnLine.destroy(); // Clear smoke particles for (var i = 0; i < smokeParticles.length; i++) { smokeParticles[i].destroy(); } smokeParticles = []; walls = []; trampolines = []; drawnLine = null; isDrawing = false; levelComplete = false; carCanMove = false; gameStarted = false; // 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 })); // Setup level-specific elements if (level === 1) { // Simple level - just draw from start to finish instructionText.setText('Draw a path, then press START!'); } else if (level === 2) { // Wall in the middle var wall = new Wall(); wall.x = 1024; wall.y = 1000; walls.push(wall); game.addChild(wall); instructionText.setText('Draw around the wall!'); } 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); var wall2 = new Wall(); wall2.x = 1224; wall2.y = 900; wall2.rotation = Math.PI / 2; walls.push(wall2); game.addChild(wall2); instructionText.setText('Navigate the L-shape!'); } else if (level === 4) { // Gap in the ground finishPos.y = 1800; finishFlag.y = finishPos.y + 50; instructionText.setText('Bridge the gap!'); } else if (level === 5) { // Engine failure with trampoline var trampoline = new Trampoline(); trampoline.x = 1024; trampoline.y = 1200; trampolines.push(trampoline); game.addChild(trampoline); instructionText.setText('Engine failed! Use the trampoline!'); } else if (level === 6) { // Multiple trampolines with walls var wall1 = new Wall(); wall1.x = 800; wall1.y = 1000; wall1.scaleY = 2; walls.push(wall1); game.addChild(wall1); 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); var wall2 = new Wall(); wall2.x = 1400; wall2.y = 900; wall2.rotation = -Math.PI / 4; walls.push(wall2); game.addChild(wall2); finishPos.y = 1200; finishFlag.y = finishPos.y + 50; instructionText.setText('Engine down! Navigate carefully!'); } else if (level === 8) { // Maze-like structure var wall1 = new Wall(); wall1.x = 500; wall1.y = 1000; wall1.scaleX = 1.5; wall1.rotation = Math.PI / 2; walls.push(wall1); game.addChild(wall1); var wall2 = new Wall(); wall2.x = 800; wall2.y = 800; wall2.scaleX = 1.5; walls.push(wall2); game.addChild(wall2); var wall3 = new Wall(); wall3.x = 1200; wall3.y = 1200; wall3.scaleX = 1.5; wall3.rotation = Math.PI / 2; walls.push(wall3); game.addChild(wall3); var wall4 = new Wall(); wall4.x = 1500; wall4.y = 900; wall4.scaleX = 1.5; walls.push(wall4); game.addChild(wall4); instructionText.setText('Find your way through the 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); finishPos.y = 800; finishFlag.y = finishPos.y + 50; instructionText.setText('Bounce through the sequence!'); } else if (level === 10) { // Moving trampolines with precise timing - engine failure finishPos.y = 400; finishFlag.y = finishPos.y + 50; // Create three moving trampolines 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); var wall2 = new Wall(); wall2.x = 1100; wall2.y = 900; wall2.scaleX = 2; walls.push(wall2); game.addChild(wall2); var wall3 = new Wall(); wall3.x = 1500; wall3.y = 600; wall3.scaleX = 2; walls.push(wall3); game.addChild(wall3); instructionText.setText('Time your jumps! Moving trampolines! Engine failed!'); } else if (level === 11) { // Complex obstacle course var wall1 = new Wall(); wall1.x = 400; wall1.y = 1000; wall1.scaleY = 3; walls.push(wall1); game.addChild(wall1); var wall2 = new Wall(); wall2.x = 800; wall2.y = 800; wall2.scaleX = 2; walls.push(wall2); game.addChild(wall2); var wall3 = new Wall(); wall3.x = 1200; wall3.y = 1200; wall3.scaleY = 2; walls.push(wall3); game.addChild(wall3); var trampoline = new Trampoline(); trampoline.x = 600; trampoline.y = 1300; trampolines.push(trampoline); game.addChild(trampoline); finishPos.y = 700; finishFlag.y = finishPos.y + 50; instructionText.setText('Navigate the obstacle course!'); } else if (level === 12) { // Multiple gaps with trampolines finishPos.y = 1600; finishFlag.y = finishPos.y + 50; 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); instructionText.setText('Bridge multiple gaps!'); } else if (level === 13) { // Spiral challenge with engine failure var wall1 = new Wall(); wall1.x = 600; wall1.y = 1000; wall1.rotation = Math.PI / 6; wall1.scaleX = 2; walls.push(wall1); game.addChild(wall1); var wall2 = new Wall(); wall2.x = 900; wall2.y = 800; wall2.rotation = -Math.PI / 6; wall2.scaleX = 2; walls.push(wall2); game.addChild(wall2); var wall3 = new Wall(); wall3.x = 1200; wall3.y = 1100; wall3.rotation = Math.PI / 6; wall3.scaleX = 2; walls.push(wall3); game.addChild(wall3); var trampoline = new Trampoline(); trampoline.x = 1000; trampoline.y = 1300; trampolines.push(trampoline); game.addChild(trampoline); finishPos.y = 600; finishFlag.y = finishPos.y + 50; instructionText.setText('Spiral up! Engine failed!'); } else if (level === 14) { // Tower climbing var wall1 = new Wall(); wall1.x = 500; wall1.y = 1200; walls.push(wall1); game.addChild(wall1); var wall2 = new Wall(); wall2.x = 700; wall2.y = 1000; walls.push(wall2); game.addChild(wall2); var wall3 = new Wall(); wall3.x = 900; wall3.y = 800; walls.push(wall3); game.addChild(wall3); var wall4 = new Wall(); wall4.x = 1100; wall4.y = 600; walls.push(wall4); game.addChild(wall4); 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); finishPos.y = 400; finishFlag.y = finishPos.y + 50; 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); 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); 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); 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); instructionText.setText('Zigzag to victory! Engine failed!'); } 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); finishPos.y = 600; finishFlag.y = finishPos.y + 50; 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); finishPos.y = 800; finishFlag.y = finishPos.y + 50; instructionText.setText('Thread the needle! Engine failed!'); } 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); finishPos.y = 500; finishFlag.y = finishPos.y + 50; 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); finishPos.y = 500; finishFlag.y = finishPos.y + 50; instructionText.setText('Ultimate challenge! Engine failed!'); } else if (level === 20) { // Final boss level - complex multi-stage var wall1 = new Wall(); wall1.x = 350; wall1.y = 1000; wall1.scaleY = 3; walls.push(wall1); game.addChild(wall1); var wall2 = new Wall(); wall2.x = 600; wall2.y = 800; wall2.scaleX = 2; walls.push(wall2); game.addChild(wall2); var wall3 = new Wall(); wall3.x = 900; wall3.y = 1200; wall3.rotation = Math.PI / 3; wall3.scaleX = 2; walls.push(wall3); game.addChild(wall3); var wall4 = new Wall(); wall4.x = 1200; wall4.y = 600; wall4.scaleX = 2; walls.push(wall4); game.addChild(wall4); var wall5 = new Wall(); wall5.x = 1500; wall5.y = 900; wall5.rotation = -Math.PI / 4; wall5.scaleX = 2; walls.push(wall5); game.addChild(wall5); var trampoline1 = new Trampoline(); trampoline1.x = 500; trampoline1.y = 1300; trampolines.push(trampoline1); game.addChild(trampoline1); var trampoline2 = new Trampoline(); trampoline2.x = 750; trampoline2.y = 1000; trampolines.push(trampoline2); game.addChild(trampoline2); var trampoline3 = new Trampoline(); trampoline3.x = 1050; trampoline3.y = 800; trampolines.push(trampoline3); game.addChild(trampoline3); var trampoline4 = new Trampoline(); trampoline4.x = 1350; trampoline4.y = 1100; trampolines.push(trampoline4); game.addChild(trampoline4); finishPos.y = 400; finishFlag.y = finishPos.y + 50; instructionText.setText('Final challenge! Master all skills!'); } // Create car car = new Car(); car.x = startPos.x; car.y = startPos.y; if (level === 5 || level === 7 || level === 10 || level === 13 || level === 15 || level === 17 || level === 19) { car.engineWorking = false; car.setVelocity(12, 0); // Increased from 5 to 12 for better momentum } game.addChild(car); 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); } 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 handleCarPhysics() { if (!car || !drawnLine || levelComplete || !carCanMove || !gameStarted) return; var carBottom = { x: car.x, y: car.y + 20 }; var segments = drawnLine.getSegments(); var onLine = false; 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) { onLine = true; car.y = collision.y - 20; car.velocityY = 0; var dx = segment.end.x - segment.start.x; var dy = segment.end.y - segment.start.y; var angle = Math.atan2(dy, dx); if (car.engineWorking) { car.velocityX = Math.cos(angle) * car.speed; car.velocityY = Math.sin(angle) * car.speed; } else { // Even with broken engine, allow some momentum along the drawn line var currentSpeed = Math.sqrt(car.velocityX * car.velocityX + car.velocityY * car.velocityY); if (currentSpeed > 0.5) { // Only if car still has some momentum car.velocityX += Math.cos(angle) * 0.5; // Small boost along the line car.velocityY += Math.sin(angle) * 0.5; } } car.rotation = angle; break; } } 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(); } } // 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(); currentLevel++; storage.currentLevel = currentLevel; if (currentLevel > maxLevel) { LK.setScore(100); LK.showYouWin(); } else { LK.setTimeout(function () { setupLevel(currentLevel); }, 1500); } } // 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 a line if (drawnLine && !gameStarted) { gameStarted = true; carCanMove = true; startButton.tint = 0x888888; if (car.engineWorking) { LK.getSound('carEngine').play(); } } 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 starting from behind the car 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 } isDrawing = false; }; game.update = function () { 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; } } } // Create smoke particles when car is moving if (car && gameStarted && carCanMove && (Math.abs(car.velocityX) > 0.5 || Math.abs(car.velocityY) > 0.5)) { smokeTimer++; if (smokeTimer % 4 === 0) { // Create smoke every 4 frames 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 for (var i = smokeParticles.length - 1; i >= 0; i--) { if (smokeParticles[i].alpha <= 0) { smokeParticles[i].destroy(); smokeParticles.splice(i, 1); } } }; // Initialize first level setupLevel(currentLevel);
===================================================================
--- original.js
+++ change.js
@@ -372,23 +372,59 @@
finishPos.y = 800;
finishFlag.y = finishPos.y + 50;
instructionText.setText('Bounce through the sequence!');
} else if (level === 10) {
- // High finish with engine failure
- finishPos.y = 500;
+ // Moving trampolines with precise timing - engine failure
+ finishPos.y = 400;
finishFlag.y = finishPos.y + 50;
- var trampoline = new Trampoline();
- trampoline.x = 1024;
- trampoline.y = 1400;
- trampolines.push(trampoline);
- game.addChild(trampoline);
+ // Create three moving trampolines
+ 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 = 1024;
- wall1.y = 800;
- wall1.scaleX = 3;
+ wall1.x = 600;
+ wall1.y = 1200;
+ wall1.scaleX = 2;
walls.push(wall1);
game.addChild(wall1);
- instructionText.setText('Reach the high platform! Engine failed!');
+ var wall2 = new Wall();
+ wall2.x = 1100;
+ wall2.y = 900;
+ wall2.scaleX = 2;
+ walls.push(wall2);
+ game.addChild(wall2);
+ var wall3 = new Wall();
+ wall3.x = 1500;
+ wall3.y = 600;
+ wall3.scaleX = 2;
+ walls.push(wall3);
+ game.addChild(wall3);
+ instructionText.setText('Time your jumps! Moving trampolines! Engine failed!');
} else if (level === 11) {
// Complex obstacle course
var wall1 = new Wall();
wall1.x = 400;
@@ -912,8 +948,19 @@
isDrawing = false;
};
game.update = function () {
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;
+ }
+ }
+ }
// Create smoke particles when car is moving
if (car && gameStarted && carCanMove && (Math.abs(car.velocityX) > 0.5 || Math.abs(car.velocityY) > 0.5)) {
smokeTimer++;
if (smokeTimer % 4 === 0) {
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