/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ // Mavi ekran (BSOD) var BSOD = Container.expand(function () { var self = Container.call(this); var bg = self.attachAsset('bsod', { anchorX: 0, anchorY: 0 }); var bsodText = new Text2("Bir sorun algılandı ve Windows kapatıldı.\n\n" + "Kullanıcı: C:\\WINDOWS\\system32\\ÇÖKERT!.EXE\n\n" + "Teknik bilgi:\n*** STOP: 0x0000008E (0xC0000005, 0xBF803E03, 0xF5B5B9B8, 0x00000000)\n\n" + "Bilgisayarınız zarar görebilir. Lütfen yeniden başlatın.", { size: 48, fill: "#fff", font: "Tahoma" }); bsodText.anchor.set(0.5, 0.5); bsodText.x = 1024; bsodText.y = 1366; self.addChild(bsodText); return self; }); // Pop-up pencere var Popup = Container.expand(function () { var self = Container.call(this); // Gövde var body = self.attachAsset('popup_body', { anchorX: 0, anchorY: 0 }); // Başlık var title = self.attachAsset('popup_title', { anchorX: 0, anchorY: 0 }); title.y = 0; // Başlık metni var titles = ["VİRÜS UYARISI", "HATA", "BİLİNMEYEN PROGRAM", "GÜVENLİK TEHDİDİ", "UYARI"]; var titleText = new Text2(titles[Math.floor(Math.random() * titles.length)], { size: 38, fill: "#fff", font: "Tahoma" }); titleText.anchor.set(0.5, 0.5); titleText.x = 260; titleText.y = 30; self.addChild(titleText); // Kapat butonu var closeBtn = self.attachAsset('close_btn', { anchorX: 0, anchorY: 0 }); closeBtn.x = 460; closeBtn.y = 0; // X harfi var xText = new Text2("X", { size: 38, fill: "#fff", font: "Tahoma" }); xText.anchor.set(0.5, 0.5); xText.x = closeBtn.x + 30; xText.y = closeBtn.y + 30; self.addChild(xText); // Mesaj var messages = ["BİLGİSAYARINIZ TEHLİKEDE!\nHemen antivirüs yükleyin.", "SİSTEM HATASI: 0x0000007B\nLütfen tekrar deneyin.", "Bilinmeyen uygulama çalışıyor.\nDevam etmek istiyor musunuz?", "Virüs tespit edildi!\nDosya: C:\\WINDOWS\\system32\\ÇÖKERT!.EXE", "RAM yetersiz. Bellek boşaltılamıyor."]; var msg = new Text2(messages[Math.floor(Math.random() * messages.length)], { size: 32, fill: "#222", font: "Tahoma" }); msg.anchor.set(0.5, 0); msg.x = 260; msg.y = 80; self.addChild(msg); // Sürükleme desteği self.isDragging = false; self.down = function (x, y, obj) { // Kapat butonuna tıklandıysa if (x >= closeBtn.x && x <= closeBtn.x + 60 && y >= closeBtn.y && y <= closeBtn.y + 60) { if (self.onClose) self.onClose(); return; } // Başlıktan sürükleme if (y <= 60) { self.isDragging = true; self.dragOffsetX = x - self.x; self.dragOffsetY = y - self.y; } }; self.up = function (x, y, obj) { self.isDragging = false; }; return self; }); // Virüs simgesi var Virus = Container.expand(function () { var self = Container.call(this); var icon = self.attachAsset('virus_icon', { anchorX: 0.5, anchorY: 0.5 }); // Rastgele bozuk dosya adı var names = ["VIRUS32.EXE", "KORUMASIZ!.SCR", "BILINMEYEN.BAT", "TROJAN-TR.DLL", "ÇÖKERT!.EXE", "SİLİNDİ!.TMP"]; var label = new Text2(names[Math.floor(Math.random() * names.length)], { size: 38, fill: "#fff", font: "Tahoma" }); label.anchor.set(0.5, 0); label.y = 60; self.addChild(label); // Hareket yönü ve hız self.vx = (Math.random() - 0.5) * 8; self.vy = (Math.random() - 0.5) * 8; // Hafif titreme efekti için self.shake = function () { tween(self, { rotation: (Math.random() - 0.5) * 0.2 }, { duration: 80, easing: tween.cubicOut, onFinish: function onFinish() { tween(self, { rotation: 0 }, { duration: 80 }); } }); }; // Temizlenme animasyonu self.cleanAnim = function (cb) { tween(self, { alpha: 0, scaleX: 1.5, scaleY: 1.5 }, { duration: 300, onFinish: cb }); }; // Sürükleme desteği self.isDragging = false; self.down = function (x, y, obj) { self.isDragging = true; self.dragOffsetX = x - self.x; self.dragOffsetY = y - self.y; self.shake(); }; self.up = function (x, y, obj) { self.isDragging = false; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x003399 // XP mavi }); /**** * Game Code ****/ // XP müziği (loop) // Virüs temizleme sesi // Pop-up açılma sesi // Hata sesi // Mavi ekran (tam ekran kutu) // Kapat (X) butonu // Pop-up pencere (beyaz kutu, mavi başlık) // Virüs simgesi (kırmızı, retro kutu) // Masaüstü arka planı (XP tarzı) // Arka planı ekle var bg = LK.getAsset('xp_bg', { anchorX: 0, anchorY: 0, x: 0, y: 0 }); game.addChild(bg); // Skor (temizlenen virüs sayısı) var score = 0; var xp = 0; var currentTask = null; var taskProgress = 0; var taskTxt = null; var xpTxt = null; var scoreTxt = new Text2("0", { size: 90, fill: "#fff", font: "Tahoma" }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // XP göstergesi xpTxt = new Text2("XP: 0", { size: 48, fill: "#ff0", font: "Tahoma" }); xpTxt.anchor.set(0.5, 0); xpTxt.y = 80; LK.gui.top.addChild(xpTxt); // Görev göstergesi taskTxt = new Text2("", { size: 48, fill: "#0ff", font: "Tahoma" }); taskTxt.anchor.set(0.5, 0); taskTxt.y = 160; LK.gui.top.addChild(taskTxt); // Görevler var tasks = [{ type: "popup_close", count: 3, text: "3 pop-up kapat", reward: 50 }, { type: "virus_clean", count: 5, text: "5 virüs temizle", reward: 60 }, { type: "virus_clean_time", count: 5, time: 60, text: "1 dakikada 5 virüs temizle", reward: 100 }, { type: "popup_close_time", count: 4, time: 30, text: "30 sn'de 4 pop-up kapat", reward: 80 }]; var taskTimer = null; var taskTimeLeft = 0; // Görev başlatıcı function startTask() { // Rastgele görev seç currentTask = tasks[Math.floor(Math.random() * tasks.length)]; taskProgress = 0; if (currentTask.time) { taskTimeLeft = currentTask.time; if (taskTimer) LK.clearInterval(taskTimer); taskTimer = LK.setInterval(function () { taskTimeLeft--; updateTaskText(); if (taskTimeLeft <= 0) { // Görev başarısız taskTxt.setText("Görev başarısız! :("); currentTask = null; LK.setTimeout(startTask, 2000); LK.clearInterval(taskTimer); } }, 1000); } updateTaskText(); } function updateTaskText() { if (!currentTask) return; var txt = currentTask.text + " (" + taskProgress + "/" + currentTask.count + ")"; if (currentTask.time) txt += " [" + taskTimeLeft + " sn]"; taskTxt.setText(txt); } function completeTask() { xp += currentTask.reward; xpTxt.setText("XP: " + xp); taskTxt.setText("Görev tamamlandı! +" + currentTask.reward + " XP"); currentTask = null; if (taskTimer) LK.clearInterval(taskTimer); LK.setTimeout(startTask, 2000); } LK.setTimeout(startTask, 1000); // Virüs ve pop-up dizileri var viruses = []; var popups = []; var bsodActive = false; // Sürüklenen nesne var dragNode = null; // Virüs oluşturucu function spawnVirus() { var v = new Virus(); // Rastgele konum (ekranın ortasına çok yaklaşmasın) v.x = 200 + Math.random() * (2048 - 400); v.y = 300 + Math.random() * (2732 - 600); v.lastX = v.x; v.lastY = v.y; viruses.push(v); game.addChild(v); } // Pop-up oluşturucu function spawnPopup() { var p = new Popup(); p.x = 200 + Math.random() * (2048 - 700); p.y = 200 + Math.random() * (2732 - 500); p.lastX = p.x; p.lastY = p.y; p.onClose = function () { // Kapat animasyonu tween(p, { alpha: 0, scaleX: 0.8, scaleY: 0.8 }, { duration: 200, onFinish: function onFinish() { p.destroy(); for (var i = 0; i < popups.length; i++) { if (popups[i] === p) { popups.splice(i, 1); break; } } } }); LK.getSound('popup').play(); // Görev ilerlemesi if (typeof currentTask !== "undefined" && currentTask && (currentTask.type === "popup_close" || currentTask.type === "popup_close_time")) { taskProgress++; updateTaskText(); if (taskProgress >= currentTask.count) completeTask(); } }; popups.push(p); game.addChild(p); LK.getSound('popup').play(); } // Mavi ekranı göster function showBSOD() { if (bsodActive) return; bsodActive = true; var bsod = new BSOD(); game.addChild(bsod); // 2 saniye sonra oyun biter LK.setTimeout(function () { LK.showGameOver(); }, 2000); } // Oyun başında virüs ve pop-up'lar for (var i = 0; i < 4; i++) spawnVirus(); for (var i = 0; i < 2; i++) spawnPopup(); // Zamanlayıcılar: rastgele yeni virüs ve pop-up var virusTimer = LK.setInterval(function () { if (viruses.length < 10 && !bsodActive) { spawnVirus(); } }, 1800); var popupTimer = LK.setInterval(function () { if (popups.length < 5 && !bsodActive) { spawnPopup(); } }, 2500); // Rastgele mavi ekran (BSOD) şansı var bsodTimer = LK.setInterval(function () { if (!bsodActive && Math.random() < 0.07) { showBSOD(); } }, 4000); // Oyun müziği LK.playMusic('xp_theme', { loop: true }); // Oyun güncelleme döngüsü game.update = function () { // Virüs hareketleri ve sınırdan sekme for (var i = viruses.length - 1; i >= 0; i--) { var v = viruses[i]; if (!v.isDragging) { v.x += v.vx; v.y += v.vy; // Kenardan sekme if (v.x < 80 || v.x > 2048 - 80) v.vx *= -1; if (v.y < 120 || v.y > 2732 - 80) v.vy *= -1; // Hafif titreme if (Math.random() < 0.03) v.shake(); } // Temizleme: virüse tıklandıysa if (v.justClean) { v.cleanAnim(function () { v.destroy(); }); viruses.splice(i, 1); score++; scoreTxt.setText(score); LK.getSound('clean').play(); // Görev ilerlemesi if (typeof currentTask !== "undefined" && currentTask && (currentTask.type === "virus_clean" || currentTask.type === "virus_clean_time")) { taskProgress++; updateTaskText(); if (taskProgress >= currentTask.count) completeTask(); } // 15 virüs temizlenirse "You Win" if (score >= 15) { LK.showYouWin(); } } } // Pop-up'lar sınırdan taşmasın for (var j = 0; j < popups.length; j++) { var p = popups[j]; if (p.x < 0) p.x = 0; if (p.x > 2048 - 520) p.x = 2048 - 520; if (p.y < 0) p.y = 0; if (p.y > 2732 - 320) p.y = 2732 - 320; } }; // Sürükleme ve tıklama işlemleri function handleMove(x, y, obj) { if (dragNode) { dragNode.x = x - dragNode.dragOffsetX; dragNode.y = y - dragNode.dragOffsetY; } } game.move = handleMove; game.down = function (x, y, obj) { // Önce virüsleri kontrol et (üstteki öne) for (var i = viruses.length - 1; i >= 0; i--) { var v = viruses[i]; var dx = x - v.x; var dy = y - v.y; if (dx * dx + dy * dy < 80 * 80) { // Temizle v.justClean = true; return; } } // Pop-up'lar for (var j = popups.length - 1; j >= 0; j--) { var p = popups[j]; if (x >= p.x && x <= p.x + 520 && y >= p.y && y <= p.y + 320) { dragNode = p; p.down(x - p.x, y - p.y, obj); return; } } // Virüs sürükleme for (var k = viruses.length - 1; k >= 0; k--) { var v2 = viruses[k]; var dx2 = x - v2.x; var dy2 = y - v2.y; if (dx2 * dx2 + dy2 * dy2 < 80 * 80) { dragNode = v2; v2.down(x, y, obj); return; } } dragNode = null; }; game.up = function (x, y, obj) { if (dragNode) { if (dragNode.up) dragNode.up(x - (dragNode.x || 0), y - (dragNode.y || 0), obj); dragNode = null; } }; // Ekran bozulma efekti (kısa süreli titreme) function glitchScreen() { tween(game, { rotation: (Math.random() - 0.5) * 0.04, x: (Math.random() - 0.5) * 30, y: (Math.random() - 0.5) * 30 }, { duration: 120, onFinish: function onFinish() { tween(game, { rotation: 0, x: 0, y: 0 }, { duration: 120 }); } }); } // Hata sesi ve ekran bozulması, rastgele aralıklarla var errorTimer = LK.setInterval(function () { if (!bsodActive && Math.random() < 0.3) { LK.getSound('error').play(); glitchScreen(); } }, 1800);
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
// Mavi ekran (BSOD)
var BSOD = Container.expand(function () {
var self = Container.call(this);
var bg = self.attachAsset('bsod', {
anchorX: 0,
anchorY: 0
});
var bsodText = new Text2("Bir sorun algılandı ve Windows kapatıldı.\n\n" + "Kullanıcı: C:\\WINDOWS\\system32\\ÇÖKERT!.EXE\n\n" + "Teknik bilgi:\n*** STOP: 0x0000008E (0xC0000005, 0xBF803E03, 0xF5B5B9B8, 0x00000000)\n\n" + "Bilgisayarınız zarar görebilir. Lütfen yeniden başlatın.", {
size: 48,
fill: "#fff",
font: "Tahoma"
});
bsodText.anchor.set(0.5, 0.5);
bsodText.x = 1024;
bsodText.y = 1366;
self.addChild(bsodText);
return self;
});
// Pop-up pencere
var Popup = Container.expand(function () {
var self = Container.call(this);
// Gövde
var body = self.attachAsset('popup_body', {
anchorX: 0,
anchorY: 0
});
// Başlık
var title = self.attachAsset('popup_title', {
anchorX: 0,
anchorY: 0
});
title.y = 0;
// Başlık metni
var titles = ["VİRÜS UYARISI", "HATA", "BİLİNMEYEN PROGRAM", "GÜVENLİK TEHDİDİ", "UYARI"];
var titleText = new Text2(titles[Math.floor(Math.random() * titles.length)], {
size: 38,
fill: "#fff",
font: "Tahoma"
});
titleText.anchor.set(0.5, 0.5);
titleText.x = 260;
titleText.y = 30;
self.addChild(titleText);
// Kapat butonu
var closeBtn = self.attachAsset('close_btn', {
anchorX: 0,
anchorY: 0
});
closeBtn.x = 460;
closeBtn.y = 0;
// X harfi
var xText = new Text2("X", {
size: 38,
fill: "#fff",
font: "Tahoma"
});
xText.anchor.set(0.5, 0.5);
xText.x = closeBtn.x + 30;
xText.y = closeBtn.y + 30;
self.addChild(xText);
// Mesaj
var messages = ["BİLGİSAYARINIZ TEHLİKEDE!\nHemen antivirüs yükleyin.", "SİSTEM HATASI: 0x0000007B\nLütfen tekrar deneyin.", "Bilinmeyen uygulama çalışıyor.\nDevam etmek istiyor musunuz?", "Virüs tespit edildi!\nDosya: C:\\WINDOWS\\system32\\ÇÖKERT!.EXE", "RAM yetersiz. Bellek boşaltılamıyor."];
var msg = new Text2(messages[Math.floor(Math.random() * messages.length)], {
size: 32,
fill: "#222",
font: "Tahoma"
});
msg.anchor.set(0.5, 0);
msg.x = 260;
msg.y = 80;
self.addChild(msg);
// Sürükleme desteği
self.isDragging = false;
self.down = function (x, y, obj) {
// Kapat butonuna tıklandıysa
if (x >= closeBtn.x && x <= closeBtn.x + 60 && y >= closeBtn.y && y <= closeBtn.y + 60) {
if (self.onClose) self.onClose();
return;
}
// Başlıktan sürükleme
if (y <= 60) {
self.isDragging = true;
self.dragOffsetX = x - self.x;
self.dragOffsetY = y - self.y;
}
};
self.up = function (x, y, obj) {
self.isDragging = false;
};
return self;
});
// Virüs simgesi
var Virus = Container.expand(function () {
var self = Container.call(this);
var icon = self.attachAsset('virus_icon', {
anchorX: 0.5,
anchorY: 0.5
});
// Rastgele bozuk dosya adı
var names = ["VIRUS32.EXE", "KORUMASIZ!.SCR", "BILINMEYEN.BAT", "TROJAN-TR.DLL", "ÇÖKERT!.EXE", "SİLİNDİ!.TMP"];
var label = new Text2(names[Math.floor(Math.random() * names.length)], {
size: 38,
fill: "#fff",
font: "Tahoma"
});
label.anchor.set(0.5, 0);
label.y = 60;
self.addChild(label);
// Hareket yönü ve hız
self.vx = (Math.random() - 0.5) * 8;
self.vy = (Math.random() - 0.5) * 8;
// Hafif titreme efekti için
self.shake = function () {
tween(self, {
rotation: (Math.random() - 0.5) * 0.2
}, {
duration: 80,
easing: tween.cubicOut,
onFinish: function onFinish() {
tween(self, {
rotation: 0
}, {
duration: 80
});
}
});
};
// Temizlenme animasyonu
self.cleanAnim = function (cb) {
tween(self, {
alpha: 0,
scaleX: 1.5,
scaleY: 1.5
}, {
duration: 300,
onFinish: cb
});
};
// Sürükleme desteği
self.isDragging = false;
self.down = function (x, y, obj) {
self.isDragging = true;
self.dragOffsetX = x - self.x;
self.dragOffsetY = y - self.y;
self.shake();
};
self.up = function (x, y, obj) {
self.isDragging = false;
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x003399 // XP mavi
});
/****
* Game Code
****/
// XP müziği (loop)
// Virüs temizleme sesi
// Pop-up açılma sesi
// Hata sesi
// Mavi ekran (tam ekran kutu)
// Kapat (X) butonu
// Pop-up pencere (beyaz kutu, mavi başlık)
// Virüs simgesi (kırmızı, retro kutu)
// Masaüstü arka planı (XP tarzı)
// Arka planı ekle
var bg = LK.getAsset('xp_bg', {
anchorX: 0,
anchorY: 0,
x: 0,
y: 0
});
game.addChild(bg);
// Skor (temizlenen virüs sayısı)
var score = 0;
var xp = 0;
var currentTask = null;
var taskProgress = 0;
var taskTxt = null;
var xpTxt = null;
var scoreTxt = new Text2("0", {
size: 90,
fill: "#fff",
font: "Tahoma"
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// XP göstergesi
xpTxt = new Text2("XP: 0", {
size: 48,
fill: "#ff0",
font: "Tahoma"
});
xpTxt.anchor.set(0.5, 0);
xpTxt.y = 80;
LK.gui.top.addChild(xpTxt);
// Görev göstergesi
taskTxt = new Text2("", {
size: 48,
fill: "#0ff",
font: "Tahoma"
});
taskTxt.anchor.set(0.5, 0);
taskTxt.y = 160;
LK.gui.top.addChild(taskTxt);
// Görevler
var tasks = [{
type: "popup_close",
count: 3,
text: "3 pop-up kapat",
reward: 50
}, {
type: "virus_clean",
count: 5,
text: "5 virüs temizle",
reward: 60
}, {
type: "virus_clean_time",
count: 5,
time: 60,
text: "1 dakikada 5 virüs temizle",
reward: 100
}, {
type: "popup_close_time",
count: 4,
time: 30,
text: "30 sn'de 4 pop-up kapat",
reward: 80
}];
var taskTimer = null;
var taskTimeLeft = 0;
// Görev başlatıcı
function startTask() {
// Rastgele görev seç
currentTask = tasks[Math.floor(Math.random() * tasks.length)];
taskProgress = 0;
if (currentTask.time) {
taskTimeLeft = currentTask.time;
if (taskTimer) LK.clearInterval(taskTimer);
taskTimer = LK.setInterval(function () {
taskTimeLeft--;
updateTaskText();
if (taskTimeLeft <= 0) {
// Görev başarısız
taskTxt.setText("Görev başarısız! :(");
currentTask = null;
LK.setTimeout(startTask, 2000);
LK.clearInterval(taskTimer);
}
}, 1000);
}
updateTaskText();
}
function updateTaskText() {
if (!currentTask) return;
var txt = currentTask.text + " (" + taskProgress + "/" + currentTask.count + ")";
if (currentTask.time) txt += " [" + taskTimeLeft + " sn]";
taskTxt.setText(txt);
}
function completeTask() {
xp += currentTask.reward;
xpTxt.setText("XP: " + xp);
taskTxt.setText("Görev tamamlandı! +" + currentTask.reward + " XP");
currentTask = null;
if (taskTimer) LK.clearInterval(taskTimer);
LK.setTimeout(startTask, 2000);
}
LK.setTimeout(startTask, 1000);
// Virüs ve pop-up dizileri
var viruses = [];
var popups = [];
var bsodActive = false;
// Sürüklenen nesne
var dragNode = null;
// Virüs oluşturucu
function spawnVirus() {
var v = new Virus();
// Rastgele konum (ekranın ortasına çok yaklaşmasın)
v.x = 200 + Math.random() * (2048 - 400);
v.y = 300 + Math.random() * (2732 - 600);
v.lastX = v.x;
v.lastY = v.y;
viruses.push(v);
game.addChild(v);
}
// Pop-up oluşturucu
function spawnPopup() {
var p = new Popup();
p.x = 200 + Math.random() * (2048 - 700);
p.y = 200 + Math.random() * (2732 - 500);
p.lastX = p.x;
p.lastY = p.y;
p.onClose = function () {
// Kapat animasyonu
tween(p, {
alpha: 0,
scaleX: 0.8,
scaleY: 0.8
}, {
duration: 200,
onFinish: function onFinish() {
p.destroy();
for (var i = 0; i < popups.length; i++) {
if (popups[i] === p) {
popups.splice(i, 1);
break;
}
}
}
});
LK.getSound('popup').play();
// Görev ilerlemesi
if (typeof currentTask !== "undefined" && currentTask && (currentTask.type === "popup_close" || currentTask.type === "popup_close_time")) {
taskProgress++;
updateTaskText();
if (taskProgress >= currentTask.count) completeTask();
}
};
popups.push(p);
game.addChild(p);
LK.getSound('popup').play();
}
// Mavi ekranı göster
function showBSOD() {
if (bsodActive) return;
bsodActive = true;
var bsod = new BSOD();
game.addChild(bsod);
// 2 saniye sonra oyun biter
LK.setTimeout(function () {
LK.showGameOver();
}, 2000);
}
// Oyun başında virüs ve pop-up'lar
for (var i = 0; i < 4; i++) spawnVirus();
for (var i = 0; i < 2; i++) spawnPopup();
// Zamanlayıcılar: rastgele yeni virüs ve pop-up
var virusTimer = LK.setInterval(function () {
if (viruses.length < 10 && !bsodActive) {
spawnVirus();
}
}, 1800);
var popupTimer = LK.setInterval(function () {
if (popups.length < 5 && !bsodActive) {
spawnPopup();
}
}, 2500);
// Rastgele mavi ekran (BSOD) şansı
var bsodTimer = LK.setInterval(function () {
if (!bsodActive && Math.random() < 0.07) {
showBSOD();
}
}, 4000);
// Oyun müziği
LK.playMusic('xp_theme', {
loop: true
});
// Oyun güncelleme döngüsü
game.update = function () {
// Virüs hareketleri ve sınırdan sekme
for (var i = viruses.length - 1; i >= 0; i--) {
var v = viruses[i];
if (!v.isDragging) {
v.x += v.vx;
v.y += v.vy;
// Kenardan sekme
if (v.x < 80 || v.x > 2048 - 80) v.vx *= -1;
if (v.y < 120 || v.y > 2732 - 80) v.vy *= -1;
// Hafif titreme
if (Math.random() < 0.03) v.shake();
}
// Temizleme: virüse tıklandıysa
if (v.justClean) {
v.cleanAnim(function () {
v.destroy();
});
viruses.splice(i, 1);
score++;
scoreTxt.setText(score);
LK.getSound('clean').play();
// Görev ilerlemesi
if (typeof currentTask !== "undefined" && currentTask && (currentTask.type === "virus_clean" || currentTask.type === "virus_clean_time")) {
taskProgress++;
updateTaskText();
if (taskProgress >= currentTask.count) completeTask();
}
// 15 virüs temizlenirse "You Win"
if (score >= 15) {
LK.showYouWin();
}
}
}
// Pop-up'lar sınırdan taşmasın
for (var j = 0; j < popups.length; j++) {
var p = popups[j];
if (p.x < 0) p.x = 0;
if (p.x > 2048 - 520) p.x = 2048 - 520;
if (p.y < 0) p.y = 0;
if (p.y > 2732 - 320) p.y = 2732 - 320;
}
};
// Sürükleme ve tıklama işlemleri
function handleMove(x, y, obj) {
if (dragNode) {
dragNode.x = x - dragNode.dragOffsetX;
dragNode.y = y - dragNode.dragOffsetY;
}
}
game.move = handleMove;
game.down = function (x, y, obj) {
// Önce virüsleri kontrol et (üstteki öne)
for (var i = viruses.length - 1; i >= 0; i--) {
var v = viruses[i];
var dx = x - v.x;
var dy = y - v.y;
if (dx * dx + dy * dy < 80 * 80) {
// Temizle
v.justClean = true;
return;
}
}
// Pop-up'lar
for (var j = popups.length - 1; j >= 0; j--) {
var p = popups[j];
if (x >= p.x && x <= p.x + 520 && y >= p.y && y <= p.y + 320) {
dragNode = p;
p.down(x - p.x, y - p.y, obj);
return;
}
}
// Virüs sürükleme
for (var k = viruses.length - 1; k >= 0; k--) {
var v2 = viruses[k];
var dx2 = x - v2.x;
var dy2 = y - v2.y;
if (dx2 * dx2 + dy2 * dy2 < 80 * 80) {
dragNode = v2;
v2.down(x, y, obj);
return;
}
}
dragNode = null;
};
game.up = function (x, y, obj) {
if (dragNode) {
if (dragNode.up) dragNode.up(x - (dragNode.x || 0), y - (dragNode.y || 0), obj);
dragNode = null;
}
};
// Ekran bozulma efekti (kısa süreli titreme)
function glitchScreen() {
tween(game, {
rotation: (Math.random() - 0.5) * 0.04,
x: (Math.random() - 0.5) * 30,
y: (Math.random() - 0.5) * 30
}, {
duration: 120,
onFinish: function onFinish() {
tween(game, {
rotation: 0,
x: 0,
y: 0
}, {
duration: 120
});
}
});
}
// Hata sesi ve ekran bozulması, rastgele aralıklarla
var errorTimer = LK.setInterval(function () {
if (!bsodActive && Math.random() < 0.3) {
LK.getSound('error').play();
glitchScreen();
}
}, 1800);