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 (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
/****
* 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 önde
self.velocityY = 0;
self.gravity = 0.3;
self.jumpStrength = -12;
self.width = 350; // Karakter genişliği
self.height = 300; // Karakter yüksekliği
self.update = function () {
if (gameStarted && !gameOver) {
self.velocityY += self.gravity;
self.y += self.velocityY;
if (self.y > groundY - 100) {
self.y = groundY - 100;
self.velocityY = 0;
}
// Karakterin yarısı ekran dışına çıkarsa ölüm kontrolü
var characterLeft = self.x - self.width / 2;
var characterRight = self.x + self.width / 2;
var characterTop = self.y - self.height / 2;
var characterBottom = self.y + self.height / 2;
// Ekran sınırları
var screenLeft = 0;
var screenRight = 2048;
var screenTop = 0;
var screenBottom = groundY;
// Karakterin yarısı ekranın solundan çıkarsa
if (characterLeft + self.width / 2 < screenLeft) {
gameOver = true;
endGame();
}
// Karakterin yarısı ekranın sağından çıkarsa
else if (characterRight - self.width / 2 > screenRight) {
gameOver = true;
endGame();
}
// Karakterin yarısı ekranın üstünden çıkarsa
else if (characterTop + self.height / 2 < screenTop) {
gameOver = true;
endGame();
}
// Karakterin yarısı ekranın altından çıkarsa
else if (characterBottom - self.height / 2 > screenBottom) {
gameOver = true;
endGame();
}
}
};
self.jump = function () {
if (!gameOver) {
self.velocityY = self.jumpStrength;
}
};
});
// GameOver Text
var GameOverText = Container.expand(function () {
var self = Container.call(this);
// Metin oluşturma
self.text = new Text2("GAME OVER", {
fontFamily: "Arial",
fontSize: 2250,
fill: 0xFF0000,
align: "center",
fontWeight: "bold"
});
// Metni ortala
self.text.anchorX = 0.5;
self.text.anchorY = 0.5;
self.addChild(self.text);
self.zIndex = 10; // En üstte göster
return self;
});
// Tree: Tube mantığıyla oluşturuldu, alt tree normal,
// üst tree ise 180 derece döndürülerek aynalama efekti veriliyor.
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;
// Alt Tree: normal asset
self.bottomTree = self.attachAsset('tree', {
anchorX: 0.5,
anchorY: 1,
width: 300,
height: bottomHeight,
flipY: false
});
// Üst Tree: 180 derece döndürülerek aynalama efekti veriliyor.
self.topTree = self.attachAsset('tree', {
anchorX: 0.5,
anchorY: 0.5,
width: 300,
height: topHeight,
flipY: false
});
self.topTree.rotation = Math.PI;
self.topTree.y = -groundY - gapOffset + topHeight / 2;
self.zIndex = 1; // Background'ın üstünde, sky/ground'dan önce
self.x = 2048 + 800; // Ekranın hemen dışında spawn ediliyor
self.velocityX = -3.6;
self.spawned = false;
self.prevX = self.x;
self.update = function () {
if (gameStarted && !gameOver) {
self.x += self.velocityX;
// Tree'nin spawn threshold değeri: Ekranın ortası ile en sağı arasındaki orta nokta
if (!self.spawned && self.prevX > treeSpawnThreshold && self.x <= treeSpawnThreshold) {
self.spawned = true;
var newTube = new Tube();
newTube.x = 2048 + 800; // Yeni obje ekran dışında spawn ediliyor
game.addChild(newTube);
lastSpawner = newTube;
}
self.prevX = self.x;
}
};
});
// Tube:
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ülerek aynalama efekti veriliyor.
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 - gapOffset + topHeight / 2;
self.zIndex = 1; // Background'ın üstünde, sky/ground'dan önce
self.x = 2048 + 800; // Ekranın hemen dışında spawn ediliyor
self.velocityX = -3.6;
self.spawned = false;
self.prevX = self.x;
self.update = function () {
if (gameStarted && !gameOver) {
self.x += self.velocityX;
// Tube'un spawn threshold değeri: Ekranın en sağı ile ortasının arasındaki orta nokta
if (!self.spawned && self.prevX > tubeSpawnThreshold && self.x <= tubeSpawnThreshold) {
self.spawned = true;
var newTree = new Tree();
newTree.x = 2048 + 800; // Yeni obje ekran dışında spawn ediliyor
game.addChild(newTree);
lastSpawner = newTree;
}
self.prevX = self.x;
}
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000
});
/****
* Game Code
****/
// Background: En arkada.
/****
* Global Değişkenler
****/
var gapOffset = 400; // Normal ve mirror arasındaki boşluk
var gameStarted = false;
var gameOver = false;
var centerX = 2048 / 2;
var screenRight = 2048; // Ekranın en sağı
// Ekranın ortası ile en sağı arasındaki orta nokta (Tube için)
var tubeSpawnThreshold = centerX + (screenRight - centerX) / 2;
// Ekranın en sağı ile ortasının arasındaki orta nokta (Tree için)
var treeSpawnThreshold = centerX + 3 * (screenRight - centerX) / 4;
var groundY = 2732;
var totalUnits = 10;
var lastSpawner = null;
var gameOverText = null;
var background = LK.getAsset('background', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
y: groundY / 2
});
background.zIndex = 0;
game.addChild(background);
// Sky: Ekranın en üstünde yer alması için konumlandırıldı.
var sky = LK.getAsset('sky', {
anchorX: 0.5,
anchorY: 0,
x: 2048 / 2,
y: 0
});
sky.zIndex = 2;
game.addChild(sky);
// Ground: Sky'ın üzerinde.
var groundAsset = LK.getAsset('ground', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
y: groundY - 5
});
groundAsset.zIndex = 3;
game.addChild(groundAsset);
// Character: En önde.
var character = game.addChild(new Character());
character.x = 2048 / 2;
character.y = groundY / 2;
// Oyun sonu fonksiyonu
function endGame() {
// Flash screen red for a moment
LK.effects.flashScreen(0xFF0000, 500);
// Make character jump and fall to the ground
character.velocityY = character.jumpStrength;
character.update = function () {
if (gameOver) {
character.velocityY += character.gravity;
character.y += character.velocityY;
if (character.y > groundY - 100) {
character.y = groundY - 100;
character.velocityY = 0;
gameOver = false; // Reset gameOver to allow replay
resetGame(); // Call resetGame to restart the game
}
}
};
// Tüm hareketleri durdur
game.children.forEach(function (child) {
if (child.velocityX) {
child.velocityX = 0;
}
});
// Remove automatic reset after 3 seconds
}
// Oyunu sıfırlama fonksiyonu
function resetGame() {
// Game Over metnini kaldır
if (gameOverText) {
game.removeChild(gameOverText);
gameOverText = null;
}
// Tüm tube ve tree objelerini kaldır
var objectsToRemove = [];
game.children.forEach(function (child) {
if (child instanceof Tree || child instanceof Tube) {
objectsToRemove.push(child);
}
});
objectsToRemove.forEach(function (obj) {
game.removeChild(obj);
});
// Karakteri başlangıç pozisyonuna getir
character.x = 2048 / 2;
character.y = groundY / 2;
character.velocityY = 0;
character.rotation = 0;
// Oyunu sıfırla
gameStarted = false;
gameOver = false;
lastSpawner = null;
}
// Dokunma olayı: Ekrana dokununca oyun başlar ve sağdan ilk Tube spawn edilir.
game.down = function (x, y, obj) {
if (gameOver) {
resetGame();
} else 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
@@ -32,29 +32,27 @@
var screenRight = 2048;
var screenTop = 0;
var screenBottom = groundY;
// Karakterin yarısı ekranın solundan çıkarsa
- if (!gameOver) {
- if (characterLeft + self.width / 2 < screenLeft) {
- gameOver = true;
- endGame();
- }
- // Karakterin yarısı ekranın sağından çıkarsa
- else if (characterRight - self.width / 2 > screenRight) {
- gameOver = true;
- endGame();
- }
- // Karakterin yarısı ekranın üstünden çıkarsa
- else if (characterTop + self.height / 2 < screenTop) {
- gameOver = true;
- endGame();
- }
- // Karakterin yarısı ekranın altından çıkarsa
- else if (characterBottom - self.height / 2 > screenBottom) {
- gameOver = true;
- endGame();
- }
+ if (characterLeft + self.width / 2 < screenLeft) {
+ gameOver = true;
+ endGame();
}
+ // Karakterin yarısı ekranın sağından çıkarsa
+ else if (characterRight - self.width / 2 > screenRight) {
+ gameOver = true;
+ endGame();
+ }
+ // Karakterin yarısı ekranın üstünden çıkarsa
+ else if (characterTop + self.height / 2 < screenTop) {
+ gameOver = true;
+ endGame();
+ }
+ // Karakterin yarısı ekranın altından çıkarsa
+ else if (characterBottom - self.height / 2 > screenBottom) {
+ gameOver = true;
+ endGame();
+ }
}
};
self.jump = function () {
if (!gameOver) {
@@ -185,12 +183,12 @@
/****
* Game Code
****/
+// Background: En arkada.
/****
* Global Değişkenler
****/
-// Background: En arkada.
var gapOffset = 400; // Normal ve mirror arasındaki boşluk
var gameStarted = false;
var gameOver = false;
var centerX = 2048 / 2;
@@ -245,38 +243,20 @@
character.y += character.velocityY;
if (character.y > groundY - 100) {
character.y = groundY - 100;
character.velocityY = 0;
+ gameOver = false; // Reset gameOver to allow replay
+ resetGame(); // Call resetGame to restart the game
}
}
};
- // After 4 seconds, reset character update function to normal
- LK.setTimeout(function () {
- character.update = function () {
- if (gameStarted && !gameOver) {
- character.velocityY += character.gravity;
- character.y += character.velocityY;
- if (character.y > groundY - 100) {
- character.y = groundY - 100;
- character.velocityY = 0;
- }
- }
- };
- // After 1 second of returning to normal, make character touchable again
- LK.setTimeout(function () {
- gameOver = false;
- }, 1000);
- }, 4000);
// Tüm hareketleri durdur
game.children.forEach(function (child) {
if (child.velocityX) {
child.velocityX = 0;
}
});
- // 3 saniye sonra oyunu yeniden başlat
- LK.setTimeout(function () {
- resetGame();
- }, 3000);
+ // Remove automatic reset after 3 seconds
}
// Oyunu sıfırlama fonksiyonu
function resetGame() {
// Game Over metnini kaldır
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