User prompt
kanka şu ipucu yazısı en sol üst köşede olsun en sağ üst değil
User prompt
kanka bir kere gelen kişi daha gelemesin eğer 2 kere aynı ismi görürsem anlıyayım doppleganger olduğunu ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
kanka tam iki kartın tam ortasında bir resim olsun
User prompt
kanka bazende kimlik kartıyla verdiği kartta faklılıklar olsun örenğin birinde daire 300 yazarken diğerinde 205 yazsın ve bu yüzden yanlış olduğunu anlayabilelim
User prompt
kanka ana menüdeyken tuşlara özel basma sesi oluştur
User prompt
kanka ana menüdeyeken tuşlara basma seside ekle
User prompt
kanka ipucu en sağ üst köşede yazsın
User prompt
Please fix the bug: 'TypeError: Cannot read properties of null (reading 'x')' in or related to this line: 'anomalyKiller.x = currentVisitor.x;' Line Number: 1188
User prompt
kanka ana menüdeyken şu approve deny yazan kısım gözükmesin birde approve buttonunu tıpkı deny gibi yap ama yeşil olsun
User prompt
kanka approve butonu yeşil renkte olsun birde ana menüdeyken ipucu metni gözükmesin
User prompt
kanka approve yazan buttonu düzelt birde şu yukarıda yazan ipucu metnini bir araya getir çok fazla yer kaplamasın birde oyun ilk ingilizce başlasın ayarlardan değiştirebilelim
User prompt
hayır yanlış yaptığım kişi anomaliye dönüşsün ve bana yaklaşıp öldürsün beni ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Please fix the bug: 'TypeError: Cannot read properties of null (reading 'destroy')' in or related to this line: 'currentVisitor.destroy();' Line Number: 1178
User prompt
kanka eğer 3 hata yaparsak anomali yanıma gelip beni öldürsün animasyonunu ekle ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
kanka şimdide adamın söylediği şey konuştuğu kutucuğa sığmıyor metine göre boyutu tam optimize edilsin konuşma kutucuğunun ve diğer kutucuklarda metinlere göre optimize edilsin metinler taşmasın
User prompt
kanka yazılar çok küçük okunmuyo isim kayıt yada adamın söylediği şeyler ipucu falan bunları büyüt ki okunsun
User prompt
kanka kayıt taki resimdede hata var ara sıra onuda düzelt ve daha çok şey ekle sadece kimliğe bakmayalım farklı ipuçlarıda olsun aynı That's Not My Neighbor! oyunundaki gibi ve adam bizle konuşsun şu yüzden geldim falan diye ↪💡 Consider importing and using the following plugins: @upit/tween.v1, @upit/storage.v1
User prompt
kanka hala hatalar var kimlikte gözüken adam hatalı oluyor bazen hiç hata kalmasın bütün hataları düzelt herşeyi ekle ve detaylandırıp düzelt
User prompt
kanka mesela örnek veriyorum zenci biri geliyo kimlikte adamın ten rengi beyaz o yüzden reddet diyorum hata yaptın diyo kanka düzelt şu hataları eğer doğru kişiyse kimliktede o kişinin aynısı gözüksün
User prompt
kanka kimlikte olan admın resmi hep aynı düzelt şunu hiçbirşey anlayamıyorum ve dili türkçe yapınca neden hala ingilizce oyun approve falan yazıyo bütün hataları düzelt ve detay ekle
User prompt
kanka kimlikteki resim hep aynı bune kanka düzelt şunu birde ana menü animasyonu butona basma animasyonu falan olsun sadelikten uzaklaşsın oyun ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
kanka isimler daha belirgin dursun birde bütün karakterler aynı hepsi birbirinden farklı gözüksün bazıları anomali olduğu belli olsun tipinden hatta çok detaylı olsun birde ana menü yap oyna ve ayarlar olsun ayarlardan dil değiştirebilelim ingilizce ve türkçe olsun ses ekle oyuna bide ↪💡 Consider importing and using the following plugins: @upit/storage.v1
Code edit (1 edits merged)
Please save this source code
User prompt
Doppelganger Detective
Initial prompt
That's Not My Neighbor! oyununun aynısını yapabilirmisin
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var IDCard = Container.expand(function () { var self = Container.call(this); var cardBackground = self.attachAsset('idCard', { anchorX: 0.5, anchorY: 0.5 }); // Create mini visitor face on ID var miniHead = self.attachAsset('visitorHead', { anchorX: 0.5, anchorY: 0.5, x: -120, y: -20, scaleX: 0.6, scaleY: 0.6 }); var miniHair = self.attachAsset('visitorHair', { anchorX: 0.5, anchorY: 0.5, x: -120, y: -40, scaleX: 0.6, scaleY: 0.6 }); var miniLeftEye = self.attachAsset('visitorEye', { anchorX: 0.5, anchorY: 0.5, x: -135, y: -25, scaleX: 0.6, scaleY: 0.6 }); var miniRightEye = self.attachAsset('visitorEye', { anchorX: 0.5, anchorY: 0.5, x: -105, y: -25, scaleX: 0.6, scaleY: 0.6 }); var miniNose = self.attachAsset('visitorNose', { anchorX: 0.5, anchorY: 0.5, x: -120, y: -10, scaleX: 0.6, scaleY: 0.6 }); var miniMouth = self.attachAsset('visitorMouth', { anchorX: 0.5, anchorY: 0.5, x: -120, y: 5, scaleX: 0.6, scaleY: 0.6 }); self.nameText = new Text2('', { size: 30, fill: '#000000' }); self.nameText.anchor.set(0, 0.5); self.nameText.x = 20; self.nameText.y = -60; self.addChild(self.nameText); self.apartmentText = new Text2('', { size: 25, fill: '#000000' }); self.apartmentText.anchor.set(0, 0.5); self.apartmentText.x = 20; self.apartmentText.y = -20; self.addChild(self.apartmentText); self.setInfo = function (name, apartment, features) { self.nameText.setText('Name: ' + name); self.apartmentText.setText('Apt: ' + apartment); miniHair.tint = features.hairColor; miniLeftEye.x = -120 - features.eyeSpacing * 0.3; miniRightEye.x = -120 + features.eyeSpacing * 0.3; miniNose.scaleX = features.noseSize * 0.6; miniNose.scaleY = features.noseSize * 0.6; miniMouth.scaleX = features.mouthWidth * 0.6; }; return self; }); var RecordCard = Container.expand(function () { var self = Container.call(this); var cardBackground = self.attachAsset('recordCard', { anchorX: 0.5, anchorY: 0.5 }); // Create mini resident face on record var miniHead = self.attachAsset('visitorHead', { anchorX: 0.5, anchorY: 0.5, x: -120, y: -20, scaleX: 0.6, scaleY: 0.6 }); var miniHair = self.attachAsset('visitorHair', { anchorX: 0.5, anchorY: 0.5, x: -120, y: -40, scaleX: 0.6, scaleY: 0.6 }); var miniLeftEye = self.attachAsset('visitorEye', { anchorX: 0.5, anchorY: 0.5, x: -135, y: -25, scaleX: 0.6, scaleY: 0.6 }); var miniRightEye = self.attachAsset('visitorEye', { anchorX: 0.5, anchorY: 0.5, x: -105, y: -25, scaleX: 0.6, scaleY: 0.6 }); var miniNose = self.attachAsset('visitorNose', { anchorX: 0.5, anchorY: 0.5, x: -120, y: -10, scaleX: 0.6, scaleY: 0.6 }); var miniMouth = self.attachAsset('visitorMouth', { anchorX: 0.5, anchorY: 0.5, x: -120, y: 5, scaleX: 0.6, scaleY: 0.6 }); self.nameText = new Text2('', { size: 30, fill: '#000000' }); self.nameText.anchor.set(0, 0.5); self.nameText.x = 20; self.nameText.y = -60; self.addChild(self.nameText); self.apartmentText = new Text2('', { size: 25, fill: '#000000' }); self.apartmentText.anchor.set(0, 0.5); self.apartmentText.x = 20; self.apartmentText.y = -20; self.addChild(self.apartmentText); self.setInfo = function (name, apartment, features) { self.nameText.setText('Record: ' + name); self.apartmentText.setText('Apt: ' + apartment); miniHair.tint = features.hairColor; miniLeftEye.x = -120 - features.eyeSpacing * 0.3; miniRightEye.x = -120 + features.eyeSpacing * 0.3; miniNose.scaleX = features.noseSize * 0.6; miniNose.scaleY = features.noseSize * 0.6; miniMouth.scaleX = features.mouthWidth * 0.6; }; return self; }); var Visitor = Container.expand(function () { var self = Container.call(this); // Create visitor appearance var body = self.attachAsset('visitor', { anchorX: 0.5, anchorY: 1.0 }); var head = self.attachAsset('visitorHead', { anchorX: 0.5, anchorY: 0.5, x: 0, y: -200 }); var hair = self.attachAsset('visitorHair', { anchorX: 0.5, anchorY: 0.5, x: 0, y: -240 }); var leftEye = self.attachAsset('visitorEye', { anchorX: 0.5, anchorY: 0.5, x: -25, y: -210 }); var rightEye = self.attachAsset('visitorEye', { anchorX: 0.5, anchorY: 0.5, x: 25, y: -210 }); var nose = self.attachAsset('visitorNose', { anchorX: 0.5, anchorY: 0.5, x: 0, y: -190 }); var mouth = self.attachAsset('visitorMouth', { anchorX: 0.5, anchorY: 0.5, x: 0, y: -170 }); // Visitor properties self.name = ''; self.apartmentNumber = 0; self.isDoppelganger = false; self.hairColor = 0x654321; self.eyeSpacing = 50; self.noseSize = 1.0; self.mouthWidth = 1.0; self.setFeatures = function (features) { hair.tint = features.hairColor; leftEye.x = -features.eyeSpacing / 2; rightEye.x = features.eyeSpacing / 2; nose.scaleX = features.noseSize; nose.scaleY = features.noseSize; mouth.scaleX = features.mouthWidth; self.hairColor = features.hairColor; self.eyeSpacing = features.eyeSpacing; self.noseSize = features.noseSize; self.mouthWidth = features.mouthWidth; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x34495e }); /**** * Game Code ****/ // Game state var currentVisitor = null; var currentIDCard = null; var currentRecord = null; var gameActive = true; var score = 0; var mistakes = 0; var maxMistakes = 3; var visitorCount = 0; // Resident database var residents = [{ name: 'John Smith', apartment: 101, hairColor: 0x654321, eyeSpacing: 50, noseSize: 1.0, mouthWidth: 1.0 }, { name: 'Mary Johnson', apartment: 102, hairColor: 0x8B4513, eyeSpacing: 45, noseSize: 0.8, mouthWidth: 1.2 }, { name: 'Bob Wilson', apartment: 103, hairColor: 0x2F4F4F, eyeSpacing: 55, noseSize: 1.3, mouthWidth: 0.9 }, { name: 'Lisa Brown', apartment: 201, hairColor: 0xFFD700, eyeSpacing: 48, noseSize: 0.9, mouthWidth: 1.1 }, { name: 'Mike Davis', apartment: 202, hairColor: 0x8B0000, eyeSpacing: 52, noseSize: 1.1, mouthWidth: 0.8 }]; // Create background var background = game.addChild(LK.getAsset('background', { anchorX: 0, anchorY: 0, x: 0, y: 0 })); // Create desk var desk = game.addChild(LK.getAsset('desk', { anchorX: 0.5, anchorY: 1.0, x: 1024, y: 2732 })); // Create buttons var approveButton = game.addChild(LK.getAsset('approveButton', { anchorX: 0.5, anchorY: 0.5, x: 700, y: 2500 })); var denyButton = game.addChild(LK.getAsset('denyButton', { anchorX: 0.5, anchorY: 0.5, x: 1348, y: 2500 })); // Button labels var approveText = new Text2('APPROVE', { size: 40, fill: '#ffffff' }); approveText.anchor.set(0.5, 0.5); approveText.x = 700; approveText.y = 2500; game.addChild(approveText); var denyText = new Text2('DENY', { size: 40, fill: '#ffffff' }); denyText.anchor.set(0.5, 0.5); denyText.x = 1348; denyText.y = 2500; game.addChild(denyText); // Score display var scoreText = new Text2('Score: 0', { size: 60, fill: '#ffffff' }); scoreText.anchor.set(0.5, 0); LK.gui.top.addChild(scoreText); // Mistakes display var mistakesText = new Text2('Mistakes: 0/3', { size: 40, fill: '#ff6b6b' }); mistakesText.anchor.set(1, 0); mistakesText.x = 2048 - 50; mistakesText.y = 100; game.addChild(mistakesText); // Instructions var instructionText = new Text2('Compare the visitor to their ID and building records.\nLook for differences to catch doppelgangers!', { size: 35, fill: '#ecf0f1' }); instructionText.anchor.set(0.5, 0); instructionText.x = 1024; instructionText.y = 150; game.addChild(instructionText); function getRandomResident() { return residents[Math.floor(Math.random() * residents.length)]; } function createDoppelgangerFeatures(originalFeatures) { var features = { hairColor: originalFeatures.hairColor, eyeSpacing: originalFeatures.eyeSpacing, noseSize: originalFeatures.noseSize, mouthWidth: originalFeatures.mouthWidth }; // Randomly alter one feature slightly var changeType = Math.floor(Math.random() * 4); switch (changeType) { case 0: // Hair color var colors = [0x654321, 0x8B4513, 0x2F4F4F, 0xFFD700, 0x8B0000]; do { features.hairColor = colors[Math.floor(Math.random() * colors.length)]; } while (features.hairColor === originalFeatures.hairColor); break; case 1: // Eye spacing features.eyeSpacing = originalFeatures.eyeSpacing + (Math.random() > 0.5 ? 8 : -8); break; case 2: // Nose size features.noseSize = originalFeatures.noseSize + (Math.random() > 0.5 ? 0.3 : -0.3); break; case 3: // Mouth width features.mouthWidth = originalFeatures.mouthWidth + (Math.random() > 0.5 ? 0.4 : -0.4); break; } return features; } function spawnVisitor() { if (!gameActive) return; visitorCount++; var resident = getRandomResident(); var isDoppelganger = Math.random() < 0.4; // 40% chance of doppelganger // Create visitor currentVisitor = game.addChild(new Visitor()); currentVisitor.x = 1024; currentVisitor.y = 1800; currentVisitor.name = resident.name; currentVisitor.apartmentNumber = resident.apartment; currentVisitor.isDoppelganger = isDoppelganger; var visitorFeatures = isDoppelganger ? createDoppelgangerFeatures(resident) : resident; currentVisitor.setFeatures(visitorFeatures); // Create ID card (always shows original resident info) currentIDCard = game.addChild(new IDCard()); currentIDCard.x = 400; currentIDCard.y = 2300; currentIDCard.setInfo(resident.name, resident.apartment, resident); // Create building record (always shows correct resident info) currentRecord = game.addChild(new RecordCard()); currentRecord.x = 1648; currentRecord.y = 2300; currentRecord.setInfo(resident.name, resident.apartment, resident); // Animate visitor entrance currentVisitor.y = 1200; tween(currentVisitor, { y: 1800 }, { duration: 1000 }); LK.getSound('doorbell').play(); } function handleDecision(approved) { if (!gameActive || !currentVisitor) return; var correct = approved && !currentVisitor.isDoppelganger || !approved && currentVisitor.isDoppelganger; if (correct) { score += 10; LK.setScore(score); scoreText.setText('Score: ' + score); LK.getSound('correct').play(); if (currentVisitor.isDoppelganger) { LK.effects.flashObject(currentVisitor, 0xff0000, 500); } else { LK.effects.flashObject(currentVisitor, 0x00ff00, 500); } } else { mistakes++; mistakesText.setText('Mistakes: ' + mistakes + '/' + maxMistakes); LK.getSound('wrong').play(); LK.effects.flashScreen(0xff0000, 300); if (mistakes >= maxMistakes) { gameActive = false; LK.setTimeout(function () { LK.showGameOver(); }, 1000); return; } } // Remove current visitor and cards tween(currentVisitor, { y: 1200 }, { duration: 800, onFinish: function onFinish() { currentVisitor.destroy(); currentIDCard.destroy(); currentRecord.destroy(); currentVisitor = null; currentIDCard = null; currentRecord = null; // Spawn next visitor after a short delay LK.setTimeout(spawnVisitor, 1500); } }); // Check win condition if (score >= 100) { gameActive = false; LK.setTimeout(function () { LK.showYouWin(); }, 1000); } } // Button event handlers approveButton.down = function (x, y, obj) { if (gameActive && currentVisitor) { LK.effects.flashObject(approveButton, 0xffffff, 200); handleDecision(true); } }; denyButton.down = function (x, y, obj) { if (gameActive && currentVisitor) { LK.effects.flashObject(denyButton, 0xffffff, 200); handleDecision(false); } }; // Start the game LK.setTimeout(spawnVisitor, 2000); game.update = function () { // Game loop - update score display scoreText.setText('Score: ' + LK.getScore()); };
===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,502 @@
-/****
+/****
+* Plugins
+****/
+var tween = LK.import("@upit/tween.v1");
+
+/****
+* Classes
+****/
+var IDCard = Container.expand(function () {
+ var self = Container.call(this);
+ var cardBackground = self.attachAsset('idCard', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ // Create mini visitor face on ID
+ var miniHead = self.attachAsset('visitorHead', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: -120,
+ y: -20,
+ scaleX: 0.6,
+ scaleY: 0.6
+ });
+ var miniHair = self.attachAsset('visitorHair', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: -120,
+ y: -40,
+ scaleX: 0.6,
+ scaleY: 0.6
+ });
+ var miniLeftEye = self.attachAsset('visitorEye', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: -135,
+ y: -25,
+ scaleX: 0.6,
+ scaleY: 0.6
+ });
+ var miniRightEye = self.attachAsset('visitorEye', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: -105,
+ y: -25,
+ scaleX: 0.6,
+ scaleY: 0.6
+ });
+ var miniNose = self.attachAsset('visitorNose', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: -120,
+ y: -10,
+ scaleX: 0.6,
+ scaleY: 0.6
+ });
+ var miniMouth = self.attachAsset('visitorMouth', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: -120,
+ y: 5,
+ scaleX: 0.6,
+ scaleY: 0.6
+ });
+ self.nameText = new Text2('', {
+ size: 30,
+ fill: '#000000'
+ });
+ self.nameText.anchor.set(0, 0.5);
+ self.nameText.x = 20;
+ self.nameText.y = -60;
+ self.addChild(self.nameText);
+ self.apartmentText = new Text2('', {
+ size: 25,
+ fill: '#000000'
+ });
+ self.apartmentText.anchor.set(0, 0.5);
+ self.apartmentText.x = 20;
+ self.apartmentText.y = -20;
+ self.addChild(self.apartmentText);
+ self.setInfo = function (name, apartment, features) {
+ self.nameText.setText('Name: ' + name);
+ self.apartmentText.setText('Apt: ' + apartment);
+ miniHair.tint = features.hairColor;
+ miniLeftEye.x = -120 - features.eyeSpacing * 0.3;
+ miniRightEye.x = -120 + features.eyeSpacing * 0.3;
+ miniNose.scaleX = features.noseSize * 0.6;
+ miniNose.scaleY = features.noseSize * 0.6;
+ miniMouth.scaleX = features.mouthWidth * 0.6;
+ };
+ return self;
+});
+var RecordCard = Container.expand(function () {
+ var self = Container.call(this);
+ var cardBackground = self.attachAsset('recordCard', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ // Create mini resident face on record
+ var miniHead = self.attachAsset('visitorHead', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: -120,
+ y: -20,
+ scaleX: 0.6,
+ scaleY: 0.6
+ });
+ var miniHair = self.attachAsset('visitorHair', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: -120,
+ y: -40,
+ scaleX: 0.6,
+ scaleY: 0.6
+ });
+ var miniLeftEye = self.attachAsset('visitorEye', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: -135,
+ y: -25,
+ scaleX: 0.6,
+ scaleY: 0.6
+ });
+ var miniRightEye = self.attachAsset('visitorEye', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: -105,
+ y: -25,
+ scaleX: 0.6,
+ scaleY: 0.6
+ });
+ var miniNose = self.attachAsset('visitorNose', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: -120,
+ y: -10,
+ scaleX: 0.6,
+ scaleY: 0.6
+ });
+ var miniMouth = self.attachAsset('visitorMouth', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: -120,
+ y: 5,
+ scaleX: 0.6,
+ scaleY: 0.6
+ });
+ self.nameText = new Text2('', {
+ size: 30,
+ fill: '#000000'
+ });
+ self.nameText.anchor.set(0, 0.5);
+ self.nameText.x = 20;
+ self.nameText.y = -60;
+ self.addChild(self.nameText);
+ self.apartmentText = new Text2('', {
+ size: 25,
+ fill: '#000000'
+ });
+ self.apartmentText.anchor.set(0, 0.5);
+ self.apartmentText.x = 20;
+ self.apartmentText.y = -20;
+ self.addChild(self.apartmentText);
+ self.setInfo = function (name, apartment, features) {
+ self.nameText.setText('Record: ' + name);
+ self.apartmentText.setText('Apt: ' + apartment);
+ miniHair.tint = features.hairColor;
+ miniLeftEye.x = -120 - features.eyeSpacing * 0.3;
+ miniRightEye.x = -120 + features.eyeSpacing * 0.3;
+ miniNose.scaleX = features.noseSize * 0.6;
+ miniNose.scaleY = features.noseSize * 0.6;
+ miniMouth.scaleX = features.mouthWidth * 0.6;
+ };
+ return self;
+});
+var Visitor = Container.expand(function () {
+ var self = Container.call(this);
+ // Create visitor appearance
+ var body = self.attachAsset('visitor', {
+ anchorX: 0.5,
+ anchorY: 1.0
+ });
+ var head = self.attachAsset('visitorHead', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: 0,
+ y: -200
+ });
+ var hair = self.attachAsset('visitorHair', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: 0,
+ y: -240
+ });
+ var leftEye = self.attachAsset('visitorEye', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: -25,
+ y: -210
+ });
+ var rightEye = self.attachAsset('visitorEye', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: 25,
+ y: -210
+ });
+ var nose = self.attachAsset('visitorNose', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: 0,
+ y: -190
+ });
+ var mouth = self.attachAsset('visitorMouth', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: 0,
+ y: -170
+ });
+ // Visitor properties
+ self.name = '';
+ self.apartmentNumber = 0;
+ self.isDoppelganger = false;
+ self.hairColor = 0x654321;
+ self.eyeSpacing = 50;
+ self.noseSize = 1.0;
+ self.mouthWidth = 1.0;
+ self.setFeatures = function (features) {
+ hair.tint = features.hairColor;
+ leftEye.x = -features.eyeSpacing / 2;
+ rightEye.x = features.eyeSpacing / 2;
+ nose.scaleX = features.noseSize;
+ nose.scaleY = features.noseSize;
+ mouth.scaleX = features.mouthWidth;
+ self.hairColor = features.hairColor;
+ self.eyeSpacing = features.eyeSpacing;
+ self.noseSize = features.noseSize;
+ self.mouthWidth = features.mouthWidth;
+ };
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0x34495e
+});
+
+/****
+* Game Code
+****/
+// Game state
+var currentVisitor = null;
+var currentIDCard = null;
+var currentRecord = null;
+var gameActive = true;
+var score = 0;
+var mistakes = 0;
+var maxMistakes = 3;
+var visitorCount = 0;
+// Resident database
+var residents = [{
+ name: 'John Smith',
+ apartment: 101,
+ hairColor: 0x654321,
+ eyeSpacing: 50,
+ noseSize: 1.0,
+ mouthWidth: 1.0
+}, {
+ name: 'Mary Johnson',
+ apartment: 102,
+ hairColor: 0x8B4513,
+ eyeSpacing: 45,
+ noseSize: 0.8,
+ mouthWidth: 1.2
+}, {
+ name: 'Bob Wilson',
+ apartment: 103,
+ hairColor: 0x2F4F4F,
+ eyeSpacing: 55,
+ noseSize: 1.3,
+ mouthWidth: 0.9
+}, {
+ name: 'Lisa Brown',
+ apartment: 201,
+ hairColor: 0xFFD700,
+ eyeSpacing: 48,
+ noseSize: 0.9,
+ mouthWidth: 1.1
+}, {
+ name: 'Mike Davis',
+ apartment: 202,
+ hairColor: 0x8B0000,
+ eyeSpacing: 52,
+ noseSize: 1.1,
+ mouthWidth: 0.8
+}];
+// Create background
+var background = game.addChild(LK.getAsset('background', {
+ anchorX: 0,
+ anchorY: 0,
+ x: 0,
+ y: 0
+}));
+// Create desk
+var desk = game.addChild(LK.getAsset('desk', {
+ anchorX: 0.5,
+ anchorY: 1.0,
+ x: 1024,
+ y: 2732
+}));
+// Create buttons
+var approveButton = game.addChild(LK.getAsset('approveButton', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: 700,
+ y: 2500
+}));
+var denyButton = game.addChild(LK.getAsset('denyButton', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: 1348,
+ y: 2500
+}));
+// Button labels
+var approveText = new Text2('APPROVE', {
+ size: 40,
+ fill: '#ffffff'
+});
+approveText.anchor.set(0.5, 0.5);
+approveText.x = 700;
+approveText.y = 2500;
+game.addChild(approveText);
+var denyText = new Text2('DENY', {
+ size: 40,
+ fill: '#ffffff'
+});
+denyText.anchor.set(0.5, 0.5);
+denyText.x = 1348;
+denyText.y = 2500;
+game.addChild(denyText);
+// Score display
+var scoreText = new Text2('Score: 0', {
+ size: 60,
+ fill: '#ffffff'
+});
+scoreText.anchor.set(0.5, 0);
+LK.gui.top.addChild(scoreText);
+// Mistakes display
+var mistakesText = new Text2('Mistakes: 0/3', {
+ size: 40,
+ fill: '#ff6b6b'
+});
+mistakesText.anchor.set(1, 0);
+mistakesText.x = 2048 - 50;
+mistakesText.y = 100;
+game.addChild(mistakesText);
+// Instructions
+var instructionText = new Text2('Compare the visitor to their ID and building records.\nLook for differences to catch doppelgangers!', {
+ size: 35,
+ fill: '#ecf0f1'
+});
+instructionText.anchor.set(0.5, 0);
+instructionText.x = 1024;
+instructionText.y = 150;
+game.addChild(instructionText);
+function getRandomResident() {
+ return residents[Math.floor(Math.random() * residents.length)];
+}
+function createDoppelgangerFeatures(originalFeatures) {
+ var features = {
+ hairColor: originalFeatures.hairColor,
+ eyeSpacing: originalFeatures.eyeSpacing,
+ noseSize: originalFeatures.noseSize,
+ mouthWidth: originalFeatures.mouthWidth
+ };
+ // Randomly alter one feature slightly
+ var changeType = Math.floor(Math.random() * 4);
+ switch (changeType) {
+ case 0:
+ // Hair color
+ var colors = [0x654321, 0x8B4513, 0x2F4F4F, 0xFFD700, 0x8B0000];
+ do {
+ features.hairColor = colors[Math.floor(Math.random() * colors.length)];
+ } while (features.hairColor === originalFeatures.hairColor);
+ break;
+ case 1:
+ // Eye spacing
+ features.eyeSpacing = originalFeatures.eyeSpacing + (Math.random() > 0.5 ? 8 : -8);
+ break;
+ case 2:
+ // Nose size
+ features.noseSize = originalFeatures.noseSize + (Math.random() > 0.5 ? 0.3 : -0.3);
+ break;
+ case 3:
+ // Mouth width
+ features.mouthWidth = originalFeatures.mouthWidth + (Math.random() > 0.5 ? 0.4 : -0.4);
+ break;
+ }
+ return features;
+}
+function spawnVisitor() {
+ if (!gameActive) return;
+ visitorCount++;
+ var resident = getRandomResident();
+ var isDoppelganger = Math.random() < 0.4; // 40% chance of doppelganger
+ // Create visitor
+ currentVisitor = game.addChild(new Visitor());
+ currentVisitor.x = 1024;
+ currentVisitor.y = 1800;
+ currentVisitor.name = resident.name;
+ currentVisitor.apartmentNumber = resident.apartment;
+ currentVisitor.isDoppelganger = isDoppelganger;
+ var visitorFeatures = isDoppelganger ? createDoppelgangerFeatures(resident) : resident;
+ currentVisitor.setFeatures(visitorFeatures);
+ // Create ID card (always shows original resident info)
+ currentIDCard = game.addChild(new IDCard());
+ currentIDCard.x = 400;
+ currentIDCard.y = 2300;
+ currentIDCard.setInfo(resident.name, resident.apartment, resident);
+ // Create building record (always shows correct resident info)
+ currentRecord = game.addChild(new RecordCard());
+ currentRecord.x = 1648;
+ currentRecord.y = 2300;
+ currentRecord.setInfo(resident.name, resident.apartment, resident);
+ // Animate visitor entrance
+ currentVisitor.y = 1200;
+ tween(currentVisitor, {
+ y: 1800
+ }, {
+ duration: 1000
+ });
+ LK.getSound('doorbell').play();
+}
+function handleDecision(approved) {
+ if (!gameActive || !currentVisitor) return;
+ var correct = approved && !currentVisitor.isDoppelganger || !approved && currentVisitor.isDoppelganger;
+ if (correct) {
+ score += 10;
+ LK.setScore(score);
+ scoreText.setText('Score: ' + score);
+ LK.getSound('correct').play();
+ if (currentVisitor.isDoppelganger) {
+ LK.effects.flashObject(currentVisitor, 0xff0000, 500);
+ } else {
+ LK.effects.flashObject(currentVisitor, 0x00ff00, 500);
+ }
+ } else {
+ mistakes++;
+ mistakesText.setText('Mistakes: ' + mistakes + '/' + maxMistakes);
+ LK.getSound('wrong').play();
+ LK.effects.flashScreen(0xff0000, 300);
+ if (mistakes >= maxMistakes) {
+ gameActive = false;
+ LK.setTimeout(function () {
+ LK.showGameOver();
+ }, 1000);
+ return;
+ }
+ }
+ // Remove current visitor and cards
+ tween(currentVisitor, {
+ y: 1200
+ }, {
+ duration: 800,
+ onFinish: function onFinish() {
+ currentVisitor.destroy();
+ currentIDCard.destroy();
+ currentRecord.destroy();
+ currentVisitor = null;
+ currentIDCard = null;
+ currentRecord = null;
+ // Spawn next visitor after a short delay
+ LK.setTimeout(spawnVisitor, 1500);
+ }
+ });
+ // Check win condition
+ if (score >= 100) {
+ gameActive = false;
+ LK.setTimeout(function () {
+ LK.showYouWin();
+ }, 1000);
+ }
+}
+// Button event handlers
+approveButton.down = function (x, y, obj) {
+ if (gameActive && currentVisitor) {
+ LK.effects.flashObject(approveButton, 0xffffff, 200);
+ handleDecision(true);
+ }
+};
+denyButton.down = function (x, y, obj) {
+ if (gameActive && currentVisitor) {
+ LK.effects.flashObject(denyButton, 0xffffff, 200);
+ handleDecision(false);
+ }
+};
+// Start the game
+LK.setTimeout(spawnVisitor, 2000);
+game.update = function () {
+ // Game loop - update score display
+ scoreText.setText('Score: ' + LK.getScore());
+};
\ No newline at end of file