User prompt
oyunun en kenarlarına süs olsun diye agaçlar koy araba giderken kaybolmasınlar
User prompt
distance 1000 olduğunda oyunu zorlaştır
User prompt
oyunu biraz kolaylaştır çok zor oldu normal seviye olsun
User prompt
road yolunda gidince ölmeyelim cliffe dokununca ölelim
User prompt
oyuna dil seçme bölümü ekle ingilice ve türkçe dokunduğumuzu seç ayrıca dil seçme bölümünden sonra şu yazıyı ekle kahverengi yolda gidin sakın beyazlara deymeyin yazısını dil seçme bölümünden sonra ekle
User prompt
son yazdığım komutu iptal et
User prompt
oyuna bir açıklama yazısı ekle yazı şu olsun kapalı kahverengi yolunda gidin açık kahverengiye sakın dokunmayın oyunda tüneller var aracı göremeyebilirsiniz bol şans yazısını oyuna başlamadan ekle oyuna
User prompt
clifflere deyince ölmeyelim cliffinin yanlarındakilere dokununca ölelim
User prompt
oynu dahada zorlaştır
User prompt
oyun böyle düz bir yol olmasın sağa ve sola dönüşler olsun dokunduğumuz yöne drift atarak gitsin ↪💡 Consider importing and using the following plugins: @upit/tween.v1
Code edit (1 edits merged)
Please save this source code
User prompt
Drift Canyon
Initial prompt
bir araba drift oyunu olsun yolda giderken sola dönüş olsun dönmezsek arabamız uçurumdan düşsün dönerken dönmek istediğimiz yere dokunalım drift atarak dönsün tabi sadece sol değil arada sağada döneli
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var Car = Container.expand(function () {
var self = Container.call(this);
var carGraphics = self.attachAsset('car', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 8;
self.driftSpeed = 0;
self.maxDriftSpeed = 10;
self.driftDecay = 0.9;
self.isDrifting = false;
self.angle = 0;
self.startDrift = function (direction) {
self.isDrifting = true;
self.driftSpeed = direction * self.maxDriftSpeed;
LK.getSound('drift').play();
};
self.update = function () {
// Apply drift movement
self.x += self.driftSpeed;
// Decay drift speed
self.driftSpeed *= self.driftDecay;
// Update visual angle based on drift
self.angle = self.driftSpeed * 0.1;
carGraphics.rotation = self.angle;
// Stop drifting when speed is low
if (Math.abs(self.driftSpeed) < 0.5) {
self.isDrifting = false;
self.driftSpeed = 0;
}
};
return self;
});
var RoadSegment = Container.expand(function () {
var self = Container.call(this);
// Road center piece
var roadGraphics = self.attachAsset('road', {
anchorX: 0.5,
anchorY: 0.5
});
// Left cliff
var leftCliff = self.attachAsset('cliff', {
anchorX: 1,
anchorY: 0.5
});
leftCliff.x = -200;
// Right cliff
var rightCliff = self.attachAsset('cliff', {
anchorX: 0,
anchorY: 0.5
});
rightCliff.x = 200;
self.turnDirection = 0; // -1 for left, 1 for right, 0 for straight
self.speed = 8;
self.setTurn = function (direction) {
self.turnDirection = direction;
if (direction !== 0) {
roadGraphics.tint = direction < 0 ? 0x4444ff : 0xff4444;
}
};
self.update = function () {
self.y += self.speed;
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB
});
/****
* Game Code
****/
var gameStarted = false;
var languageSelected = false;
var selectedLanguage = null;
var showingInstructions = false;
var car;
var roadSegments = [];
var gameSpeed = 12;
var maxGameSpeed = 25;
var distanceTraveled = 0;
var lastSegmentY = 0;
var segmentSpacing = 120;
var curveIntensity = 120;
var nextTurnType = 0;
var turnSequence = [1, -1, 1, 1, -1, -1, 1, 0, -1, 1, -1, 1, 1, -1, -1, 1, 0, -1, 1, -1, 1, 1, -1, 0, 1, -1, -1, 1, 1, -1];
var turnIndex = 0;
// Create score display
var scoreTxt = new Text2('Distance: 0', {
size: 80,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Language selection UI
var languageTitle = new Text2('Select Language / Dil Seçin', {
size: 120,
fill: 0xFFFFFF
});
languageTitle.anchor.set(0.5, 0.5);
languageTitle.x = 1024;
languageTitle.y = 800;
game.addChild(languageTitle);
var englishButton = new Text2('English', {
size: 100,
fill: 0x00ff00
});
englishButton.anchor.set(0.5, 0.5);
englishButton.x = 1024;
englishButton.y = 1200;
game.addChild(englishButton);
var turkishButton = new Text2('Türkçe', {
size: 100,
fill: 0x00ff00
});
turkishButton.anchor.set(0.5, 0.5);
turkishButton.x = 1024;
turkishButton.y = 1400;
game.addChild(turkishButton);
var instructionText = new Text2('', {
size: 80,
fill: 0xFFFFFF
});
instructionText.anchor.set(0.5, 0.5);
instructionText.x = 1024;
instructionText.y = 1366;
// Initialize car
car = game.addChild(new Car());
car.x = 1024; // Center horizontally
car.y = 2200; // Near bottom of screen
// Create initial road segments with curved positioning
function createRoadSegment(y, turnDirection, xOffset) {
var segment = new RoadSegment();
segment.x = 1024 + (xOffset || 0); // Center horizontally with offset for curves
segment.y = y;
segment.setTurn(turnDirection);
segment.xOffset = xOffset || 0;
return segment;
}
// Initialize road with curved positioning
var currentXOffset = 0;
for (var i = 0; i < 20; i++) {
var turnDir = turnSequence[turnIndex % turnSequence.length];
// Calculate curve based on turn direction
if (turnDir !== 0) {
currentXOffset += turnDir * curveIntensity; // Create aggressive curve
}
var segment = createRoadSegment(lastSegmentY - i * segmentSpacing, turnDir, currentXOffset);
roadSegments.push(segment);
game.addChild(segment);
turnIndex++;
}
// Input handling
game.down = function (x, y, obj) {
if (!languageSelected) {
// Check if English button was tapped
if (x > 524 && x < 1524 && y > 1150 && y < 1250) {
selectedLanguage = 'en';
languageSelected = true;
showingInstructions = true;
// Hide language selection UI
languageTitle.visible = false;
englishButton.visible = false;
turkishButton.visible = false;
// Show English instructions
instructionText.setText('Stay on the brown road\nDo not touch the white cliffs!');
game.addChild(instructionText);
}
// Check if Turkish button was tapped
else if (x > 524 && x < 1524 && y > 1350 && y < 1450) {
selectedLanguage = 'tr';
languageSelected = true;
showingInstructions = true;
// Hide language selection UI
languageTitle.visible = false;
englishButton.visible = false;
turkishButton.visible = false;
// Show Turkish instructions
instructionText.setText('Kahverengi yolda gidin\nSakın beyazlara değmeyin!');
game.addChild(instructionText);
}
} else if (showingInstructions) {
// Any tap while showing instructions starts the game
showingInstructions = false;
gameStarted = true;
instructionText.visible = false;
} else if (gameStarted) {
if (x < 1024) {
// Left side tap - drift left
car.startDrift(-1);
} else {
// Right side tap - drift right
car.startDrift(1);
}
}
};
// Main game loop
game.update = function () {
if (!gameStarted) {
return;
}
// Update distance and score
distanceTraveled += gameSpeed * 0.1;
scoreTxt.setText('Distance: ' + Math.floor(distanceTraveled));
LK.setScore(Math.floor(distanceTraveled));
// Gradually increase speed more aggressively
if (LK.ticks % 180 === 0 && gameSpeed < maxGameSpeed) {
gameSpeed += 0.5;
for (var i = 0; i < roadSegments.length; i++) {
roadSegments[i].speed = gameSpeed;
}
}
// Move road segments and create new ones
for (var i = roadSegments.length - 1; i >= 0; i--) {
var segment = roadSegments[i];
// Remove segments that are off screen
if (segment.y > 2800) {
segment.destroy();
roadSegments.splice(i, 1);
continue;
}
// Check collision with cliff edges only (not road edges)
if (Math.abs(segment.y - car.y) < 50) {
// Check collision with left cliff (car width is 120, so check car edges)
var leftCliffRight = segment.x - 200; // Left cliff right edge
var carLeftEdge = car.x - 60; // Car's left edge
// Check collision with right cliff
var rightCliffLeft = segment.x + 200; // Right cliff left edge
var carRightEdge = car.x + 60; // Car's right edge
// Only die if car edges actually touch cliff edges
if (carRightEdge < leftCliffRight || carLeftEdge > rightCliffLeft) {
// Car hit the cliff
LK.getSound('crash').play();
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
return;
}
}
}
// Add new road segments at the top with curved positioning
var topSegment = roadSegments[0];
if (topSegment && topSegment.y > -segmentSpacing) {
var newY = topSegment.y - segmentSpacing;
var turnDir = turnSequence[turnIndex % turnSequence.length];
var newXOffset = topSegment.xOffset || 0;
if (turnDir !== 0) {
newXOffset += turnDir * curveIntensity; // Continue the aggressive curve
}
var newSegment = createRoadSegment(newY, turnDir, newXOffset);
roadSegments.unshift(newSegment);
game.addChild(newSegment);
turnIndex++;
}
// Find current road segment for visual feedback (no automatic turning)
var currentSegment = null;
for (var i = 0; i < roadSegments.length; i++) {
if (Math.abs(roadSegments[i].y - car.y) < 75) {
currentSegment = roadSegments[i];
break;
}
}
// Player must manually drift to follow the curved road
// No automatic turning - relies purely on player skill
// Allow car to move freely but keep within screen bounds
if (car.x < 100) car.x = 100;
if (car.x > 1948) car.x = 1948;
}; ===================================================================
--- original.js
+++ change.js
@@ -232,13 +232,16 @@
continue;
}
// Check collision with cliff edges only (not road edges)
if (Math.abs(segment.y - car.y) < 50) {
- // Check collision with left cliff
+ // Check collision with left cliff (car width is 120, so check car edges)
var leftCliffRight = segment.x - 200; // Left cliff right edge
- // Check collision with right cliff
- var rightCliffLeft = segment.x + 200; // Right cliff left edge
- if (car.x < leftCliffRight || car.x > rightCliffLeft) {
+ var carLeftEdge = car.x - 60; // Car's left edge
+ // Check collision with right cliff
+ var rightCliffLeft = segment.x + 200; // Right cliff left edge
+ var carRightEdge = car.x + 60; // Car's right edge
+ // Only die if car edges actually touch cliff edges
+ if (carRightEdge < leftCliffRight || carLeftEdge > rightCliffLeft) {
// Car hit the cliff
LK.getSound('crash').play();
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();