User prompt
Seviyelerde ki Bütün duvarlar hareket halinde olsunlar. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Level 12'ye birkaç tane duvar ekle. Ayrıca hareket etsinler. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Bütün duvarların etki alanını, duvar resim alanı ile eşitle.
User prompt
Duvara değince araç patlamasın. Sadece duvara değince duvar içerisinden geçmesin.
User prompt
Power'in de rengi değişmesin.
User prompt
Bunu düzelt. Renk değişmesin hiçbir şekilde.
User prompt
Speed 5 ve üzeri olunca Speed yazısı görünmez oluyor.
User prompt
Her seviyede 100 puan alalım. Bu puanları, güç ve hız geliştirme yapabilmek için kullanalım. Her geliştirme %5 artış sağlasın. ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Speed hızlanınca kaybolmasın.
User prompt
Ekranın alt orda kısmına, aracın güç göstergesi gelsin. Hızı ve gücü görünsün. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Brake basınca araç geri gitmiyor.
User prompt
3 saniyelik dokunulmazlık konusunu, yolda gitmeyi muaf et. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Başlangıçta araba 3 saniye dokunulmaz olsun ve patlamasın. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Level 20'de başlangıç yerinin sağında ki duvarı kaldır.
User prompt
Level 20'i yeniden yapılandır. Ayrıca son 5 seviyede, duvarlar yavaş yavaş hareket etsinler. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Araç tramboline değince patlamasın.
User prompt
Araç, duvara değmeden patlıyor. Yakınına gelince değil. Tamamen duvara değdiği zaman parlasın.
User prompt
Araç dik olunca patlamasın. Yolu takip etmeye devam etsin.
User prompt
Çizginin içinden araba geçmesin. Daima çizgiyi takip etsin.
User prompt
Brake butonuna basınca geriye doğru hızlanma oranını %200 oranında azalt. Aynı işlev pedal konusunda da geçerli olsun.
User prompt
Brake butonuna basınca hızlanma oranını %200 azalt.
User prompt
Brake butonuna basınca, hızlanma oranını %200 azalt.
User prompt
Brake butonuna basılı tutunca, ilk yavaş şekilde, hızlanarak geri gitmesini sağla.
User prompt
Brake butonuna basınca, geriye yönlü teklemesin. Aynı ileri gidiyor gibi, geri gitsin.
User prompt
Brake butonunu ve pedal butonunu %100 oranında büyüt.
/****
* 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;
// Only apply gravity, no automatic movement
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 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 = 3; // Maximum lines per level
var currentLineCount = 0; // Current number of lines drawn
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: 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);
// 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: 3/3', {
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: ' + (maxLines - currentLineCount) + '/' + maxLines);
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 = [];
// Clear all drawn lines
for (var i = 0; i < drawnLines.length; i++) {
drawnLines[i].destroy();
}
drawnLines = [];
walls = [];
trampolines = [];
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
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 horizontal movement
tween(wall, {
x: 1300
}, {
duration: 3000,
easing: tween.linear,
onFinish: function onFinish() {
tween(wall, {
x: 1024
}, {
duration: 3000,
easing: tween.linear,
onFinish: function onFinish() {
// Loop the movement
tween(wall, {
x: 1300
}, {
duration: 3000,
easing: tween.linear,
onFinish: function onFinish() {
tween(wall, {
x: 1024
}, {
duration: 3000,
easing: tween.linear
});
}
});
}
});
}
});
instructionText.setText('Draw around the moving 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);
// 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
});
}
});
}
});
}
});
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);
finishPos.y = 600;
finishFlag.y = finishPos.y + 50;
instructionText.setText('Bounce through the obstacle course!');
} 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.5;
walls.push(wall1);
game.addChild(wall1);
var wall2 = new Wall();
wall2.x = 700;
wall2.y = 1000;
wall2.scaleX = 1.2;
walls.push(wall2);
game.addChild(wall2);
var wall3 = new Wall();
wall3.x = 1000;
wall3.y = 800;
wall3.scaleX = 1.8;
walls.push(wall3);
game.addChild(wall3);
var wall4 = new Wall();
wall4.x = 1300;
wall4.y = 600;
wall4.scaleX = 1.5;
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
});
}
});
}
});
}
});
// 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);
finishPos.y = 400;
finishFlag.y = finishPos.y + 50;
instructionText.setText('Master the multi-stage climb! Precision required!');
} 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);
// 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
});
}
});
}
});
}
});
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
});
}
});
}
});
}
});
finishPos.y = 1200;
finishFlag.y = finishPos.y + 50;
instructionText.setText('Engine down! Tap car to push! Navigate moving obstacles!');
} 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);
// 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 = 800;
wall2.y = 800;
wall2.scaleX = 1.5;
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 = 1200;
wall3.y = 1200;
wall3.scaleX = 1.5;
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 = 1500;
wall4.y = 900;
wall4.scaleX = 1.5;
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
});
}
});
}
});
}
});
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);
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);
// 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
});
}
});
}
});
}
});
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 = 400;
wall1.y = 1000;
wall1.scaleY = 3;
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 = 800;
wall2.y = 800;
wall2.scaleX = 2;
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 = 1200;
wall3.y = 1200;
wall3.scaleY = 2;
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
});
}
});
}
});
}
});
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 and moving walls
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);
// 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
});
}
});
}
});
}
});
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 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);
finishPos.y = 600;
finishFlag.y = finishPos.y + 50;
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 = 500;
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 = 700;
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 = 900;
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 = 1100;
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
});
}
});
}
});
}
});
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);
// 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
});
}
});
}
});
}
});
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);
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! 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);
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! 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);
// 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
});
}
});
}
});
}
});
finishPos.y = 600;
finishFlag.y = finishPos.y + 50;
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 = 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);
// 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
});
}
});
}
});
}
});
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! 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);
// 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
});
}
});
}
});
}
});
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! Avoid moving obstacles!');
} 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);
// 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
});
}
});
}
});
}
});
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! Tap car to push!');
} else if (level === 20) {
// Final boss level - completely restructured with moving elements
var wall1 = new Wall();
wall1.x = 400;
wall1.y = 1100;
wall1.scaleX = 1.5;
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 = 700;
wall2.y = 900;
wall2.scaleY = 2;
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 = 1000;
wall3.y = 1300;
wall3.rotation = Math.PI / 4;
wall3.scaleX = 2;
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 = 1300;
wall4.y = 800;
wall4.rotation = -Math.PI / 3;
wall4.scaleX = 1.8;
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);
finishPos.y = 400;
finishFlag.y = finishPos.y + 50;
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('PEDAL', {
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 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
if (Math.abs(angle) > maxRotation && Math.abs(angle) < Math.PI - maxRotation) {
car.rotation = angle > 0 ? maxRotation : -maxRotation;
} else if (Math.abs(angle) > Math.PI + maxRotation && Math.abs(angle) < 2 * Math.PI - maxRotation) {
car.rotation = angle > Math.PI ? Math.PI + maxRotation : Math.PI - maxRotation;
} else {
car.rotation = angle;
}
}
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 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
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
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 and haven't reached line limit
if (x < car.x - 50 && !gameStarted && currentLineCount < maxLines) {
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: ' + (maxLines - currentLineCount) + '/' + maxLines);
}
}
// Reset brake and pedal button states when mouse/touch is released
brakeButtonPressed = false;
brakeAcceleration = 0;
pedalButtonPressed = false;
pedalAcceleration = 0;
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 braking force to slow down the car
var brakingFactor = 1 - enhancedBraking * 0.1; // Convert acceleration to braking factor
if (brakingFactor < 0.1) brakingFactor = 0.1; // Minimum factor to prevent complete stop
car.velocityX *= brakingFactor;
car.velocityY *= brakingFactor;
}
// 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;
}
}
}
// 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);
}
}
// 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
@@ -400,38 +400,202 @@
wall.x = 1024;
wall.y = 1000;
walls.push(wall);
game.addChild(wall);
- instructionText.setText('Draw around the wall!');
+ // Add horizontal movement
+ tween(wall, {
+ x: 1300
+ }, {
+ duration: 3000,
+ easing: tween.linear,
+ onFinish: function onFinish() {
+ tween(wall, {
+ x: 1024
+ }, {
+ duration: 3000,
+ easing: tween.linear,
+ onFinish: function onFinish() {
+ // Loop the movement
+ tween(wall, {
+ x: 1300
+ }, {
+ duration: 3000,
+ easing: tween.linear,
+ onFinish: function onFinish() {
+ tween(wall, {
+ x: 1024
+ }, {
+ duration: 3000,
+ easing: tween.linear
+ });
+ }
+ });
+ }
+ });
+ }
+ });
+ instructionText.setText('Draw around the moving 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);
+ // 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);
- instructionText.setText('Navigate the L-shape!');
+ // 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
+ });
+ }
+ });
+ }
+ });
+ }
+ });
+ 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);
@@ -482,20 +646,120 @@
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
+ });
+ }
+ });
+ }
+ });
+ }
+ });
// Strategic trampoline placement for multi-bounce sequences
var trampoline1 = new Trampoline();
trampoline1.x = 600;
trampoline1.y = 1350;
@@ -526,8 +790,40 @@
wall1.y = 1000;
wall1.scaleY = 2;
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
+ });
+ }
+ });
+ }
+ });
+ }
+ });
var trampoline1 = new Trampoline();
trampoline1.x = 600;
trampoline1.y = 1300;
trampolines.push(trampoline1);
@@ -545,17 +841,81 @@
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
+ });
+ }
+ });
+ }
+ });
+ }
+ });
finishPos.y = 1200;
finishFlag.y = finishPos.y + 50;
- instructionText.setText('Engine down! Tap car to push! Navigate carefully!');
+ instructionText.setText('Engine down! Tap car to push! Navigate moving obstacles!');
} else if (level === 8) {
// Maze-like structure
var wall1 = new Wall();
wall1.x = 500;
@@ -563,28 +923,160 @@
wall1.scaleX = 1.5;
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 = 800;
wall2.y = 800;
wall2.scaleX = 1.5;
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 = 1200;
wall3.y = 1200;
wall3.scaleX = 1.5;
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 = 1500;
wall4.y = 900;
wall4.scaleX = 1.5;
walls.push(wall4);
game.addChild(wall4);
- instructionText.setText('Find your way through the maze!');
+ // 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
+ });
+ }
+ });
+ }
+ });
+ }
+ });
+ instructionText.setText('Navigate the moving maze!');
} else if (level === 9) {
// Trampoline sequence
var trampoline1 = new Trampoline();
trampoline1.x = 400;
@@ -647,20 +1139,120 @@
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
+ });
+ }
+ });
+ }
+ });
+ }
+ });
instructionText.setText('Time your jumps! Moving trampolines! Engine failed! Tap car to push!');
} else if (level === 11) {
// Complex obstacle course
var wall1 = new Wall();
@@ -668,20 +1260,115 @@
wall1.y = 1000;
wall1.scaleY = 3;
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 = 800;
wall2.y = 800;
wall2.scaleX = 2;
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 = 1200;
wall3.y = 1200;
wall3.scaleY = 2;
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
+ });
+ }
+ });
+ }
+ });
+ }
+ });
var trampoline = new Trampoline();
trampoline.x = 600;
trampoline.y = 1300;
trampolines.push(trampoline);
@@ -875,20 +1562,120 @@
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 two trampolines for reasonable jumping
var trampoline1 = new Trampoline();
trampoline1.x = 450;
trampoline1.y = 1250;
@@ -905,31 +1692,163 @@
trampolines.push(trampoline3);
game.addChild(trampoline3);
finishPos.y = 600;
finishFlag.y = finishPos.y + 50;
- instructionText.setText('Jump up the platforms! Engine failed! Tap car to push!');
+ 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 = 500;
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 = 700;
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 = 900;
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 = 1100;
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
+ });
+ }
+ });
+ }
+ });
+ }
+ });
var trampoline1 = new Trampoline();
trampoline1.x = 600;
trampoline1.y = 1300;
trampolines.push(trampoline1);
@@ -955,30 +1874,182 @@
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);
- instructionText.setText('Zigzag to victory! Engine failed! Tap car to push!');
+ // 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
+ });
+ }
+ });
+ }
+ });
+ }
+ });
+ 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;
@@ -1449,28 +2520,176 @@
wall1.y = 1100;
wall1.scaleX = 1.5;
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 = 700;
wall2.y = 900;
wall2.scaleY = 2;
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 = 1000;
wall3.y = 1300;
wall3.rotation = Math.PI / 4;
wall3.scaleX = 2;
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 = 1300;
wall4.y = 800;
wall4.rotation = -Math.PI / 3;
wall4.scaleX = 1.8;
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;
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