/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ // Boss sınıfı (basitçe büyük ve güçlü bir zombi gibi) var Boss = Container.expand(function () { var self = Container.call(this); var bossGfx = self.attachAsset('boss', { anchorX: 0.5, anchorY: 0.5, scaleX: 1.05, scaleY: 1.05 }); self.speed = 0.9; // Daha yavaş hareket self.hp = 200; self.maxHp = 200; self.isDead = false; self.vomitCooldown = 120 + Math.floor(Math.random() * 60); // Saldırı hızı yavaşlatıldı self.vomitTimer = 0; // Boss HP barı self.hpBarBg = LK.getAsset('centerCircle', { anchorX: 0.5, anchorY: 0.5, scaleX: 3.8, // Çok daha büyük bar scaleY: 0.38, // Çok daha kalın bar alpha: 0.22, tint: 0x222222, y: -210 // Biraz daha yukarı taşı }); self.hpBar = LK.getAsset('centerCircle', { anchorX: 0.5, anchorY: 0.5, scaleX: 3.7, // Çok daha büyük bar scaleY: 0.32, // Çok daha kalın bar alpha: 0.7, tint: 0xff4444, y: -210 // Biraz daha yukarı taşı }); self.addChild(self.hpBarBg); self.addChild(self.hpBar); self.update = function () { // İlk çağrıda hedef belirle if (typeof self.targetX === "undefined") { self.targetX = GAME_W / 2 + (Math.random() - 0.5) * (GAME_W / 2 - 200); self.targetY = 200 + Math.random() * (GAME_H / 2 - 400); self.moveDirX = 1; self.moveDirY = 1; } // Hareket hızı var moveSpeed = self.speed; // Boss yavaş hareket edecek // X ekseninde hedefe yaklaş if (Math.abs(self.x - self.targetX) < moveSpeed) { // Yeni hedef belirle (ekranın yarısı içinde) self.targetX = GAME_W / 2 + (Math.random() - 0.5) * (GAME_W / 2 - 200); } if (self.x < self.targetX) { self.x += moveSpeed; if (self.x > self.targetX) self.x = self.targetX; } else if (self.x > self.targetX) { self.x -= moveSpeed; if (self.x < self.targetX) self.x = self.targetX; } // Y ekseninde hedefe yaklaş (ekranın üst yarısında kalacak) var minY = 120; var maxY = GAME_H / 2; if (Math.abs(self.y - self.targetY) < moveSpeed) { // Yeni hedef belirle (ekranın yarısı içinde) self.targetY = minY + Math.random() * (maxY - minY - 200); } if (self.y < self.targetY) { self.y += moveSpeed; if (self.y > self.targetY) self.y = self.targetY; } else if (self.y > self.targetY) { self.y -= moveSpeed; if (self.y < self.targetY) self.y = self.targetY; } self.vomitTimer++; // HP barını güncelle if (self.hpBar && self.hpBarBg) { var ratio = Math.max(0, self.hp / self.maxHp); self.hpBar.scaleX = 1.08 * ratio; if (ratio > 0.5) { self.hpBar.tint = 0x44ff44; } else if (ratio > 0.2) { self.hpBar.tint = 0xffe066; } else { self.hpBar.tint = 0xff4444; } } }; return self; }); // Boss spawn fonksiyonu 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; }); // Kalkan powerup sınıfı var ShieldPowerup = Container.expand(function () { var self = Container.call(this); var gfx = self.attachAsset('centerCircle', { anchorX: 0.5, anchorY: 0.5, scaleX: 1.2, scaleY: 1.2, alpha: 0.7 }); self.speed = 8; self.update = function () { self.y += self.speed; }; return self; }); // Kalkan powerup üretici 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; }); // Ulti powerup sınıfı var UltiPowerup = Container.expand(function () { var self = Container.call(this); var gfx = self.attachAsset('2ulti', { anchorX: 0.5, anchorY: 0.5, scaleX: 1.1, scaleY: 1.1, alpha: 0.92 }); self.speed = 10; self.update = function () { self.y += self.speed; }; return self; }); // Ulti powerup üretici 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; }); // Yeni: Kusmuk ulti powerup sınıfı var VomitUltiPowerup = Container.expand(function () { var self = Container.call(this); var gfx = self.attachAsset('vomit', { anchorX: 0.5, anchorY: 0.5, scaleX: 1.25, scaleY: 1.25, alpha: 0.95 }); self.speed = 12; self.update = function () { self.y += self.speed; }; return self; }); // Kusmuk ulti powerup spawn fonksiyonu // 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 ****/ // Kusmuk ulti powerup spawn fonksiyonu // Müzik başlat // Zombi, karakter ve saldırı tipleri için temel şekiller tanımlanıyor function spawnVomitUltiPowerup() { var p = new VomitUltiPowerup(); p.x = 180 + Math.random() * (GAME_W - 360); p.y = -80; vomitUltiPowerups.push(p); game.addChild(p); } // Kusmuk ulti powerup array'i var vomitUltiPowerups = []; // Her 22 saniyede bir kusmuk ulti powerup üret LK.setInterval(function () { spawnVomitUltiPowerup(); }, 22000); 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 (daha küçük ve daha az alan kaplayan) var shieldAsset = LK.getAsset('centerCircle', { anchorX: 0.5, anchorY: 0.5, scaleX: 1.5, scaleY: 1.5, alpha: 0.72, x: 0, y: 0, tint: 0x66e0ff }); player.addChild(shieldAsset); // Ekstra: dış glow efekti için ikinci bir halka ekle (küçültüldü) var shieldGlow = LK.getAsset('centerCircle', { anchorX: 0.5, anchorY: 0.5, scaleX: 1.8, scaleY: 1.8, alpha: 0.22, tint: 0x00eaff, x: 0, y: 0 }); shieldAsset.addChild(shieldGlow); player.shieldActive = true; // Zombiler ve saldırılar için diziler var zombies = []; var playerAttacks = []; var zombieAttacks = []; // Boss ile ilgili değişkenler var boss = null; var lastBossScore = 0; var bossActive = false; // Kalkan powerup dizisi var shieldPowerups = []; // Ulti powerup dizisi var ultiPowerups = []; // Sürükleme için var dragNode = null; // Boss spawn fonksiyonu function spawnBoss() { if (bossActive) return; boss = new Boss(); boss.x = GAME_W / 2; boss.y = -200; bossActive = true; game.addChild(boss); } // Ulti powerup üretici function spawnUltiPowerup() { var p = new UltiPowerup(); p.x = 180 + Math.random() * (GAME_W - 360); p.y = -80; ultiPowerups.push(p); game.addChild(p); } // Kalkan powerup üretici function spawnShieldPowerup() { var p = new ShieldPowerup(); p.x = 180 + Math.random() * (GAME_W - 360); p.y = -80; shieldPowerups.push(p); game.addChild(p); } // Her 10 saniyede bir kalkan powerup üret LK.setInterval(function () { spawnShieldPowerup(); }, 10000); // Her 15 saniyede bir ulti powerup üret LK.setInterval(function () { spawnUltiPowerup(); }, 15000); // 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(); // zombievomit animasyonu: scale ve alpha ile fade büyüme efekti tween(zv, { scaleX: 1.5 + Math.random() * 0.7, scaleY: 1.5 + Math.random() * 0.7, alpha: 0.2 }, { duration: 420 + Math.random() * 120, onFinish: function onFinish() { if (zv && !zv.destroyed) { zv.alpha = 1; zv.scaleX = 1; zv.scaleY = 1; } } }); // Kusma efekti (2D animasyon) - birden fazla kusmuk animasyonu ekle var vomitAnimCount = 2 + Math.floor(Math.random() * 2); // 2-3 efekt for (var i = 0; i < vomitAnimCount; i++) { (function (idx) { var delay = idx * 60 + Math.random() * 40; LK.setTimeout(function () { var vomitEffect = LK.getAsset('vomit', { anchorX: 0.5, anchorY: 0.5, x: zombie.x + (Math.random() - 0.5) * 40, y: zombie.y + 80 + (Math.random() - 0.5) * 20, alpha: 0.7 + Math.random() * 0.15, scaleX: 1.1 + Math.random() * 0.7, scaleY: 0.7 + Math.random() * 0.5, tint: 0x99ff66 }); game.addChild(vomitEffect); tween(vomitEffect, { alpha: 0, scaleX: vomitEffect.scaleX * (1.7 + Math.random() * 0.7), scaleY: vomitEffect.scaleY * (1.5 + Math.random() * 0.5), y: vomitEffect.y + 220 + Math.random() * 80 // Mesafe artırıldı }, { duration: 420 + Math.random() * 120, onFinish: function onFinish() { vomitEffect.destroy(); } }); }, delay); })(i); } } // 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 (2D shape) if (player.attackType === 'fart') { var fartAnim = LK.getAsset('centerCircle', { anchorX: 0.5, anchorY: 0.5, x: player.x, y: player.y - 60, alpha: 0.5, scaleX: 1.1 + Math.random() * 0.4, scaleY: 0.7 + Math.random() * 0.3, tint: 0xcccc66 }); game.addChild(fartAnim); tween(fartAnim, { alpha: 0, scaleX: fartAnim.scaleX * 2.2, scaleY: fartAnim.scaleY * 1.7, y: fartAnim.y - 80 }, { duration: 420, onFinish: function onFinish() { fartAnim.destroy(); } }); } // 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) { // Kalkan glow animasyonu (pulsing) if (shieldGlow && shieldGlow.visible) { var pulse = 0.18 + 0.06 * Math.sin(LK.ticks / 8); shieldGlow.alpha = 0.18 + pulse; shieldGlow.scaleX = 3.2 + 0.12 * Math.sin(LK.ticks / 10); shieldGlow.scaleY = 3.2 + 0.12 * Math.sin(LK.ticks / 10); } if (player.children.indexOf(shieldAsset) === -1) player.addChild(shieldAsset); shieldAsset.visible = true; if (shieldAsset.children.indexOf(shieldGlow) === -1) shieldAsset.addChild(shieldGlow); shieldGlow.visible = true; // Elektrik efekti ekle if (!shieldAsset.electricEffect || shieldAsset.electricEffect.destroyed) { // Varsa eskiyi sil if (shieldAsset.electricEffect && !shieldAsset.electricEffect.destroyed) { shieldAsset.electricEffect.destroy(); } // Yeni elektrik efekti oluştur var electric = LK.getAsset('centerCircle', { anchorX: 0.5, anchorY: 0.5, scaleX: 1.2 + Math.random() * 0.15, scaleY: 1.2 + Math.random() * 0.15, alpha: 0.22 + Math.random() * 0.13, tint: 0x00eaff }); electric.x = 0; electric.y = 0; shieldAsset.addChild(electric); shieldAsset.electricEffect = electric; // Elektrik sesi çal if (LK.getSound('attackSnot')) { LK.getSound('attackSnot').play(); } // Animasyon: titreşim ve parıltı tween(electric, { alpha: 0.05 + Math.random() * 0.1, scaleX: electric.scaleX * (0.95 + Math.random() * 0.1), scaleY: electric.scaleY * (0.95 + Math.random() * 0.1), rotation: Math.random() * Math.PI * 2 }, { duration: 180 + Math.random() * 120, onFinish: function onFinish() { if (electric && !electric.destroyed) { electric.destroy(); } if (shieldAsset && shieldAsset.visible && player.shieldActive) { shieldAsset.electricEffect = null; } } }); } } else { shieldAsset.visible = false; if (player.children.indexOf(shieldAsset) !== -1) player.removeChild(shieldAsset); if (shieldAsset.children.indexOf(shieldGlow) !== -1) shieldAsset.removeChild(shieldGlow); shieldGlow.visible = false; // Elektrik efekti varsa kaldır if (shieldAsset.electricEffect && !shieldAsset.electricEffect.destroyed) { shieldAsset.electricEffect.destroy(); shieldAsset.electricEffect = null; } } // Boss spawn kontrolü (her 200 puanda bir) var scoreNow = LK.getScore(); if (scoreNow >= 200 && Math.floor(scoreNow / 200) > Math.floor(lastBossScore / 200)) { spawnBoss(); lastBossScore = scoreNow; } // Boss update ve çarpışma kontrolleri if (bossActive && boss) { boss.update(); // Boss ekrandan çıktıysa if (boss.y > GAME_H + 300) { boss.destroy(); boss = null; bossActive = false; } else { // Boss oyuncuya çarptı mı? if (!boss.isDead && boss.intersects(player)) { boss.isDead = true; boss.destroy(); boss = null; bossActive = false; if (player.shieldActive) { LK.effects.flashObject(shieldAsset, 0x00ffff, 400); 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; } } } // Boss kusacak mı? if (boss.vomitTimer >= boss.vomitCooldown) { spawnZombieVomit(boss); boss.vomitTimer = 0; boss.vomitCooldown = 60 + Math.floor(Math.random() * 60); } } } // 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; } // Boss'a çarptı mı? if (bossActive && boss && !boss.isDead && atk.intersects(boss)) { boss.hp -= 10; // Ana karakterin saldırı gücü 10 LK.getSound('attack').play(); atk.destroy(); playerAttacks.splice(i, 1); // Boss öldü mü? if (boss.hp <= 0) { boss.isDead = true; boss.destroy(); boss = null; bossActive = false; // Boss öldürünce ekstra skor ve can var prevScore = LK.getScore(); LK.setScore(prevScore + 100); scoreTxt.setText(LK.getScore()); updateAttackUnlocks(); var newScore = LK.getScore(); if (Math.floor(prevScore / 150) < Math.floor(newScore / 150)) { player.lives++; updateLives(); LK.getSound('unlock').play(); } } 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) // Boss varken zombiler çok az gelsin if (!bossActive) { if (LK.ticks % (60 + Math.floor(Math.random() * 30)) === 0) { if (zombies.length < 7) spawnZombie(); } } else { // Boss varken daha seyrek ve az zombi gelsin if (LK.ticks % 120 === 0) { if (zombies.length < 2) spawnZombie(); } } // Kalkan powerup hareket ve toplama for (var i = shieldPowerups.length - 1; i >= 0; i--) { var p = shieldPowerups[i]; p.update(); // Ekrandan çıktıysa if (p.y > GAME_H + 100) { p.destroy(); shieldPowerups.splice(i, 1); continue; } // Oyuncuya çarptı mı? if (p.intersects(player)) { p.destroy(); shieldPowerups.splice(i, 1); // Kalkanı aktif et player.shieldActive = true; if (player.children.indexOf(shieldAsset) === -1) player.addChild(shieldAsset); shieldAsset.visible = true; LK.getSound('unlock').play(); // Kısa bir parlama efekti LK.effects.flashObject(shieldAsset, 0x00ffff, 400); continue; } } // Ulti powerup hareket ve toplama for (var i = ultiPowerups.length - 1; i >= 0; i--) { var p = ultiPowerups[i]; p.update(); // Ekrandan çıktıysa if (p.y > GAME_H + 100) { p.destroy(); ultiPowerups.splice(i, 1); continue; } // Oyuncuya çarptı mı? if (p.intersects(player)) { p.destroy(); ultiPowerups.splice(i, 1); // --- İshal bok efekti başlat --- // Ekranın her yerine yayılacak şekilde çok sayıda efekt oluştur for (var b = 0; b < 32; b++) { (function (bIndex) { var delay = bIndex * 30 + Math.random() * 60; LK.setTimeout(function () { var poopFx = LK.getAsset('poop', { anchorX: 0.5, anchorY: 0.5, x: 80 + Math.random() * (GAME_W - 160), y: 80 + Math.random() * (GAME_H - 400), scaleX: 0.7 + Math.random() * 1.2, scaleY: 0.7 + Math.random() * 1.2, alpha: 0.92 }); game.addChild(poopFx); var targetY = poopFx.y + 320 + Math.random() * 420; var targetX = poopFx.x + (Math.random() - 0.5) * 420; tween(poopFx, { y: targetY, x: targetX, alpha: 0.1, scaleX: poopFx.scaleX * (1.2 + Math.random() * 0.7), scaleY: poopFx.scaleY * (1.2 + Math.random() * 0.7), rotation: Math.random() * Math.PI * 2 }, { duration: 700 + Math.random() * 400, onFinish: function onFinish() { poopFx.destroy(); } }); }, delay); })(b); } // --- İshal bok efekti sonu --- // Tüm zombilere 40 hasar ver for (var j = zombies.length - 1; j >= 0; j--) { if (!zombies[j].isDead) { if (typeof zombies[j].hp === "undefined") zombies[j].hp = 40; zombies[j].hp -= 40; if (zombies[j].hp <= 0) { zombies[j].isDead = true; zombies[j].destroy(); zombies.splice(j, 1); } } } // Boss da aktifse ona da 40 hasar ver if (bossActive && boss && !boss.isDead) { boss.hp -= 40; if (boss.hp <= 0) { boss.isDead = true; boss.destroy(); boss = null; bossActive = false; // Boss öldürünce ekstra skor ve can var prevScore = LK.getScore(); LK.setScore(prevScore + 100); scoreTxt.setText(LK.getScore()); updateAttackUnlocks(); var newScore = LK.getScore(); if (Math.floor(prevScore / 150) < Math.floor(newScore / 150)) { player.lives++; updateLives(); LK.getSound('unlock').play(); } } } LK.effects.flashScreen(0xffff00, 600); LK.getSound('unlock').play(); // Skor bonusu verilebilir, istenirse eklenebilir continue; } } // Kusmuk ulti powerup hareket ve toplama for (var i = vomitUltiPowerups.length - 1; i >= 0; i--) { var p = vomitUltiPowerups[i]; p.update(); // Ekrandan çıktıysa if (p.y > GAME_H + 100) { p.destroy(); vomitUltiPowerups.splice(i, 1); continue; } // Oyuncuya çarptı mı? if (p.intersects(player)) { p.destroy(); vomitUltiPowerups.splice(i, 1); // --- Kusmuk ulti efekti başlat --- // Ekranda birden fazla kusmuk animasyonu oluştur var vomitCount = 8 + Math.floor(Math.random() * 4); // 8-11 arası kusmuk efekti for (var v = 0; v < vomitCount; v++) { (function (vIndex) { var delay = vIndex * 80 + Math.random() * 120; LK.setTimeout(function () { var vomitFx = LK.getAsset('vomit', { anchorX: 0.5, anchorY: 0.0, x: 180 + Math.random() * (GAME_W - 360), y: -200 - Math.random() * 120, scaleX: 2.5 + Math.random() * 6.5, scaleY: 1.5 + Math.random() * 4.5, alpha: 0.82 + Math.random() * 0.13, tint: 0x99ff66 }); game.addChild(vomitFx); var targetX = vomitFx.x + (Math.random() - 0.5) * 200; tween(vomitFx, { y: GAME_H + 400, x: targetX, alpha: 0.1, scaleX: vomitFx.scaleX * (1.05 + Math.random() * 0.15), scaleY: vomitFx.scaleY * (1.05 + Math.random() * 0.15), rotation: (Math.random() - 0.5) * 0.4 }, { duration: 900 + Math.random() * 350, onFinish: function onFinish() { vomitFx.destroy(); } }); }, delay); })(v); } // Tüm zombilere 60 hasar ver for (var j = zombies.length - 1; j >= 0; j--) { if (!zombies[j].isDead) { if (typeof zombies[j].hp === "undefined") zombies[j].hp = 60; zombies[j].hp -= 60; if (zombies[j].hp <= 0) { zombies[j].isDead = true; zombies[j].destroy(); zombies.splice(j, 1); } } } // Boss da aktifse ona da 60 hasar ver if (bossActive && boss && !boss.isDead) { boss.hp -= 60; if (boss.hp <= 0) { boss.isDead = true; boss.destroy(); boss = null; bossActive = false; // Boss öldürünce ekstra skor ve can var prevScore = LK.getScore(); LK.setScore(prevScore + 100); scoreTxt.setText(LK.getScore()); updateAttackUnlocks(); var newScore = LK.getScore(); if (Math.floor(prevScore / 150) < Math.floor(newScore / 150)) { player.lives++; updateLives(); LK.getSound('unlock').play(); } } } LK.effects.flashScreen(0x99ff66, 600); LK.getSound('unlock').play(); continue; } } }; // Oyun başında ilk zombi spawnZombie(); updateLives(); updateAttackUnlocks(); scoreTxt.setText(LK.getScore()); attackTxt.setText(attackNames[player.attackType]);
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
// Boss sınıfı (basitçe büyük ve güçlü bir zombi gibi)
var Boss = Container.expand(function () {
var self = Container.call(this);
var bossGfx = self.attachAsset('boss', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.05,
scaleY: 1.05
});
self.speed = 0.9; // Daha yavaş hareket
self.hp = 200;
self.maxHp = 200;
self.isDead = false;
self.vomitCooldown = 120 + Math.floor(Math.random() * 60); // Saldırı hızı yavaşlatıldı
self.vomitTimer = 0;
// Boss HP barı
self.hpBarBg = LK.getAsset('centerCircle', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 3.8,
// Çok daha büyük bar
scaleY: 0.38,
// Çok daha kalın bar
alpha: 0.22,
tint: 0x222222,
y: -210 // Biraz daha yukarı taşı
});
self.hpBar = LK.getAsset('centerCircle', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 3.7,
// Çok daha büyük bar
scaleY: 0.32,
// Çok daha kalın bar
alpha: 0.7,
tint: 0xff4444,
y: -210 // Biraz daha yukarı taşı
});
self.addChild(self.hpBarBg);
self.addChild(self.hpBar);
self.update = function () {
// İlk çağrıda hedef belirle
if (typeof self.targetX === "undefined") {
self.targetX = GAME_W / 2 + (Math.random() - 0.5) * (GAME_W / 2 - 200);
self.targetY = 200 + Math.random() * (GAME_H / 2 - 400);
self.moveDirX = 1;
self.moveDirY = 1;
}
// Hareket hızı
var moveSpeed = self.speed; // Boss yavaş hareket edecek
// X ekseninde hedefe yaklaş
if (Math.abs(self.x - self.targetX) < moveSpeed) {
// Yeni hedef belirle (ekranın yarısı içinde)
self.targetX = GAME_W / 2 + (Math.random() - 0.5) * (GAME_W / 2 - 200);
}
if (self.x < self.targetX) {
self.x += moveSpeed;
if (self.x > self.targetX) self.x = self.targetX;
} else if (self.x > self.targetX) {
self.x -= moveSpeed;
if (self.x < self.targetX) self.x = self.targetX;
}
// Y ekseninde hedefe yaklaş (ekranın üst yarısında kalacak)
var minY = 120;
var maxY = GAME_H / 2;
if (Math.abs(self.y - self.targetY) < moveSpeed) {
// Yeni hedef belirle (ekranın yarısı içinde)
self.targetY = minY + Math.random() * (maxY - minY - 200);
}
if (self.y < self.targetY) {
self.y += moveSpeed;
if (self.y > self.targetY) self.y = self.targetY;
} else if (self.y > self.targetY) {
self.y -= moveSpeed;
if (self.y < self.targetY) self.y = self.targetY;
}
self.vomitTimer++;
// HP barını güncelle
if (self.hpBar && self.hpBarBg) {
var ratio = Math.max(0, self.hp / self.maxHp);
self.hpBar.scaleX = 1.08 * ratio;
if (ratio > 0.5) {
self.hpBar.tint = 0x44ff44;
} else if (ratio > 0.2) {
self.hpBar.tint = 0xffe066;
} else {
self.hpBar.tint = 0xff4444;
}
}
};
return self;
});
// Boss spawn fonksiyonu
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;
});
// Kalkan powerup sınıfı
var ShieldPowerup = Container.expand(function () {
var self = Container.call(this);
var gfx = self.attachAsset('centerCircle', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.2,
scaleY: 1.2,
alpha: 0.7
});
self.speed = 8;
self.update = function () {
self.y += self.speed;
};
return self;
});
// Kalkan powerup üretici
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;
});
// Ulti powerup sınıfı
var UltiPowerup = Container.expand(function () {
var self = Container.call(this);
var gfx = self.attachAsset('2ulti', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.1,
scaleY: 1.1,
alpha: 0.92
});
self.speed = 10;
self.update = function () {
self.y += self.speed;
};
return self;
});
// Ulti powerup üretici
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;
});
// Yeni: Kusmuk ulti powerup sınıfı
var VomitUltiPowerup = Container.expand(function () {
var self = Container.call(this);
var gfx = self.attachAsset('vomit', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.25,
scaleY: 1.25,
alpha: 0.95
});
self.speed = 12;
self.update = function () {
self.y += self.speed;
};
return self;
});
// Kusmuk ulti powerup spawn fonksiyonu
// 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
****/
// Kusmuk ulti powerup spawn fonksiyonu
// Müzik başlat
// Zombi, karakter ve saldırı tipleri için temel şekiller tanımlanıyor
function spawnVomitUltiPowerup() {
var p = new VomitUltiPowerup();
p.x = 180 + Math.random() * (GAME_W - 360);
p.y = -80;
vomitUltiPowerups.push(p);
game.addChild(p);
}
// Kusmuk ulti powerup array'i
var vomitUltiPowerups = [];
// Her 22 saniyede bir kusmuk ulti powerup üret
LK.setInterval(function () {
spawnVomitUltiPowerup();
}, 22000);
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 (daha küçük ve daha az alan kaplayan)
var shieldAsset = LK.getAsset('centerCircle', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.5,
scaleY: 1.5,
alpha: 0.72,
x: 0,
y: 0,
tint: 0x66e0ff
});
player.addChild(shieldAsset);
// Ekstra: dış glow efekti için ikinci bir halka ekle (küçültüldü)
var shieldGlow = LK.getAsset('centerCircle', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.8,
scaleY: 1.8,
alpha: 0.22,
tint: 0x00eaff,
x: 0,
y: 0
});
shieldAsset.addChild(shieldGlow);
player.shieldActive = true;
// Zombiler ve saldırılar için diziler
var zombies = [];
var playerAttacks = [];
var zombieAttacks = [];
// Boss ile ilgili değişkenler
var boss = null;
var lastBossScore = 0;
var bossActive = false;
// Kalkan powerup dizisi
var shieldPowerups = [];
// Ulti powerup dizisi
var ultiPowerups = [];
// Sürükleme için
var dragNode = null;
// Boss spawn fonksiyonu
function spawnBoss() {
if (bossActive) return;
boss = new Boss();
boss.x = GAME_W / 2;
boss.y = -200;
bossActive = true;
game.addChild(boss);
}
// Ulti powerup üretici
function spawnUltiPowerup() {
var p = new UltiPowerup();
p.x = 180 + Math.random() * (GAME_W - 360);
p.y = -80;
ultiPowerups.push(p);
game.addChild(p);
}
// Kalkan powerup üretici
function spawnShieldPowerup() {
var p = new ShieldPowerup();
p.x = 180 + Math.random() * (GAME_W - 360);
p.y = -80;
shieldPowerups.push(p);
game.addChild(p);
}
// Her 10 saniyede bir kalkan powerup üret
LK.setInterval(function () {
spawnShieldPowerup();
}, 10000);
// Her 15 saniyede bir ulti powerup üret
LK.setInterval(function () {
spawnUltiPowerup();
}, 15000);
// 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();
// zombievomit animasyonu: scale ve alpha ile fade büyüme efekti
tween(zv, {
scaleX: 1.5 + Math.random() * 0.7,
scaleY: 1.5 + Math.random() * 0.7,
alpha: 0.2
}, {
duration: 420 + Math.random() * 120,
onFinish: function onFinish() {
if (zv && !zv.destroyed) {
zv.alpha = 1;
zv.scaleX = 1;
zv.scaleY = 1;
}
}
});
// Kusma efekti (2D animasyon) - birden fazla kusmuk animasyonu ekle
var vomitAnimCount = 2 + Math.floor(Math.random() * 2); // 2-3 efekt
for (var i = 0; i < vomitAnimCount; i++) {
(function (idx) {
var delay = idx * 60 + Math.random() * 40;
LK.setTimeout(function () {
var vomitEffect = LK.getAsset('vomit', {
anchorX: 0.5,
anchorY: 0.5,
x: zombie.x + (Math.random() - 0.5) * 40,
y: zombie.y + 80 + (Math.random() - 0.5) * 20,
alpha: 0.7 + Math.random() * 0.15,
scaleX: 1.1 + Math.random() * 0.7,
scaleY: 0.7 + Math.random() * 0.5,
tint: 0x99ff66
});
game.addChild(vomitEffect);
tween(vomitEffect, {
alpha: 0,
scaleX: vomitEffect.scaleX * (1.7 + Math.random() * 0.7),
scaleY: vomitEffect.scaleY * (1.5 + Math.random() * 0.5),
y: vomitEffect.y + 220 + Math.random() * 80 // Mesafe artırıldı
}, {
duration: 420 + Math.random() * 120,
onFinish: function onFinish() {
vomitEffect.destroy();
}
});
}, delay);
})(i);
}
}
// 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 (2D shape)
if (player.attackType === 'fart') {
var fartAnim = LK.getAsset('centerCircle', {
anchorX: 0.5,
anchorY: 0.5,
x: player.x,
y: player.y - 60,
alpha: 0.5,
scaleX: 1.1 + Math.random() * 0.4,
scaleY: 0.7 + Math.random() * 0.3,
tint: 0xcccc66
});
game.addChild(fartAnim);
tween(fartAnim, {
alpha: 0,
scaleX: fartAnim.scaleX * 2.2,
scaleY: fartAnim.scaleY * 1.7,
y: fartAnim.y - 80
}, {
duration: 420,
onFinish: function onFinish() {
fartAnim.destroy();
}
});
}
// 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) {
// Kalkan glow animasyonu (pulsing)
if (shieldGlow && shieldGlow.visible) {
var pulse = 0.18 + 0.06 * Math.sin(LK.ticks / 8);
shieldGlow.alpha = 0.18 + pulse;
shieldGlow.scaleX = 3.2 + 0.12 * Math.sin(LK.ticks / 10);
shieldGlow.scaleY = 3.2 + 0.12 * Math.sin(LK.ticks / 10);
}
if (player.children.indexOf(shieldAsset) === -1) player.addChild(shieldAsset);
shieldAsset.visible = true;
if (shieldAsset.children.indexOf(shieldGlow) === -1) shieldAsset.addChild(shieldGlow);
shieldGlow.visible = true;
// Elektrik efekti ekle
if (!shieldAsset.electricEffect || shieldAsset.electricEffect.destroyed) {
// Varsa eskiyi sil
if (shieldAsset.electricEffect && !shieldAsset.electricEffect.destroyed) {
shieldAsset.electricEffect.destroy();
}
// Yeni elektrik efekti oluştur
var electric = LK.getAsset('centerCircle', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.2 + Math.random() * 0.15,
scaleY: 1.2 + Math.random() * 0.15,
alpha: 0.22 + Math.random() * 0.13,
tint: 0x00eaff
});
electric.x = 0;
electric.y = 0;
shieldAsset.addChild(electric);
shieldAsset.electricEffect = electric;
// Elektrik sesi çal
if (LK.getSound('attackSnot')) {
LK.getSound('attackSnot').play();
}
// Animasyon: titreşim ve parıltı
tween(electric, {
alpha: 0.05 + Math.random() * 0.1,
scaleX: electric.scaleX * (0.95 + Math.random() * 0.1),
scaleY: electric.scaleY * (0.95 + Math.random() * 0.1),
rotation: Math.random() * Math.PI * 2
}, {
duration: 180 + Math.random() * 120,
onFinish: function onFinish() {
if (electric && !electric.destroyed) {
electric.destroy();
}
if (shieldAsset && shieldAsset.visible && player.shieldActive) {
shieldAsset.electricEffect = null;
}
}
});
}
} else {
shieldAsset.visible = false;
if (player.children.indexOf(shieldAsset) !== -1) player.removeChild(shieldAsset);
if (shieldAsset.children.indexOf(shieldGlow) !== -1) shieldAsset.removeChild(shieldGlow);
shieldGlow.visible = false;
// Elektrik efekti varsa kaldır
if (shieldAsset.electricEffect && !shieldAsset.electricEffect.destroyed) {
shieldAsset.electricEffect.destroy();
shieldAsset.electricEffect = null;
}
}
// Boss spawn kontrolü (her 200 puanda bir)
var scoreNow = LK.getScore();
if (scoreNow >= 200 && Math.floor(scoreNow / 200) > Math.floor(lastBossScore / 200)) {
spawnBoss();
lastBossScore = scoreNow;
}
// Boss update ve çarpışma kontrolleri
if (bossActive && boss) {
boss.update();
// Boss ekrandan çıktıysa
if (boss.y > GAME_H + 300) {
boss.destroy();
boss = null;
bossActive = false;
} else {
// Boss oyuncuya çarptı mı?
if (!boss.isDead && boss.intersects(player)) {
boss.isDead = true;
boss.destroy();
boss = null;
bossActive = false;
if (player.shieldActive) {
LK.effects.flashObject(shieldAsset, 0x00ffff, 400);
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;
}
}
}
// Boss kusacak mı?
if (boss.vomitTimer >= boss.vomitCooldown) {
spawnZombieVomit(boss);
boss.vomitTimer = 0;
boss.vomitCooldown = 60 + Math.floor(Math.random() * 60);
}
}
}
// 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;
}
// Boss'a çarptı mı?
if (bossActive && boss && !boss.isDead && atk.intersects(boss)) {
boss.hp -= 10; // Ana karakterin saldırı gücü 10
LK.getSound('attack').play();
atk.destroy();
playerAttacks.splice(i, 1);
// Boss öldü mü?
if (boss.hp <= 0) {
boss.isDead = true;
boss.destroy();
boss = null;
bossActive = false;
// Boss öldürünce ekstra skor ve can
var prevScore = LK.getScore();
LK.setScore(prevScore + 100);
scoreTxt.setText(LK.getScore());
updateAttackUnlocks();
var newScore = LK.getScore();
if (Math.floor(prevScore / 150) < Math.floor(newScore / 150)) {
player.lives++;
updateLives();
LK.getSound('unlock').play();
}
}
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)
// Boss varken zombiler çok az gelsin
if (!bossActive) {
if (LK.ticks % (60 + Math.floor(Math.random() * 30)) === 0) {
if (zombies.length < 7) spawnZombie();
}
} else {
// Boss varken daha seyrek ve az zombi gelsin
if (LK.ticks % 120 === 0) {
if (zombies.length < 2) spawnZombie();
}
}
// Kalkan powerup hareket ve toplama
for (var i = shieldPowerups.length - 1; i >= 0; i--) {
var p = shieldPowerups[i];
p.update();
// Ekrandan çıktıysa
if (p.y > GAME_H + 100) {
p.destroy();
shieldPowerups.splice(i, 1);
continue;
}
// Oyuncuya çarptı mı?
if (p.intersects(player)) {
p.destroy();
shieldPowerups.splice(i, 1);
// Kalkanı aktif et
player.shieldActive = true;
if (player.children.indexOf(shieldAsset) === -1) player.addChild(shieldAsset);
shieldAsset.visible = true;
LK.getSound('unlock').play();
// Kısa bir parlama efekti
LK.effects.flashObject(shieldAsset, 0x00ffff, 400);
continue;
}
}
// Ulti powerup hareket ve toplama
for (var i = ultiPowerups.length - 1; i >= 0; i--) {
var p = ultiPowerups[i];
p.update();
// Ekrandan çıktıysa
if (p.y > GAME_H + 100) {
p.destroy();
ultiPowerups.splice(i, 1);
continue;
}
// Oyuncuya çarptı mı?
if (p.intersects(player)) {
p.destroy();
ultiPowerups.splice(i, 1);
// --- İshal bok efekti başlat ---
// Ekranın her yerine yayılacak şekilde çok sayıda efekt oluştur
for (var b = 0; b < 32; b++) {
(function (bIndex) {
var delay = bIndex * 30 + Math.random() * 60;
LK.setTimeout(function () {
var poopFx = LK.getAsset('poop', {
anchorX: 0.5,
anchorY: 0.5,
x: 80 + Math.random() * (GAME_W - 160),
y: 80 + Math.random() * (GAME_H - 400),
scaleX: 0.7 + Math.random() * 1.2,
scaleY: 0.7 + Math.random() * 1.2,
alpha: 0.92
});
game.addChild(poopFx);
var targetY = poopFx.y + 320 + Math.random() * 420;
var targetX = poopFx.x + (Math.random() - 0.5) * 420;
tween(poopFx, {
y: targetY,
x: targetX,
alpha: 0.1,
scaleX: poopFx.scaleX * (1.2 + Math.random() * 0.7),
scaleY: poopFx.scaleY * (1.2 + Math.random() * 0.7),
rotation: Math.random() * Math.PI * 2
}, {
duration: 700 + Math.random() * 400,
onFinish: function onFinish() {
poopFx.destroy();
}
});
}, delay);
})(b);
}
// --- İshal bok efekti sonu ---
// Tüm zombilere 40 hasar ver
for (var j = zombies.length - 1; j >= 0; j--) {
if (!zombies[j].isDead) {
if (typeof zombies[j].hp === "undefined") zombies[j].hp = 40;
zombies[j].hp -= 40;
if (zombies[j].hp <= 0) {
zombies[j].isDead = true;
zombies[j].destroy();
zombies.splice(j, 1);
}
}
}
// Boss da aktifse ona da 40 hasar ver
if (bossActive && boss && !boss.isDead) {
boss.hp -= 40;
if (boss.hp <= 0) {
boss.isDead = true;
boss.destroy();
boss = null;
bossActive = false;
// Boss öldürünce ekstra skor ve can
var prevScore = LK.getScore();
LK.setScore(prevScore + 100);
scoreTxt.setText(LK.getScore());
updateAttackUnlocks();
var newScore = LK.getScore();
if (Math.floor(prevScore / 150) < Math.floor(newScore / 150)) {
player.lives++;
updateLives();
LK.getSound('unlock').play();
}
}
}
LK.effects.flashScreen(0xffff00, 600);
LK.getSound('unlock').play();
// Skor bonusu verilebilir, istenirse eklenebilir
continue;
}
}
// Kusmuk ulti powerup hareket ve toplama
for (var i = vomitUltiPowerups.length - 1; i >= 0; i--) {
var p = vomitUltiPowerups[i];
p.update();
// Ekrandan çıktıysa
if (p.y > GAME_H + 100) {
p.destroy();
vomitUltiPowerups.splice(i, 1);
continue;
}
// Oyuncuya çarptı mı?
if (p.intersects(player)) {
p.destroy();
vomitUltiPowerups.splice(i, 1);
// --- Kusmuk ulti efekti başlat ---
// Ekranda birden fazla kusmuk animasyonu oluştur
var vomitCount = 8 + Math.floor(Math.random() * 4); // 8-11 arası kusmuk efekti
for (var v = 0; v < vomitCount; v++) {
(function (vIndex) {
var delay = vIndex * 80 + Math.random() * 120;
LK.setTimeout(function () {
var vomitFx = LK.getAsset('vomit', {
anchorX: 0.5,
anchorY: 0.0,
x: 180 + Math.random() * (GAME_W - 360),
y: -200 - Math.random() * 120,
scaleX: 2.5 + Math.random() * 6.5,
scaleY: 1.5 + Math.random() * 4.5,
alpha: 0.82 + Math.random() * 0.13,
tint: 0x99ff66
});
game.addChild(vomitFx);
var targetX = vomitFx.x + (Math.random() - 0.5) * 200;
tween(vomitFx, {
y: GAME_H + 400,
x: targetX,
alpha: 0.1,
scaleX: vomitFx.scaleX * (1.05 + Math.random() * 0.15),
scaleY: vomitFx.scaleY * (1.05 + Math.random() * 0.15),
rotation: (Math.random() - 0.5) * 0.4
}, {
duration: 900 + Math.random() * 350,
onFinish: function onFinish() {
vomitFx.destroy();
}
});
}, delay);
})(v);
}
// Tüm zombilere 60 hasar ver
for (var j = zombies.length - 1; j >= 0; j--) {
if (!zombies[j].isDead) {
if (typeof zombies[j].hp === "undefined") zombies[j].hp = 60;
zombies[j].hp -= 60;
if (zombies[j].hp <= 0) {
zombies[j].isDead = true;
zombies[j].destroy();
zombies.splice(j, 1);
}
}
}
// Boss da aktifse ona da 60 hasar ver
if (bossActive && boss && !boss.isDead) {
boss.hp -= 60;
if (boss.hp <= 0) {
boss.isDead = true;
boss.destroy();
boss = null;
bossActive = false;
// Boss öldürünce ekstra skor ve can
var prevScore = LK.getScore();
LK.setScore(prevScore + 100);
scoreTxt.setText(LK.getScore());
updateAttackUnlocks();
var newScore = LK.getScore();
if (Math.floor(prevScore / 150) < Math.floor(newScore / 150)) {
player.lives++;
updateLives();
LK.getSound('unlock').play();
}
}
}
LK.effects.flashScreen(0x99ff66, 600);
LK.getSound('unlock').play();
continue;
}
}
};
// Oyun başında ilk zombi
spawnZombie();
updateLives();
updateAttackUnlocks();
scoreTxt.setText(LK.getScore());
attackTxt.setText(attackNames[player.attackType]);
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