Code edit (1 edits merged)
Please save this source code
Code edit (9 edits merged)
Please save this source code
User prompt
place ground2 on ground asset
User prompt
make it 1.8 second
User prompt
make screen untouchable for 1 second after character dies
User prompt
after game reset character never dies fix it
User prompt
after game reset i cant control character fix it
User prompt
and really make game over you should replay
User prompt
character doesnt die after returned normal
User prompt
after 1 second returned to the normal make character touchable again i mean if it enters zone makes it die make it die
User prompt
finish the game over efect in 4 second and return normal
User prompt
when died make character jump and fall to the ground
User prompt
delete game over text and make screen red for just a moment
User prompt
make game over 15 time bigger
User prompt
make game over bigger and when touched screen restart game
User prompt
Please fix the bug: 'TypeError: LK.Text is not a constructor' in or related to this line: 'self.text = new LK.Text("GAME OVER", {' Line Number: 77
Code edit (1 edits merged)
Please save this source code
Code edit (13 edits merged)
Please save this source code
User prompt
tree yok oldu mirrored tree gözüküyor ama
Code edit (1 edits merged)
Please save this source code
Code edit (7 edits merged)
Please save this source code
User prompt
even more
User prompt
even more before
User prompt
turn 180 degree tree and turn mirrored tree 0 degree
User prompt
spawn tree and tube before it enters screen
/**** * Classes ****/ // Character: Dokunulduğunda zıplar. var Character = Container.expand(function () { var self = Container.call(this); self.attachAsset('character', { anchorX: 0.5, anchorY: 0.5 }); self.zIndex = 4; // En üstte 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 > groundY - 100) { self.y = groundY - 100; self.velocityY = 0; } } }; self.jump = function () { self.velocityY = self.jumpStrength; }; }); // Tree: Tube ile aynı mantık; ancak asset olarak tree kullanılıyor. var Tree = Container.expand(function () { var self = Container.call(this); var bottomUnit = Math.floor(Math.random() * 8) + 1; var topUnit = 9 - bottomUnit; var unitSize = groundY / totalUnits; var bottomHeight = bottomUnit * unitSize; var topHeight = topUnit * unitSize; self.y = groundY; self.bottomTree = self.attachAsset('tree', { anchorX: 0.5, anchorY: 1, width: 300, height: bottomHeight, flipY: 0 }); self.topTree = self.attachAsset('tree', { anchorX: 0.5, anchorY: 0, width: 300, height: topHeight, flipY: 1 }); // Mirrored kısmın y konumunu değiştirerek gap’i artırıyoruz. self.topTree.y = -groundY - 250; self.zIndex = 3; // Obstacles; ground (zIndex:2) üzerinde, character (zIndex:4) altında self.x = 2048 + 800; self.velocityX = -3.6; self.spawned = false; self.prevX = self.x; self.update = function () { if (gameStarted) { self.x += self.velocityX; if (!self.spawned && self.prevX > centerX && self.x <= centerX) { self.spawned = true; var newTube = new Tube(); newTube.x = 2048 + 50; game.addChild(newTube); lastSpawner = newTube; } self.prevX = self.x; } }; }); // Tube: Obstacle container – alt parça (tube) yere değiyor, üst parça (tube, flipY) tavana değiyor. var Tube = Container.expand(function () { var self = Container.call(this); var bottomUnit = Math.floor(Math.random() * 8) + 1; var topUnit = 9 - bottomUnit; var unitSize = groundY / totalUnits; var bottomHeight = bottomUnit * unitSize; var topHeight = topUnit * unitSize; self.y = groundY; self.bottomTube = self.attachAsset('tube', { anchorX: 0.5, anchorY: 1, width: 300, height: bottomHeight, flipY: 0 }); self.topTube = self.attachAsset('tube', { anchorX: 0.5, anchorY: 0, width: 300, height: topHeight, flipY: 1 }); // Mirrored kısmın y konumunu değiştirerek gap’i artırıyoruz. self.topTube.y = -groundY - 250; self.zIndex = 3; // Obstacles; ground altında, character üstünde self.x = 2048 + 800; self.velocityX = -3.6; self.spawned = false; self.prevX = self.x; self.update = function () { if (gameStarted) { self.x += self.velocityX; // Eğer obstacle, centerX’i ilk kez geçiyorsa spawn et. if (!self.spawned && self.prevX > centerX && self.x <= centerX) { self.spawned = true; var newTree = new Tree(); newTree.x = 2048 + 50; game.addChild(newTree); lastSpawner = newTree; } self.prevX = self.x; } }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ /**** * Global Variables ****/ var gameStarted = false; var centerX = 2048 / 2; var groundY = 2732; var totalUnits = 10; var lastSpawner = null; // Sky: En arka katman. var sky = LK.getAsset('sky', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: groundY / 2, tint: 0x000000 }); sky.zIndex = 0; game.addChild(sky); // Background: Sky'ın üzerinde. var background = LK.getAsset('background', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: groundY / 2 }); background.zIndex = 1; game.addChild(background); // Ground: Engellerin (tube/tree) altında kalmayacak şekilde. var groundAsset = LK.getAsset('ground', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: groundY - 5 }); groundAsset.zIndex = 2; game.addChild(groundAsset); // Character: Ekranın ortasında başlar. var character = game.addChild(new Character()); character.x = 2048 / 2; character.y = groundY / 2; // Dokunma olayı: Ekrana dokununca oyun başlar ve sadece sağdan bir Tube spawn edilir. game.down = function (x, y, obj) { if (!gameStarted) { gameStarted = true; var initialTube = new Tube(); game.addChild(initialTube); lastSpawner = initialTube; } character.jump(); character.rotation = 0.1; LK.setTimeout(function () { character.rotation = 0; }, 200); }; // Oyun döngüsü. 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
@@ -7,9 +7,9 @@
self.attachAsset('character', {
anchorX: 0.5,
anchorY: 0.5
});
- self.zIndex = 100;
+ self.zIndex = 4; // En üstte
self.velocityY = 0;
self.gravity = 0.3;
self.jumpStrength = -12;
self.update = function () {
@@ -48,11 +48,11 @@
width: 300,
height: topHeight,
flipY: 1
});
- // Gap artırıldı: mirrored tree daha yukarıda konumlanıyor.
- self.topTree.y = -groundY - 150;
- self.zIndex = 10;
+ // Mirrored kısmın y konumunu değiştirerek gap’i artırıyoruz.
+ self.topTree.y = -groundY - 250;
+ self.zIndex = 3; // Obstacles; ground (zIndex:2) üzerinde, character (zIndex:4) altında
self.x = 2048 + 800;
self.velocityX = -3.6;
self.spawned = false;
self.prevX = self.x;
@@ -92,11 +92,11 @@
width: 300,
height: topHeight,
flipY: 1
});
- // Gap artırıldı: mirrored tube daha yukarıda konumlanıyor.
- self.topTube.y = -groundY - 150;
- self.zIndex = 10;
+ // Mirrored kısmın y konumunu değiştirerek gap’i artırıyoruz.
+ self.topTube.y = -groundY - 250;
+ self.zIndex = 3; // Obstacles; ground altında, character üstünde
self.x = 2048 + 800;
self.velocityX = -3.6;
self.spawned = false;
self.prevX = self.x;
@@ -152,16 +152,16 @@
y: groundY / 2
});
background.zIndex = 1;
game.addChild(background);
-// Ground: Obstacle’ların altında kalmaması için.
+// Ground: Engellerin (tube/tree) altında kalmayacak şekilde.
var groundAsset = LK.getAsset('ground', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
y: groundY - 5
});
-groundAsset.zIndex = 5;
+groundAsset.zIndex = 2;
game.addChild(groundAsset);
// Character: Ekranın ortasında başlar.
var character = game.addChild(new Character());
character.x = 2048 / 2;