Code edit (18 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 (11 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
User prompt
increase gap between mirrored tube and mirrored tree with unmirrored versions
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 (3 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 (2 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
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
/**** * 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: // - Normal tree: 180 derece döndürülmüş, anchor (0.5,1) ile alt kenarı groundY'ye sabitlenmiş. // - Mirrored tree: flipY:true ile aynalanmış hali. 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; // Normal tree: 180 derece döndürülmüş. self.bottomTree = self.attachAsset('tree', { anchorX: 0.5, anchorY: 1, // Alt kenara hizalanıyor width: 300, height: bottomHeight, flipY: false }); self.bottomTree.rotation = Math.PI; // 180 derece döndür self.bottomTree.y = groundY; // Alt kenarı groundY'ye sabitler. // Mirrored tree: flipY:true ile aynalanmış. self.topTree = self.attachAsset('tree', { anchorX: 0.5, anchorY: 0, // Üst kenara hizalanacak şekilde width: 300, height: topHeight, flipY: true }); self.topTree.y = -groundY + 250; self.zIndex = 3; // 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: Normal alt parça, üst parça 180 derece döndürülmüş. 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; // Alt tube: Normal asset. self.bottomTube = self.attachAsset('tube', { anchorX: 0.5, anchorY: 1, width: 300, height: bottomHeight, flipY: false }); // Üst tube: 180 derece döndürülüyor. self.topTube = self.attachAsset('tube', { anchorX: 0.5, anchorY: 0.5, width: 300, height: topHeight, flipY: false }); self.topTube.rotation = Math.PI; self.topTube.y = -groundY - 250 + topHeight / 2; self.zIndex = 3; // 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 ****/ // tube asset'i varsayılan olarak flipY ile tanımlı /**** * 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 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 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
@@ -25,48 +25,48 @@
self.jump = function () {
self.velocityY = self.jumpStrength;
};
});
-// Tree: Engeli oluştururken, alt kısım normal; üst kısım ise scaleY: -1 ile ters çevrilip,
-// alt engelin üst kenarıyla arada gap bırakılacak şekilde konumlandırılır.
+// Tree:
+// - Normal tree: 180 derece döndürülmüş, anchor (0.5,1) ile alt kenarı groundY'ye sabitlenmiş.
+// - Mirrored tree: flipY:true ile aynalanmış hali.
var Tree = Container.expand(function () {
var self = Container.call(this);
- // Engelin toplam kullanılacak birim sayısı: gapUnits kadar boşluk bırakılacak
- var gapUnits = 3;
- var totalObstacleUnits = totalUnits - gapUnits;
- var bottomUnit = Math.floor(Math.random() * (totalObstacleUnits - 1)) + 1;
- var topUnit = totalObstacleUnits - bottomUnit;
+ var bottomUnit = Math.floor(Math.random() * 8) + 1;
+ var topUnit = 9 - bottomUnit;
var unitSize = groundY / totalUnits;
var bottomHeight = bottomUnit * unitSize;
var topHeight = topUnit * unitSize;
- // Alt kısım: normal, ground seviyesine hizalı
self.y = groundY;
+ // Normal tree: 180 derece döndürülmüş.
self.bottomTree = self.attachAsset('tree', {
anchorX: 0.5,
anchorY: 1,
+ // Alt kenara hizalanıyor
width: 300,
- height: bottomHeight
+ height: bottomHeight,
+ flipY: false
});
- // Üst kısım (mirrored): scaleY ile ters çevriliyor; anchorY=1 kullanılarak alt kenarı referans alınır.
+ self.bottomTree.rotation = Math.PI; // 180 derece döndür
+ self.bottomTree.y = groundY; // Alt kenarı groundY'ye sabitler.
+ // Mirrored tree: flipY:true ile aynalanmış.
self.topTree = self.attachAsset('tree', {
anchorX: 0.5,
- anchorY: 1,
+ anchorY: 0,
+ // Üst kenara hizalanacak şekilde
width: 300,
height: topHeight,
- scaleY: -1
+ flipY: true
});
- // Üst engelin alt kenarı (local y=0) globalde, alt engelin üst kenarının (-bottomHeight) üzerinden gap kadar yukarıda olacak.
- // Yani: topTree.y = -bottomHeight - gap;
- self.topTree.y = -bottomHeight - gap;
- self.zIndex = 3; // Engeller ground (zIndex:2) üzerinde, character (zIndex:4) altında
+ self.topTree.y = -groundY + 250;
+ self.zIndex = 3; // 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;
- // Eğer engel, centerX’i ilk kez geçiyorsa yeni Tube spawn et.
if (!self.spawned && self.prevX > centerX && self.x <= centerX) {
self.spawned = true;
var newTube = new Tube();
newTube.x = 2048 + 50;
@@ -76,43 +76,44 @@
self.prevX = self.x;
}
};
});
-// Tube: Benzer şekilde, alt kısım normal; üst kısım mirrored.
+// Tube: Normal alt parça, üst parça 180 derece döndürülmüş.
var Tube = Container.expand(function () {
var self = Container.call(this);
- var gapUnits = 3;
- var totalObstacleUnits = totalUnits - gapUnits;
- var bottomUnit = Math.floor(Math.random() * (totalObstacleUnits - 1)) + 1;
- var topUnit = totalObstacleUnits - bottomUnit;
+ 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;
+ // Alt tube: Normal asset.
self.bottomTube = self.attachAsset('tube', {
anchorX: 0.5,
anchorY: 1,
width: 300,
- height: bottomHeight
+ height: bottomHeight,
+ flipY: false
});
+ // Üst tube: 180 derece döndürülüyor.
self.topTube = self.attachAsset('tube', {
anchorX: 0.5,
- anchorY: 1,
+ anchorY: 0.5,
width: 300,
height: topHeight,
- scaleY: -1
+ flipY: false
});
- // Üst tube'nin alt kenarını, alt tube'nin üst kenarıyla arada gap bırakacak şekilde ayarla.
- self.topTube.y = -bottomHeight - gap;
- self.zIndex = 3;
+ self.topTube.rotation = Math.PI;
+ self.topTube.y = -groundY - 250 + topHeight / 2;
+ self.zIndex = 3; // 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 engel, centerX’i ilk kez geçiyorsa yeni Tree spawn et.
+ // 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;
@@ -133,21 +134,18 @@
/****
* Game Code
****/
+// tube asset'i varsayılan olarak flipY ile tanımlı
/****
* Global Variables
****/
-/****
-* Scene Setup
-****/
-// Sky: En arkada.
var gameStarted = false;
var centerX = 2048 / 2;
var groundY = 2732;
var totalUnits = 10;
-var gap = 200; // Aradaki boşluk (gap)
var lastSpawner = null;
+// Sky: En arka katman.
var sky = LK.getAsset('sky', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
@@ -164,9 +162,9 @@
y: groundY / 2
});
background.zIndex = 1;
game.addChild(background);
-// Ground: Engellerin arkasında kalmayacak şekilde.
+// Ground: Engellerin altında kalmayacak şekilde.
var groundAsset = LK.getAsset('ground', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
@@ -177,9 +175,9 @@
// Character: Ekranın ortasında başlar.
var character = game.addChild(new Character());
character.x = 2048 / 2;
character.y = groundY / 2;
-// Dokunma olayı: İlk dokunuşta oyun başlar ve sağdan bir Tube spawn edilir.
+// Dokunma olayı: Ekrana dokununca oyun başlar ve sağdan bir Tube spawn edilir.
game.down = function (x, y, obj) {
if (!gameStarted) {
gameStarted = true;
var initialTube = new Tube();
green theme forest by green tones to the sky , not to much detail just simple tree shadows trees has no details just shadowed green and shadowless places, beautiful view. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
hyper realistic nature too reallistic proffational blue sky white clouds yellow sun an over realistic mountain view with full of trees and sun and clouds view a forest of a mountain challangeing mountain road. No background.cool background. view background. No shadows. 2d. In-Game asset. flat