Code edit (1 edits merged)
Please save this source code
User prompt
i want you to spawn tree when tube comes little bit right of the middle of the screen
Code edit (1 edits merged)
Please save this source code
User prompt
spawn tube faster not velocity i want tube spawn earlier
Code edit (12 edits merged)
Please save this source code
User prompt
vaz geçtim ekranın ortasının biraz sağına gelince tree spawn olsun
User prompt
tree tube ekranın tam ortasına geldiğinde değilde biraz soluna geldiğinde spawn olsun azıcık ekranın ortasının soluna gelince
Code edit (1 edits merged)
Please save this source code
User prompt
make them 1.2 time faster
User prompt
make them 1.5 time faster
Code edit (1 edits merged)
Please save this source code
Code edit (5 edits merged)
Please save this source code
User prompt
tube ve tree nin velocitysini eşit düzeyde arttır
Code edit (1 edits merged)
Please save this source code
User prompt
spawn 1 tree after 1 second tube spawned
User prompt
create only 1 tree
User prompt
the gap between two trees are 2.1 second
User prompt
and make another tree spawn 2 second later
User prompt
spawn tree 1 second after tube spawned
User prompt
make tree 10 time faster and keep the velocity of tube same
User prompt
always keep the velocity of tube same and increase the velocity of tree 5 time faster
User prompt
make şt 5 time faster
User prompt
increase the velocity of tree
User prompt
create tree asset when tube reaches middle of the screen
User prompt
make tree touch to bottom of the screen all the time when spawning,make velocity of tree same as tube
/**** * Classes ****/ // Ekranın ortası // Character: Dokunulduğunda zıplar, yerçekimi devreye girer. var Character = Container.expand(function () { var self = Container.call(this); var characterGraphics = self.attachAsset('character', { anchorX: 0.5, anchorY: 0.5 }); self.zIndex = 99; self.velocityY = 0; self.gravity = 0.3; self.jumpStrength = -12; self.update = function () { if (gameStarted) { self.velocityY += self.gravity; self.y += self.velocityY; if (self.y > 2732 - 100) { // Zemine çarpmayı engelle self.y = 2732 - 100; self.velocityY = 0; } } }; self.jump = function () { self.velocityY = self.jumpStrength; }; }); // Tree: Sadece hareket eder; tube spawn etme işlevi kaldırıldı. var Tree = Container.expand(function () { var self = Container.call(this); var treeGraphics = self.attachAsset('tree', { anchorX: 0.5, anchorY: 0.5, width: 300, height: Math.floor(Math.random() * (4200 - 400 + 1)) + 400 }); self.zIndex = 5; self.velocityX = -3.6; // Artık spawn için kullanılacak flag ve prevX tanımı opsiyonel, sadece reset için bırakıldı. self.prevX = self.x || 2048 + 50; self.update = function () { if (gameStarted) { self.x += self.velocityX; self.prevX = self.x; if (self.x < -300) { self.x = 2048 + 100; treeGraphics.height = Math.floor(Math.random() * (3900 - 600 + 1)) + 600; } } }; }); // Tube: Sağdan spawn olur; ekranın ortasına geçerken zincirin lideriyse bir Tree spawn eder. var Tube = Container.expand(function () { var self = Container.call(this); var tubeGraphics = self.attachAsset('tube', { anchorX: 0.5, anchorY: 0.5, width: 300, height: Math.floor(Math.random() * (4200 - 400 + 1)) + 400 }); self.zIndex = 5; self.velocityX = -3.6; self.spawned = false; // Bu nesne spawn yapıp yapmadığını kontrol eder. self.prevX = self.x || 2048 + 50; // Önceki x konumunu tutar. self.update = function () { if (gameStarted) { self.x += self.velocityX; // Zincirin lideri ve henüz spawn yapmamışsa; geçiş anı (önce center'ın sağında, sonra solunda) tespit ediliyor. if (self === lastSpawner && !self.spawned && self.prevX > centerX && self.x <= centerX) { self.spawned = true; var newTree = new Tree(); newTree.x = 2048 + 50; // Sağdan spawn newTree.y = 2732 - 150; game.addChild(newTree); lastSpawner = newTree; // Zincirin yeni lideri } self.prevX = self.x; // Ekranın solundan çıktığında resetle. if (self.x < -300) { self.x = 2048 + 100; tubeGraphics.height = Math.floor(Math.random() * (3900 - 600 + 1)) + 600; } } }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ /**** * Global Değişkenler ****/ /**** * Game Kodları ****/ // Sky: En arka katman var lastSpawner = null; // Zincirin spawn yapacak son nesnesi var gameStarted = false; var centerX = 2048 / 2; var sky = LK.getAsset('sky', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2, tint: 0x000000 }); sky.zIndex = 0; game.addChild(sky); // Background: Sky'ın hemen üzerinde var background = LK.getAsset('background', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2 }); background.zIndex = 1; game.addChild(background); // Ground: Tube ve Tree'den daha yüksek z-index var ground = LK.getAsset('ground', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 - 5 }); ground.zIndex = 7; game.addChild(ground); // Character: Ekranın tam ortasında başlar var character = game.addChild(new Character()); character.x = 2048 / 2; character.y = 2732 / 2; // Dokunma olayı: Ekrana tıklayınca tube spawn edilir ve oyun başlar. game.down = function (x, y, obj) { if (!gameStarted) { gameStarted = true; var initialTube = new Tube(); initialTube.x = 2048 + 50; initialTube.y = 2732 - 150; game.addChild(initialTube); lastSpawner = initialTube; // Zincirin ilk elemanı } character.jump(); character.rotation = 0.1; LK.setTimeout(function () { character.rotation = 0; }, 200); }; // Oyun döngüsü: Her frame update fonksiyonlarını çağırır ve z-index sıralaması yapar. game.update = function () { game.children.forEach(function (child) { if (child.update) { child.update(); } }); game.children.sort(function (a, b) { return (a.zIndex || 0) - (b.zIndex || 0); }); };
===================================================================
--- original.js
+++ change.js
@@ -67,16 +67,16 @@
self.prevX = self.x || 2048 + 50; // Önceki x konumunu tutar.
self.update = function () {
if (gameStarted) {
self.x += self.velocityX;
- // If this tube is the last one to spawn and it hasn't spawned yet, detect the transition moment (first on the right of the center, then on the left).
- if (self === lastSpawner && !self.spawned && self.prevX > centerX + 200 && self.x <= centerX + 200) {
+ // Zincirin lideri ve henüz spawn yapmamışsa; geçiş anı (önce center'ın sağında, sonra solunda) tespit ediliyor.
+ if (self === lastSpawner && !self.spawned && self.prevX > centerX && self.x <= centerX) {
self.spawned = true;
var newTree = new Tree();
- newTree.x = 2048 + 50; // Spawn from the right
+ newTree.x = 2048 + 50; // Sağdan spawn
newTree.y = 2732 - 150;
game.addChild(newTree);
- lastSpawner = newTree; // New leader of the chain
+ lastSpawner = newTree; // Zincirin yeni lideri
}
self.prevX = self.x;
// Ekranın solundan çıktığında resetle.
if (self.x < -300) {