User prompt
Please fix the bug: 'Cannot read properties of null (reading 'setText')' in or related to this line: 'scoreTxt.setText(LK.getScore());' Line Number: 774
User prompt
Please fix the bug: 'Cannot read properties of null (reading 'setText')' in or related to this line: 'scoreTxt.setText(LK.getScore());' Line Number: 772
User prompt
Please fix the bug: 'scoreTxt is not defined' in or related to this line: 'scoreTxt.setText(LK.getScore());' Line Number: 771
User prompt
Please fix the bug: 'attackTxt is not defined' in or related to this line: 'if (attackTxt) {' Line Number: 546
User prompt
Please fix the bug: 'Cannot read properties of null (reading 'updateAttackType')' in or related to this line: 'player.updateAttackType(score);' Line Number: 543
User prompt
Please fix the bug: 'Cannot read properties of null (reading 'setText')' in or related to this line: 'livesTxt.setText('');' Line Number: 549
User prompt
Please fix the bug: 'livesTxt is not defined' in or related to this line: 'livesTxt.setText('');' Line Number: 549
User prompt
Please fix the bug: 'livesTxt is not defined' in or related to this line: 'livesTxt.setText('');' Line Number: 548
User prompt
Please fix the bug: 'Cannot read properties of null (reading 'lives')' in or related to this line: 'for (var i = 0; i < player.lives; i++) {' Line Number: 548
User prompt
Please fix the bug: 'attackTxt is not defined' in or related to this line: 'LK.gui.topLeft.addChild(attackTxt);' Line Number: 467
User prompt
oyun başlarken 2 adet zombi ve 2 adet ana karakter olacak ve bunlar arasında seçim yaparak oyuna başlanacak
User prompt
fix bug
User prompt
Please fix the bug: 'Uncaught TypeError: tween.create is not a function' in or related to this line: 'tween.create(fartAnim).to({' Line Number: 307
User prompt
Please fix the bug: 'Uncaught TypeError: tween.Tween is not a constructor' in or related to this line: 'new tween.Tween(fartAnim).to({' Line Number: 307
User prompt
Please fix the bug: 'Uncaught TypeError: tween.create is not a function' in or related to this line: 'tween.create(fartAnim).to({' Line Number: 307
User prompt
her 10 saniyede bir yukardan kalkan özelliği gelecek
User prompt
Remove shield if it takes a single hit, regardless of score
User prompt
kalkan tek bir can olacak ve hasar yediğinde kaybolacak
User prompt
kalkan saldırı alınca kaybolacak
User prompt
0 ile 150 puan arasında önünde 1 canlık kalkan olacak
User prompt
her 150 puanda bir ekstra can kazanıcak
User prompt
Please fix the bug: 'Uncaught TypeError: tween.to is not a function' in or related to this line: 'tween.to(fartAnim, {' Line Number: 262
User prompt
add fart animation
User prompt
zombileri vurdugunda zombiden ses gelecek
User prompt
her bir saldırıya ayrı ses efekleri koyalım ve zombilerin kusmukları biraz yavaş gelsin
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Fart = Container.expand(function () { var self = Container.call(this); var gfx = self.attachAsset('fart', { anchorX: 0.5, anchorY: 0.5 }); self.speed = -10; self.update = function () { self.y += self.speed; }; return self; }); // Oyuncu karakteri var Player = Container.expand(function () { var self = Container.call(this); var playerGfx = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); self.radius = playerGfx.width / 2; self.cooldown = 0; // Atış bekleme süresi self.canAttack = true; self.lives = 3; self.attackType = 'poop'; // Başlangıç saldırısı self.unlockedAttacks = { poop: true, vomit: false, fart: false, snot: false }; // Saldırı tipini güncelle self.updateAttackType = function (score) { if (score >= 450 && !self.unlockedAttacks.snot) { self.unlockedAttacks.snot = true; LK.getSound('unlock').play(); } if (score >= 300 && !self.unlockedAttacks.fart) { self.unlockedAttacks.fart = true; LK.getSound('unlock').play(); } if (score >= 150 && !self.unlockedAttacks.vomit) { self.unlockedAttacks.vomit = true; LK.getSound('unlock').play(); } // Saldırı tipi otomatik değişmesin, oyuncu seçsin (ileride eklenebilir) }; return self; }); // Oyuncu saldırıları var Poop = Container.expand(function () { var self = Container.call(this); var gfx = self.attachAsset('poop', { anchorX: 0.5, anchorY: 0.5 }); self.speed = -22; self.update = function () { self.y += self.speed; }; return self; }); var Snot = Container.expand(function () { var self = Container.call(this); var gfx = self.attachAsset('snot', { anchorX: 0.5, anchorY: 0.5 }); self.speed = -30; self.update = function () { self.y += self.speed; }; return self; }); var Vomit = Container.expand(function () { var self = Container.call(this); var gfx = self.attachAsset('vomit', { anchorX: 0.5, anchorY: 0.5 }); self.speed = -16; self.update = function () { self.y += self.speed; }; return self; }); // Zombi var Zombie = Container.expand(function () { var self = Container.call(this); var zombieGfx = self.attachAsset('zombie', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 2 + Math.random() * 1.5; // Rastgele yavaş hız self.vomitCooldown = 90 + Math.floor(Math.random() * 120); // 1.5-3.5 sn arası kusma self.vomitTimer = 0; self.isDead = false; self.update = function () { self.y += self.speed; self.vomitTimer++; }; return self; }); // Zombinin kusmuğu var ZombieVomit = Container.expand(function () { var self = Container.call(this); var gfx = self.attachAsset('zombieVomit', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 6; self.update = function () { self.y += self.speed; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x222222 }); /**** * Game Code ****/ // Müzik başlat // Zombi, karakter ve saldırı tipleri için temel şekiller tanımlanıyor LK.playMusic('bgmusic'); // Arka plan banyo resmi ekle var bgBathroom = LK.getAsset('bathroomBg', { anchorX: 0, anchorY: 0, x: 0, y: 0, width: 2048, height: 2732 }); game.addChild(bgBathroom); // Oyun alanı boyutları var GAME_W = 2048; var GAME_H = 2732; // Skor ve can göstergeleri var scoreTxt = new Text2('0', { size: 110, fill: "#fff" }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); var livesTxt = new Text2('❤❤❤', { size: 90, fill: 0xFF4444 }); livesTxt.anchor.set(1, 0); LK.gui.topRight.addChild(livesTxt); // Saldırı tipi göstergesi var attackTxt = new Text2('Kaka', { size: 80, fill: 0xFFE066 }); attackTxt.anchor.set(0, 0); LK.gui.topLeft.addChild(attackTxt); // Oyuncu karakteri var player = new Player(); player.x = GAME_W / 2; player.y = GAME_H - 350; game.addChild(player); // Kalkan görseli (ilk başta görünür, 0-150 puan arası) var shieldAsset = LK.getAsset('centerCircle', { anchorX: 0.5, anchorY: 0.5, scaleX: 2.2, scaleY: 2.2, alpha: 0.45, x: 0, y: 0 }); player.addChild(shieldAsset); player.shieldActive = true; shieldAsset.visible = true; // Zombiler ve saldırılar için diziler var zombies = []; var playerAttacks = []; var zombieAttacks = []; // Sürükleme için var dragNode = null; // Saldırı tipleri ve isimleri var attackTypes = ['poop', 'vomit', 'fart', 'snot']; var attackNames = { poop: 'Kaka', vomit: 'Kusmuk', fart: 'Osuruk', snot: 'Sümük' }; // Saldırı tipi göstergesi sadece bilgi amaçlı, tıklama ile değişmez LK.gui.topLeft.addChild(attackTxt); // Zombi oluşturucu function spawnZombie() { var z = new Zombie(); z.x = 180 + Math.random() * (GAME_W - 360); z.y = -100; zombies.push(z); game.addChild(z); } // Zombi saldırısı oluşturucu function spawnZombieVomit(zombie) { var zv = new ZombieVomit(); zv.x = zombie.x; zv.y = zombie.y + 80; zombieAttacks.push(zv); game.addChild(zv); LK.getSound('zombieVomit').play(); } // Saldırı oluşturucu function spawnPlayerAttack() { var atk; var score = LK.getScore(); if (score < 150) { atk = new Poop(); player.attackType = 'poop'; } else if (score < 300) { atk = new Vomit(); player.attackType = 'vomit'; } else if (score < 400) { atk = new Fart(); player.attackType = 'fart'; } else { atk = new Snot(); player.attackType = 'snot'; } atk.x = player.x; atk.y = player.y - 90; playerAttacks.push(atk); game.addChild(atk); // Fart animation effect if (player.attackType === 'fart') { var fartAnim = LK.getAsset('fart', { anchorX: 0.5, anchorY: 0.5, x: player.x, y: player.y - 60, alpha: 0.8, scaleX: 1.2 + Math.random() * 0.5, scaleY: 1.2 + Math.random() * 0.5 }); game.addChild(fartAnim); tween.create(fartAnim).to({ alpha: 0, scaleX: 2, scaleY: 2, y: fartAnim.y - 80 }, 500).onComplete(function () { fartAnim.destroy(); }).start(); } // Play sound based on attack type if (player.attackType === 'poop') { LK.getSound('attackPoop').play(); } else if (player.attackType === 'vomit') { LK.getSound('attackVomit').play(); } else if (player.attackType === 'fart') { LK.getSound('attackFart').play(); } else if (player.attackType === 'snot') { LK.getSound('attackSnot').play(); } attackTxt.setText(attackNames[player.attackType]); } // Saldırı tipi güncelleme function updateAttackUnlocks() { var score = LK.getScore(); player.updateAttackType(score); attackTxt.setText(attackNames[player.attackType]); } // Can güncelle function updateLives() { var s = ''; for (var i = 0; i < player.lives; i++) s += '❤'; livesTxt.setText(s); } // Sürükleme ve hareket function handleMove(x, y, obj) { // Sadece yatay (X) eksende hareket etsin, Y sabit kalsın var px = Math.max(120, Math.min(GAME_W - 120, x)); player.x = px; // Y ekseni sabit, başlangıç konumunda kalacak } game.move = handleMove; // Ekrana dokununca saldırı (karaktere dokunulmazsa) game.down = function (x, y, obj) { if (!(Math.abs(x - player.x) < 120 && Math.abs(y - player.y) < 120)) { // Saldırı if (player.canAttack) { spawnPlayerAttack(); player.canAttack = false; // Saldırı bekleme süresi saldırı tipine göre değişir var cd = 18; if (player.attackType === 'vomit') cd = 28; if (player.attackType === 'fart') cd = 36; if (player.attackType === 'snot') cd = 50; player.cooldown = cd; } } }; game.up = function (x, y, obj) {}; // Oyun döngüsü game.update = function () { // Saldırı bekleme if (!player.canAttack) { player.cooldown--; if (player.cooldown <= 0) { player.canAttack = true; } } // Kalkan aktifliği güncelle (sadece bir kez alınan hasarla kaybolur) if (player.shieldActive) { if (player.children.indexOf(shieldAsset) === -1) player.addChild(shieldAsset); shieldAsset.visible = true; } else { shieldAsset.visible = false; if (player.children.indexOf(shieldAsset) !== -1) player.removeChild(shieldAsset); } // Zombiler for (var i = zombies.length - 1; i >= 0; i--) { var z = zombies[i]; z.update(); // Zombi ekrandan çıktıysa if (z.y > GAME_H + 100) { z.destroy(); zombies.splice(i, 1); continue; } // Zombi oyuncuya çarptı mı? if (!z.isDead && z.intersects(player)) { z.isDead = true; z.destroy(); zombies.splice(i, 1); if (player.shieldActive) { // Kalkan varsa hasar alma, kalkanı kısa süreliğine parlat LK.effects.flashObject(shieldAsset, 0x00ffff, 400); // Kalkan saldırı alınca kaybolacak player.shieldActive = false; shieldAsset.visible = false; if (player.children.indexOf(shieldAsset) !== -1) player.removeChild(shieldAsset); } else { player.lives--; updateLives(); LK.effects.flashObject(player, 0xff0000, 600); if (player.lives <= 0) { LK.effects.flashScreen(0xff0000, 1200); LK.showGameOver(); return; } } continue; } // Zombi kusacak mı? if (z.vomitTimer >= z.vomitCooldown) { spawnZombieVomit(z); z.vomitTimer = 0; z.vomitCooldown = 90 + Math.floor(Math.random() * 120); } } // Oyuncu saldırıları for (var i = playerAttacks.length - 1; i >= 0; i--) { var atk = playerAttacks[i]; atk.update(); // Ekrandan çıktıysa if (atk.y < -100) { atk.destroy(); playerAttacks.splice(i, 1); continue; } // Zombiye çarptı mı? for (var j = zombies.length - 1; j >= 0; j--) { var z = zombies[j]; if (!z.isDead && atk.intersects(z)) { z.isDead = true; LK.getSound('attack').play(); z.destroy(); zombies.splice(j, 1); atk.destroy(); playerAttacks.splice(i, 1); // Skor var prevScore = LK.getScore(); LK.setScore(prevScore + 10); scoreTxt.setText(LK.getScore()); updateAttackUnlocks(); // Ekstra can: Her 150 puanda bir ekstra can kazan var newScore = LK.getScore(); if (Math.floor(prevScore / 150) < Math.floor(newScore / 150)) { player.lives++; updateLives(); LK.getSound('unlock').play(); } // Kazanma yok, amaç hayatta kalmak break; } } } // Zombi saldırıları for (var i = zombieAttacks.length - 1; i >= 0; i--) { var zv = zombieAttacks[i]; zv.update(); // Ekrandan çıktıysa if (zv.y > GAME_H + 100) { zv.destroy(); zombieAttacks.splice(i, 1); continue; } // Oyuncuya çarptı mı? if (zv.intersects(player)) { zv.destroy(); zombieAttacks.splice(i, 1); if (player.shieldActive) { // Kalkan varsa hasar alma, kalkanı kısa süreliğine parlat LK.effects.flashObject(shieldAsset, 0x00ffff, 400); // Kalkan saldırı alınca kaybolacak player.shieldActive = false; shieldAsset.visible = false; if (player.children.indexOf(shieldAsset) !== -1) player.removeChild(shieldAsset); } else { player.lives--; updateLives(); LK.effects.flashObject(player, 0x00ff00, 600); if (player.lives <= 0) { LK.effects.flashScreen(0xff0000, 1200); LK.showGameOver(); return; } } continue; } } // Zombi üretimi (her 60-90 tickte bir) if (LK.ticks % (60 + Math.floor(Math.random() * 30)) === 0) { if (zombies.length < 7) spawnZombie(); } }; // Oyun başında ilk zombi spawnZombie(); updateLives(); updateAttackUnlocks(); scoreTxt.setText(LK.getScore()); attackTxt.setText(attackNames[player.attackType]);
===================================================================
--- original.js
+++ change.js
@@ -131,10 +131,10 @@
/****
* Game Code
****/
-// Zombi, karakter ve saldırı tipleri için temel şekiller tanımlanıyor
// Müzik başlat
+// Zombi, karakter ve saldırı tipleri için temel şekiller tanımlanıyor
LK.playMusic('bgmusic');
// Arka plan banyo resmi ekle
var bgBathroom = LK.getAsset('bathroomBg', {
anchorX: 0,
@@ -318,22 +318,15 @@
if (player.cooldown <= 0) {
player.canAttack = true;
}
}
- // Kalkan aktifliği güncelle (0-150 puan arası)
- // Kalkan sadece bir canlık olacak, hasar alınca kaybolacak ve tekrar gelmeyecek
- if (LK.getScore() < 150 && typeof player.shieldUsed === "undefined") {
- if (!player.shieldActive) {
- player.shieldActive = true;
- if (player.children.indexOf(shieldAsset) === -1) player.addChild(shieldAsset);
- shieldAsset.visible = true;
- }
+ // Kalkan aktifliği güncelle (sadece bir kez alınan hasarla kaybolur)
+ if (player.shieldActive) {
+ if (player.children.indexOf(shieldAsset) === -1) player.addChild(shieldAsset);
+ shieldAsset.visible = true;
} else {
- if (player.shieldActive) {
- player.shieldActive = false;
- shieldAsset.visible = false;
- if (player.children.indexOf(shieldAsset) !== -1) player.removeChild(shieldAsset);
- }
+ shieldAsset.visible = false;
+ if (player.children.indexOf(shieldAsset) !== -1) player.removeChild(shieldAsset);
}
// Zombiler
for (var i = zombies.length - 1; i >= 0; i--) {
var z = zombies[i];
@@ -353,9 +346,8 @@
// Kalkan varsa hasar alma, kalkanı kısa süreliğine parlat
LK.effects.flashObject(shieldAsset, 0x00ffff, 400);
// Kalkan saldırı alınca kaybolacak
player.shieldActive = false;
- player.shieldUsed = true;
shieldAsset.visible = false;
if (player.children.indexOf(shieldAsset) !== -1) player.removeChild(shieldAsset);
} else {
player.lives--;
@@ -431,9 +423,8 @@
// Kalkan varsa hasar alma, kalkanı kısa süreliğine parlat
LK.effects.flashObject(shieldAsset, 0x00ffff, 400);
// Kalkan saldırı alınca kaybolacak
player.shieldActive = false;
- player.shieldUsed = true;
shieldAsset.visible = false;
if (player.children.indexOf(shieldAsset) !== -1) player.removeChild(shieldAsset);
} else {
player.lives--;
poop. In-Game asset. 2d. High contrast. No shadows
vomit. In-Game asset. 2d. High contrast. No shadows
bathrom. In-Game asset. 2d. High contrast. No shadows
fart animation. In-Game asset. 2d. High contrast. No shadows
yuvarlak mavi elektirikli kalkan. In-Game asset. 2d. High contrast. No shadows
snot. In-Game asset. 2d. High contrast. No shadows
transparent