/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var ActionButton = Container.expand(function (text, action) { var self = Container.call(this); var buttonBg = self.attachAsset('actionButton', { anchorX: 0.5, anchorY: 0.5 }); var buttonText = new Text2(text, { size: 36, fill: 0xFFFFFF }); buttonText.anchor.set(0.5, 0.5); self.addChild(buttonText); self.action = action; self.down = function (x, y, obj) { if (self.action) { self.action(); LK.getSound('click').play(); } }; return self; }); var ArrowButton = Container.expand(function (direction, onPress) { var self = Container.call(this); var arrow = self.attachAsset('actionButton', { anchorX: 0.5, anchorY: 0.5 }); var arrowText = new Text2(direction, { size: 36, fill: 0xFFFFFF }); arrowText.anchor.set(0.5, 0.5); self.addChild(arrowText); self.down = function () { if (onPress) { self.holdInterval = LK.setInterval(onPress, 50); // Further increase speed by calling onPress every 50ms } }; self.up = function () { if (self.holdInterval) { LK.clearInterval(self.holdInterval); self.holdInterval = null; } }; return self; }); var Character = Container.expand(function (name, disorder, initialSanity, triggers, calmers) { var self = Container.call(this); self.name = name; self.disorder = disorder; self.maxSanity = 100; self.sanity = initialSanity || 100; self.triggers = triggers || []; self.calmers = calmers || []; self.lastInteractionDay = 0; self.isDangerous = false; var cardAssetName = 'characterCard' + name; var cardBg = self.attachAsset(cardAssetName, { anchorX: 0.5, anchorY: 0.5 }); var nameText = new Text2(self.name, { size: 48, fill: 0xFFFF00 }); nameText.anchor.set(0.5, 0); nameText.x = 0; nameText.y = -120; self.addChild(nameText); // Disorder text removed - players must discover disorders through interaction var sanityBg = self.attachAsset('sanityBarBg', { anchorX: 0.5, anchorY: 0.5, x: 0, y: 60 }); var sanityBar = self.attachAsset('sanityBar', { anchorX: 0, anchorY: 0.5, x: -100, y: 60 }); var sanityText = new Text2(self.sanity + "/100", { size: 42, fill: 0xFFFFFF }); sanityText.anchor.set(0.5, 0.5); sanityText.x = 0; sanityText.y = 85; self.addChild(sanityText); self.updateSanity = function (amount) { if (self.isImpostor) { // Impostor maintains fake sanity levels but acts more subtly self.sanity = Math.max(30, Math.min(100, self.sanity + Math.floor(amount * 0.5))); // Reduced impact // Impostor never goes below 30 to avoid being too obvious } else { self.sanity = Math.max(0, Math.min(100, self.sanity + amount)); } var sanityPercent = self.sanity / self.maxSanity; sanityBar.width = 200 * sanityPercent; if (sanityPercent > 0.6) { sanityBar.tint = 0x228b22; } else if (sanityPercent > 0.3) { sanityBar.tint = 0xffa500; } else { sanityBar.tint = 0xff0000; } sanityText.setText(self.sanity + "/100"); // Check if sanity has reached zero if (self.sanity === 0) { // Trigger self-destruction and game over LK.getSound('crash').play(); LK.getSound('scream').play(); LK.getSound('686184b09666db472fa4477a').play(); showEnding("BAD", self.name + " completely lost their mental health and harmed themselves. The situation became uncontrollable."); } // Check for very low sanity (below 20) and play warning sound if (self.sanity < 20 && (self.lastSanityWarning === undefined || self.lastSanityWarning >= 20)) { LK.getSound('lowSanityWarning').play(); self.lastSanityWarning = self.sanity; } // Check for laughing sound trigger (30 or below) if (self.sanity <= 30 && (self.lastLaughingTrigger === undefined || self.lastLaughingTrigger > 30)) { LK.getSound('lowSanityLaughing').play(); self.lastLaughingTrigger = self.sanity; } // Check for aggressive state (below 30) if (self.sanity < 30 && !self.isDangerous) { self.isDangerous = true; self.isAggressive = true; LK.getSound('warning').play(); LK.getSound('scream').play(); cardBg.tint = 0x8b0000; // Dark red for aggressive } else if (self.sanity >= 30 && self.isDangerous) { self.isDangerous = false; self.isAggressive = false; cardBg.tint = 0xffffff; } // Check for helpful state (above 90) if (self.sanity > 90) { self.isHelpful = true; cardBg.tint = 0x00ff00; // Green for helpful } else { self.isHelpful = false; } }; self.clickCount = 0; self.lastClickTime = 0; self.down = function (x, y, obj) { if (currentGameState === "playing" && timeLeft > 0) { var currentTime = LK.ticks; // Check for impostor accusation (3 quick clicks) if (currentTime - self.lastClickTime < 60) { // Within 1 second suspicionClicks[self.name]++; if (suspicionClicks[self.name] >= 3) { // Player is accusing this character of being the impostor if (self.isImpostor) { // Correct accusation! Mark impostor as found but continue game impostorFound = true; impostorFoundDay = currentDay; dialogueBox.showDialogue("CORRECT! " + self.name + " was indeed the impostor! Their identity is now revealed, but you need to survive 20 days!", 4000); // Remove impostor abilities and make them act normally self.isImpostor = false; self.sanity = self.realSanity || 100; } else { // Wrong accusation! LK.getSound('horror').play(); LK.getSound('scream').play(); showEnding("YOU LOST", "Wrong choice! " + self.name + " was really mentally ill. Since you couldn't find the impostor, you were destroyed in the meat grinder. Game over!"); } return; } dialogueBox.showDialogue(suspicionClicks[self.name] + "/3 - You're suspicious of " + self.name + "...", 2000); } else { suspicionClicks[self.name] = 1; dialogueBox.showDialogue("1/3 - You're starting to suspect " + self.name + "...", 2000); } self.lastClickTime = currentTime; selectedCharacter = self; // Show tutorial hint for first character interaction if (tutorialActive && tutorialStep >= 8) { dialogueBox.showDialogue("Perfect! Now select an action. Pay attention to the mental health bar.", 3000); } showCharacterActions(); LK.getSound('click').play(); } }; return self; }); var DialogueBox = Container.expand(function () { var self = Container.call(this); var dialogueBg = self.attachAsset('dialogueBox', { anchorX: 0.5, anchorY: 0.5 }); var dialogueText = new Text2("", { size: 48, fill: 0x000000 }); dialogueText.anchor.set(0.5, 0.5); self.addChild(dialogueText); self.showDialogue = function (text, duration) { // Clear any existing skip buttons first var existingButtons = self.children.filter(function (child) { return child instanceof ActionButton; }); for (var i = 0; i < existingButtons.length; i++) { existingButtons[i].destroy(); } dialogueText.setText(text); self.visible = true; // Add skip button var skipButton = new ActionButton("Skip", function () { self.visible = false; skipButton.destroy(); }); skipButton.x = 0; skipButton.y = 200; self.addChild(skipButton); // Removed automatic timeout to keep dialogue on screen until skip button is pressed }; self.visible = false; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x2d1810 }); /**** * Game Code ****/ // Game State Variables - Reset for new game var currentDay = 1; var timeLeft = 100; var maxTimePerDay = 100; var currentGameState = "playing"; // playing, gameOver, victory var selectedCharacter = null; var actionMenuVisible = false; var discoveredDisorders = {}; var knowledgeBookVisible = false; var diagnosisAttempts = {}; // Impostor system variables - Reset with new random impostor var impostorIndex; // Will be set after charactersData is defined var suspicionClicks = {}; var gameObjective = "impostor"; // New objective: find the impostor var impostorFound = false; // Track if impostor has been correctly identified var impostorFoundDay = 0; // Track which day impostor was found // Impostor dialogue arrays var impostorPositiveDialogues = ["Talking to you... feels good to me. I think I can trust you.", "This house is a bit strange but... I'm used to it. I adapt to the environment quickly.", "If I were you, I would be more careful... but you're making good progress.", "Nothing easily shakes me. I like composure.", "Everyone here has a weakness. But you seem more resilient.", "Spending time with you... is more enjoyable than I thought.", "Everyone seems confused about me. I think this is fun.", "There are many people here with problems. But we're fine, aren't we?", "I usually control myself very well. In every situation.", "One of them will break. But you will endure. You must endure."]; var impostorNegativeDialogues = ["You protect them... but they won't protect you. Remember this.", "When night comes, everyone's eyes shine. Why are yours so calm?", "Only one will leave this house in the end. It's that simple.", "I don't break. But watching those who are broken... is enjoyable.", "I've seen many who think like you. They usually can't pass the 15th day.", "Don't you really wonder why I'm here?", "I have no past. Maybe that's why I look at the future so comfortably.", "Predicting who will fall when is child's play for me.", "Do you think which one of us will give up first? I already know the answer.", "You trust me, don't you? This might be your biggest mistake."]; // Chaos Background Variables var chaosParticles = []; var chaosIntensity = 1.0; var backgroundFlickerTimer = 0; var chaosNoiseElements = []; // Disorder Information var disorderInfo = { "Paranoid Disorder": "Constant suspicion and distrust. Belief that others will harm them. Avoiding eye contact, preferring to be alone.", "Schizophrenia": "Loss of connection with reality, hearing voices, hallucinations. Likes to speak softly, music soothes them.", "Bipolar Disorder": "Alternating between extremely happy (manic) and extremely sad (depressive) periods. Mood changes can be sudden.", "OCD": "Obsessive thoughts and compulsive behaviors. Cleanliness, order and symmetry obsession. Disruption of routines causes panic.", "Dissociative Identity Disorder": "Multiple personality. Taking on different personalities at different times. Can display gentle, childish or dark personalities.", "Anxiety Disorder": "Excessive worry and fear. Panic attacks, shortness of breath. Avoiding uncertainty and changes. Calming with quiet environment and routine." }; // Characters Data var charactersData = [{ name: "Kemal", disorder: "Bipolar Disorder", sanity: 85, triggers: ["criticism", "restrictions", "boredom", "artwork moved"], calmers: ["activities", "praise", "routine", "engagement"], personality: "bipolar", currentMood: "normal", // can be: manic, depressive, normal lastAction: "", sameActionCount: 0 }, { name: "Yusuf", disorder: "Paranoid Disorder", sanity: 80, triggers: ["sudden movements", "being watched", "loud noises", "eye contact"], calmers: ["honesty", "being left alone", "quiet environment", "trust building"], personality: "paranoid", currentMood: "suspicious", lastAction: "", sameActionCount: 0 }, { name: "Zeynep", disorder: "OCD", sanity: 90, triggers: ["disorder", "asymmetry", "dirty objects", "interrupted rituals"], calmers: ["organization", "cleaning together", "respecting routines", "symmetry"], personality: "ocd", currentMood: "anxious", lastAction: "", sameActionCount: 0 }, { name: "Mehmet", disorder: "Dissociative Identity Disorder", sanity: 75, triggers: ["trauma reminders", "stress", "dark personality emergence"], calmers: ["personality-appropriate response", "safe spaces", "gentle approach"], personality: "did", currentMood: "gentle", // can be: gentle, child, dark timeOfLastChange: 0, lastAction: "", sameActionCount: 0 }, { name: "Elif", disorder: "Schizophrenia", sanity: 70, triggers: ["confrontation", "judgment", "disbelief"], calmers: ["listening", "music", "soft voice", "validation"], personality: "schizophrenic", currentMood: "hearing_voices", lastAction: "", sameActionCount: 0 }, { name: "Ege", disorder: "Anxiety Disorder", sanity: 78, triggers: ["loud noises", "sudden changes", "crowded spaces", "uncertainty"], calmers: ["calm environment", "routine", "reassurance", "breathing exercises"], personality: "anxious", currentMood: "worried", // can be: worried, panicked, calm lastAction: "", sameActionCount: 0 }]; // Set impostor index now that charactersData is defined impostorIndex = Math.floor(Math.random() * charactersData.length); // Create Characters var characters = []; for (var i = 0; i < charactersData.length; i++) { var data = charactersData[i]; var character = new Character(data.name, data.disorder, data.sanity, data.triggers, data.calmers); character.personality = data.personality; character.currentMood = data.currentMood; character.timeOfLastChange = data.timeOfLastChange || 0; character.isAggressive = false; character.isHelpful = false; character.lastAction = data.lastAction || ""; character.sameActionCount = data.sameActionCount || 0; // Mark impostor - this character is actually mentally healthy character.isImpostor = i === impostorIndex; if (character.isImpostor) { character.realSanity = 100; // Always mentally healthy character.fakePersonality = character.personality; // Remember fake personality } // Initialize suspicion clicks for each character suspicionClicks[character.name] = 0; // Reset impostor tracking variables for new game impostorFound = false; impostorFoundDay = 0; characters.push(character); game.addChild(character); } // Position Characters in Grid var startX = 400; var startY = 400; var spacingX = 400; var spacingY = 350; for (var i = 0; i < characters.length; i++) { var row = Math.floor(i / 3); var col = i % 3; characters[i].x = startX + col * spacingX; characters[i].y = startY + row * spacingY; } // Create Chaotic Background Elements - Horror Theme for (var i = 0; i < 30; i++) { var particle = game.attachAsset('chaosParticle', { anchorX: 0.5, anchorY: 0.5, x: Math.random() * 2048, y: Math.random() * 2732, alpha: 0.4 }); particle.speedX = (Math.random() - 0.5) * 4; particle.speedY = (Math.random() - 0.5) * 4; particle.rotationSpeed = (Math.random() - 0.5) * 0.1; // Horror color tints - dark reds, purples, grays particle.tint = [0x8b0000, 0x800080, 0x2f4f4f, 0x8b008b, 0x696969][Math.floor(Math.random() * 5)]; chaosParticles.push(particle); } for (var i = 0; i < 20; i++) { var circle = game.attachAsset('chaosCircle', { anchorX: 0.5, anchorY: 0.5, x: Math.random() * 2048, y: Math.random() * 2732, alpha: 0.3 }); circle.pulseSpeed = Math.random() * 0.05 + 0.02; circle.pulsePhase = Math.random() * Math.PI * 2; // Dark horror colors for circles circle.tint = [0x8b0000, 0x4b0082, 0x2f2f2f, 0x800000][Math.floor(Math.random() * 4)]; chaosParticles.push(circle); } for (var i = 0; i < 80; i++) { var noise = game.attachAsset('chaosNoise', { anchorX: 0.5, anchorY: 0.5, x: Math.random() * 2048, y: Math.random() * 2732, alpha: 0.15 }); noise.flickerSpeed = Math.random() * 0.3 + 0.1; // Dark, unsettling colors for noise noise.tint = [0x8b0000, 0x2f4f4f, 0x8b008b, 0x000000, 0x800080][Math.floor(Math.random() * 5)]; chaosNoiseElements.push(noise); } // Add creepy shadow elements for (var i = 0; i < 15; i++) { var shadow = game.attachAsset('chaosParticle', { anchorX: 0.5, anchorY: 0.5, x: Math.random() * 2048, y: Math.random() * 2732, alpha: 0.6, scaleX: 2 + Math.random() * 3, scaleY: 0.3 + Math.random() * 0.7 }); shadow.tint = 0x000000; // Pure black shadows shadow.speedX = (Math.random() - 0.5) * 1.5; shadow.speedY = (Math.random() - 0.5) * 1.5; shadow.fadeDirection = Math.random() > 0.5 ? 1 : -1; chaosParticles.push(shadow); } // UI Elements var dayPanel = game.attachAsset('dayPanel', { anchorX: 0.5, anchorY: 0, x: 1024, y: 50 }); var dayText = new Text2("Day " + currentDay + "/20", { size: 54, fill: 0xFFFFFF }); dayText.anchor.set(0.5, 0.5); dayText.x = 1024; dayText.y = 110; game.addChild(dayText); var timeText = new Text2("Time: " + timeLeft, { size: 42, fill: 0xFFFFFF }); timeText.anchor.set(0.5, 0.5); timeText.x = 1024; timeText.y = 150; game.addChild(timeText); // Action Buttons var actionButtons = []; var actionButtonsContainer = new Container(); actionButtonsContainer.x = 1024; actionButtonsContainer.y = 1800; actionButtonsContainer.visible = false; game.addChild(actionButtonsContainer); // Dialogue System var dialogueBox = new DialogueBox(); dialogueBox.x = 1024; dialogueBox.y = 1366; // Center vertically on screen game.addChild(dialogueBox); // Action Definitions var actions = [{ text: "Empathetic Talk", cost: 15, effect: function effect(character) { var response = getCharacterResponse(character, "empathetic_talk"); character.updateSanity(response.sanityChange); dialogueBox.showDialogue(response.dialogue, 3000); } }, { text: "Art Therapy", cost: 25, effect: function effect(character) { var response = getCharacterResponse(character, "art_therapy"); character.updateSanity(response.sanityChange); dialogueBox.showDialogue(response.dialogue, 3000); } }, { text: "Read Together", cost: 20, effect: function effect(character) { var response = getCharacterResponse(character, "read_together"); character.updateSanity(response.sanityChange); dialogueBox.showDialogue(response.dialogue, 3000); } }, { text: "Organize/Clean", cost: 30, effect: function effect(character) { var response = getCharacterResponse(character, "organize"); character.updateSanity(response.sanityChange); dialogueBox.showDialogue(response.dialogue, 3000); } }, { text: "Give Space", cost: 50, effect: function effect(character) { var response = getCharacterResponse(character, "give_space"); character.updateSanity(response.sanityChange); dialogueBox.showDialogue(response.dialogue, 3000); } }]; function getCharacterResponse(character, actionType) { if (character.isAggressive) { // Aggressive characters now engage in verbal conflicts instead of physical fights var aggressiveDialogues = [character.name + ": 'I'm sick of your advice! You always say the same things!'", character.name + ": 'You don't understand me! Nobody understands anyway!'", character.name + ": 'Enough already! Leave me alone, stop following me around!'", character.name + ": 'You're just like the others, you're just trying to control me!'", character.name + ": 'What you're doing makes no sense! You're wasting your time!'"]; return { sanityChange: -10, dialogue: aggressiveDialogues[Math.floor(Math.random() * aggressiveDialogues.length)] }; } if (character.isHelpful) { return { sanityChange: 5, dialogue: character.name + " is in a great mood and appreciates your effort. They're even helping others!" }; } // Character-specific responses based on personality and mood if (character.personality === "paranoid") { if (Math.random() < 0.1) { return { sanityChange: 5, dialogue: "Yusuf: 'I feel a bit safer with you around… this is rare.'" }; } else if (Math.random() < 0.2) { return { sanityChange: 5, dialogue: "Yusuf: 'Maybe not everyone is an enemy… if there's someone like you.'" }; } else if (Math.random() < 0.3) { return { sanityChange: 5, dialogue: "Yusuf: 'No one watched me today. Maybe it's because of you.'" }; } else if (Math.random() < 0.4) { return { sanityChange: 5, dialogue: "Yusuf: 'I slept peacefully last night. I think the voices decreased.'" }; } else if (Math.random() < 0.5) { return { sanityChange: 5, dialogue: "Yusuf: 'What you said… made me think. Thank you.'" }; } else if (Math.random() < 0.6) { return { sanityChange: 5, dialogue: "Yusuf: 'I'll tell you a secret. Because I'm starting to trust.'" }; } else if (Math.random() < 0.7) { return { sanityChange: 5, dialogue: "Yusuf: 'For the first time in this house, silence brought peace.'" }; } else if (Math.random() < 0.8) { return { sanityChange: 5, dialogue: "Yusuf: 'For not leaving me alone today… I'm grateful.'" }; } else if (Math.random() < 0.9) { return { sanityChange: 5, dialogue: "Yusuf: 'I can look out the window now. I'm not afraid.'" }; } else { return { sanityChange: 5, dialogue: "Yusuf: 'Maybe… we can leave this house together.'" }; } if (Math.random() < 0.1) { return { sanityChange: -5, dialogue: "Yusuf: 'There's something inside the wall… can you feel the vibration?'" }; } else if (Math.random() < 0.2) { return { sanityChange: -5, dialogue: "Yusuf: 'Someone was behind the door just now. Didn't you blink?'" }; } else if (Math.random() < 0.3) { return { sanityChange: -5, dialogue: "Yusuf: 'Don't trust anyone. Especially at night.'" }; } else if (Math.random() < 0.4) { return { sanityChange: -5, dialogue: "Yusuf: 'Who enters your room at night?'" }; } else if (Math.random() < 0.5) { return { sanityChange: -5, dialogue: "Yusuf: 'I'm starting to trust you… but this could be a trap too.'" }; } else if (Math.random() < 0.6) { return { sanityChange: -5, dialogue: "Yusuf: 'I turned off the cameras but I'm still being watched.'" }; } else if (Math.random() < 0.7) { return { sanityChange: -5, dialogue: "Yusuf: 'I'll ask you something… be honest. You're a test subject too, aren't you?'" }; } else if (Math.random() < 0.8) { return { sanityChange: -5, dialogue: "Yusuf: 'Radio waves are behind everything. They're doing mind control.'" }; } else if (Math.random() < 0.9) { return { sanityChange: -5, dialogue: "Yusuf: 'Someone came to my room last night. Had a shadow but no footsteps.'" }; } else { return { sanityChange: -5, dialogue: "Yusuf: 'I don't have glasses but the mask on your face hasn't fallen yet.'" }; } if (actionType === "empathetic_talk") { return Math.random() > 0.5 ? { sanityChange: 10, dialogue: "Yusuf: 'You seem honest... maybe I can trust you a little.'" } : { sanityChange: -5, dialogue: "Yusuf: 'You're just like them, trying to get information from me!'" }; } else if (actionType === "give_space") { return { sanityChange: 8, dialogue: "Yusuf: 'Thanks for leaving me alone. I need to think.'" }; } else { return { sanityChange: -3, dialogue: "Yusuf: 'Stop trying to control me! I know what you're doing.'" }; } } else if (character.personality === "schizophrenic") { if (Math.random() < 0.1) { return { sanityChange: 5, dialogue: "The voices are quieter. I think talking to you helps.'" }; } else if (Math.random() < 0.2) { return { sanityChange: 5, dialogue: "Elif: 'I feel less alone when you're here..'" }; } else if (Math.random() < 0.3) { return { sanityChange: 5, dialogue: "Elif: 'Your voice is different from the others. Clear and calm..'" }; } else if (Math.random() < 0.4) { return { sanityChange: 5, dialogue: "Elif: 'The wall was silent today… a beautiful silence..'" }; } else if (Math.random() < 0.5) { return { sanityChange: 5, dialogue: "Elif: 'If this is real, then you're real. That’s good.'" }; } else if (Math.random() < 0.6) { return { sanityChange: 5, dialogue: "Elif: 'You believing me calms me down.'" }; } else if (Math.random() < 0.7) { return { sanityChange: 5, dialogue: "Elif: 'I painted a picture. I imagined you choosing the colors with me.'" }; } else if (Math.random() < 0.8) { return { sanityChange: 5, dialogue: "Elif: 'or the first time, I feel like myself'" }; } else if (Math.random() < 0.9) { return { sanityChange: 5, dialogue: "Elif: 'They only whisper now. Maybe they’ll stop completely soon..'" }; } else { return { sanityChange: 5, dialogue: "Elif: 'I trust you. That doesn’t happen often..'" }; } if (Math.random() < 0.1) { return { sanityChange: 5, dialogue: "Elif: 'The voices are quieter. I think talking to you helps.'" }; } else if (Math.random() < 0.2) { return { sanityChange: 5, dialogue: "Elif: 'I feel less alone when you're here.'" }; } else if (Math.random() < 0.3) { return { sanityChange: 5, dialogue: "Elif: 'Your voice is different from the others. Clear and calm.'" }; } else if (Math.random() < 0.4) { return { sanityChange: 5, dialogue: "Elif: 'The wall was silent today… a beautiful silence.'" }; } else if (Math.random() < 0.5) { return { sanityChange: 5, dialogue: "Elif: 'If this is real, then you're real. That's good.'" }; } else if (Math.random() < 0.6) { return { sanityChange: 5, dialogue: "Elif: 'You believing me calms me down.'" }; } else if (Math.random() < 0.7) { return { sanityChange: 5, dialogue: "Elif: 'I painted a picture. I imagined you choosing the colors with me.'" }; } else if (Math.random() < 0.8) { return { sanityChange: 5, dialogue: "Elif: 'For the first time, I feel like myself.'" }; } else if (Math.random() < 0.9) { return { sanityChange: 5, dialogue: "Elif: 'They only whisper now. Maybe they'll stop completely soon.'" }; } else { return { sanityChange: 5, dialogue: "Elif: 'I trust you. That doesn't happen often.'" }; } if (actionType === "empathetic_talk") { return { sanityChange: 15, dialogue: "Elif: 'Seslere inandın mı? Beni dinlediğin için teşekkürler.'" }; } else if (actionType === "art_therapy") { return { sanityChange: 12, dialogue: "Elif: 'Müzik sesleri daha sessiz yapıyor. Bu çok yardımcı oluyor.'" }; } else { return { sanityChange: -8, dialogue: "Elif: 'Sesler daha yüksek oluyor! Yaptığın şeyi sevmiyorlar!'" }; } } else if (character.personality === "bipolar") { if (Math.random() < 0.1) { return { sanityChange: 5, dialogue: "Kemal: 'My emotions feel balanced today. Talking to you helped.'" }; } else if (Math.random() < 0.2) { return { sanityChange: 5, dialogue: "Kemal: 'Smiling hasn't been this easy in a long time.'" }; } else if (Math.random() < 0.3) { return { sanityChange: 5, dialogue: "Kemal: 'The little things we do together keep me alive.'" }; } else if (Math.random() < 0.4) { return { sanityChange: 5, dialogue: "Kemal: 'My energy is high, but this time it doesn't scare me.'" }; } else if (Math.random() < 0.5) { return { sanityChange: 5, dialogue: "Kemal: 'Even my lows don't crush me when you're around.'" }; } else if (Math.random() < 0.6) { return { sanityChange: 5, dialogue: "Kemal: 'Sometimes a simple conversation is the meaning of life.'" }; } else if (Math.random() < 0.7) { return { sanityChange: 5, dialogue: "Kemal: 'Your eyes calm the storm inside me.'" }; } else if (Math.random() < 0.8) { return { sanityChange: 5, dialogue: "Kemal: 'Time moves differently with you here. I'm not alone.'" }; } else if (Math.random() < 0.9) { return { sanityChange: 5, dialogue: "Kemal: 'I'm trying to make peace with myself… starting with you.'" }; } else { return { sanityChange: 5, dialogue: "Kemal: 'I hope you'll be there when we finally leave this place.'" }; } if (Math.random() < 0.1) { return { sanityChange: -5, dialogue: "Kemal: 'Come on! Let's dance! Why are you still standing?!'" }; } else if (Math.random() < 0.2) { return { sanityChange: -5, dialogue: "Kemal: 'Nothing matters. Why are we even trying?'" }; } else if (Math.random() < 0.3) { return { sanityChange: -5, dialogue: "Kemal: 'I painted something new! Should we cover all the walls with it?'" }; } else if (Math.random() < 0.4) { return { sanityChange: -5, dialogue: "Kemal: 'I really love you today. That might change tomorrow, but right now it matters.'" }; } else if (Math.random() < 0.5) { return { sanityChange: -5, dialogue: "Kemal: 'This house is boring. What if we knock down a wall?'" }; } else if (Math.random() < 0.6) { return { sanityChange: -5, dialogue: "Kemal: 'I hate you. But don't take it seriously. It'll pass.'" }; } else if (Math.random() < 0.7) { return { sanityChange: -5, dialogue: "Kemal: 'Nobody understands me. Not even you. Especially you.'" }; } else if (Math.random() < 0.8) { return { sanityChange: -5, dialogue: "Kemal: 'I'm so high right now. I don't want to fall.'" }; } else if (Math.random() < 0.9) { return { sanityChange: -5, dialogue: "Kemal: 'If we're going to die, let's do it with a beautiful chord.'" }; } else { return { sanityChange: -5, dialogue: "Kemal: 'Don't forget me, okay? I sometimes forget myself.'" }; } if (character.currentMood === "manic") { if (actionType === "empathetic_talk") { return { sanityChange: -5, dialogue: "Kemal: 'Konuşmak sıkıcı! Hadi tüm duvarları boyayalım ve dans edelim!'" }; } else if (actionType === "art_therapy") { return { sanityChange: 10, dialogue: "Kemal: 'EVET! Bu mükemmel! Harika bir şey yaratalım!'" }; } else { return { sanityChange: -10, dialogue: "Kemal: 'Beni yavaşlatmaya çalışıyorsun! Her şey için enerjim var!'" }; } } else if (character.currentMood === "depressive") { if (actionType === "empathetic_talk") { return { sanityChange: 12, dialogue: "Kemal: 'Umursayan birinin olması iyi hissettiriyor... belki bugün o kadar karanlık olmaz.'" }; } else { return { sanityChange: 2, dialogue: "Kemal: 'Artık hiçbir şeyin anlamı yok... ama denediğin için teşekkürler.'" }; } } else { return { sanityChange: 6, dialogue: "Kemal: 'Çabanı takdir ediyorum. Bugün daha dengeli hissediyorum.'" }; } } else if (character.personality === "ocd") { if (Math.random() < 0.1) { return { sanityChange: 5, dialogue: "Zeynep: 'Today everything was almost perfect… and that was enough.'" }; } else if (Math.random() < 0.2) { return { sanityChange: 5, dialogue: "Zeynep: 'You helping me really put my mind at ease.'" }; } else if (Math.random() < 0.3) { return { sanityChange: 5, dialogue: "Zeynep: 'Organizing the room with you helped me feel better.'" }; } else if (Math.random() < 0.4) { return { sanityChange: 5, dialogue: "Zeynep: 'My thoughts are still fast, but not scary.'" }; } else if (Math.random() < 0.5) { return { sanityChange: 5, dialogue: "Zeynep: 'With you, I can accept things I can't control.'" }; } else if (Math.random() < 0.6) { return { sanityChange: 5, dialogue: "Zeynep: 'My hands still tremble, but I don't feel alone.'" }; } else if (Math.random() < 0.7) { return { sanityChange: 5, dialogue: "Zeynep: 'You're like my routine… reliable.'" }; } else if (Math.random() < 0.8) { return { sanityChange: 5, dialogue: "Zeynep: 'Sharing things feels like setting everything in order.'" }; } else if (Math.random() < 0.9) { return { sanityChange: 5, dialogue: "Zeynep: 'No breakdown today. Maybe it's because of you.'" }; } else { return { sanityChange: 5, dialogue: "Zeynep: 'I feel valuable, even without being perfect.'" }; } if (Math.random() < 0.1) { return { sanityChange: -5, dialogue: "Zeynep: 'Did you fold the pillowcase symmetrically? Are you sure?'" }; } else if (Math.random() < 0.2) { return { sanityChange: -5, dialogue: "Zeynep: 'I washed my hands 11 times this morning. Still feels dirty.'" }; } else if (Math.random() < 0.3) { return { sanityChange: -5, dialogue: "Zeynep: 'Everything needs its place. You… don't seem to have one.'" }; } else if (Math.random() < 0.4) { return { sanityChange: -5, dialogue: "Zeynep: 'If I don't spin this pen three times… someone might die.'" }; } else if (Math.random() < 0.5) { return { sanityChange: -5, dialogue: "Zeynep: 'Did you clean your shoes before stepping in?'" }; } else if (Math.random() < 0.6) { return { sanityChange: -5, dialogue: "Zeynep: 'Symmetry is divine order. Chaos breaks the soul.'" }; } else if (Math.random() < 0.7) { return { sanityChange: -5, dialogue: "Zeynep: 'That picture is crooked. If I leave, something bad will happen.'" }; } else if (Math.random() < 0.8) { return { sanityChange: -5, dialogue: "Zeynep: 'A voice tells me not to walk unless I take seven steps.'" }; } else if (Math.random() < 0.9) { return { sanityChange: -5, dialogue: "Zeynep: 'Dust... there's dust everywhere. Don't you see it?!'" }; } else { return { sanityChange: -5, dialogue: "Zeynep: 'Can you check... did you lock the door five times? Are you sure?'" }; } if (actionType === "organize") { return { sanityChange: 20, dialogue: "Zeynep: 'Mükemmel! Artık her şey yerli yerinde. Çok daha iyi hissediyorum!'" }; } else if (actionType === "empathetic_talk") { return { sanityChange: 5, dialogue: "Zeynep: 'Düzen ihtiyacımı anladığın için teşekkürler.'" }; } else { return { sanityChange: -8, dialogue: "Zeynep: 'Hayır, hayır! Her şeyi dağınık yapıyorsun! Düzen yanlış!'" }; } } else if (character.personality === "anxious") { if (Math.random() < 0.1) { return { sanityChange: 5, dialogue: "Ege: 'Talking to you calms me down... my worries are decreasing.'" }; } else if (Math.random() < 0.2) { return { sanityChange: 5, dialogue: "Ege: 'I think I can sleep with less anxiety tonight.'" }; } else if (Math.random() < 0.3) { return { sanityChange: 5, dialogue: "Ege: 'I forgot to breathe... you reminded me.'" }; } else if (Math.random() < 0.4) { return { sanityChange: 5, dialogue: "Ege: 'I don't panic when I'm with you. This is very nice.'" }; } else { return { sanityChange: 5, dialogue: "Ege: 'Now I can think that not everything will go wrong.'" }; } if (Math.random() < 0.1) { return { sanityChange: -5, dialogue: "Ege: 'What if something happens now? What if this house collapses?'" }; } else if (Math.random() < 0.2) { return { sanityChange: -5, dialogue: "Ege: 'My heart is beating too fast... I can't breathe.'" }; } else if (Math.random() < 0.3) { return { sanityChange: -5, dialogue: "Ege: 'I can't stop my worries... I keep thinking bad things.'" }; } else if (Math.random() < 0.4) { return { sanityChange: -5, dialogue: "Ege: 'We can't get out of here, can we? We'll stay here forever.'" }; } else { return { sanityChange: -5, dialogue: "Ege: 'Everything is going wrong... nothing is going as planned.'" }; } if (actionType === "empathetic_talk") { return { sanityChange: 12, dialogue: "Ege: 'Thank you for being so patient with me... this makes me feel much better.'" }; } else if (actionType === "give_space") { return { sanityChange: 8, dialogue: "Ege: 'I needed to be alone for a while... thank you.'" }; } else { return { sanityChange: -5, dialogue: "Ege: 'This makes me even more anxious... please approach slowly.'" }; } } else if (character.personality === "did") { if (character.currentMood === "gentle") { if (Math.random() < 0.1) { return { sanityChange: 5, dialogue: "Mehmet: 'Talking to you quiets the noise in my head.'" }; } else if (Math.random() < 0.2) { return { sanityChange: 5, dialogue: "Mehmet: 'I forgot I could connect with someone. You reminded me.'" }; } else if (Math.random() < 0.3) { return { sanityChange: 5, dialogue: "Mehmet: 'I want to play chess with you because you care.'" }; } else if (Math.random() < 0.4) { return { sanityChange: 5, dialogue: "Mehmet: 'If someone like you exists… maybe the war inside can end.'" }; } else { return { sanityChange: 5, dialogue: "Mehmet: 'Being kind isn't just a mask. With you, it feels real.'" }; } } else if (character.currentMood === "child") { if (Math.random() < 0.1) { return { sanityChange: 5, dialogue: "Mehmet (Child): 'I'm so happy today! Playing with you was fun!'" }; } else if (Math.random() < 0.2) { return { sanityChange: 5, dialogue: "Mehmet (Child): 'You gave me cake! That's my favorite!'" }; } else if (Math.random() < 0.3) { return { sanityChange: 5, dialogue: "Mehmet (Child): 'I'm not a bad person. You showed me that.'" }; } else if (Math.random() < 0.4) { return { sanityChange: 5, dialogue: "Mehmet (Child): 'I wish you were my big brother.'" }; } else { return { sanityChange: 5, dialogue: "Mehmet (Child): 'I'm not scared anymore… because you're here.'" }; } } else { // dark mood if (Math.random() < 0.1) { return { sanityChange: 5, dialogue: "Mehmet (Dark): 'When I talk to you, the darkness sometimes goes quiet.'" }; } else if (Math.random() < 0.2) { return { sanityChange: 5, dialogue: "Mehmet (Dark): 'Your words… even the others inside are listening.'" }; } else if (Math.random() < 0.3) { return { sanityChange: 5, dialogue: "Mehmet (Dark): 'I used to want to be alone… but not with you.'" }; } else if (Math.random() < 0.4) { return { sanityChange: 5, dialogue: "Mehmet (Dark): 'I felt light inside for the first time. Short, but real.'" }; } else { return { sanityChange: 5, dialogue: "Mehmet (Dark): 'I don't want to be afraid anymore. Maybe… you can help.'" }; } } if (character.currentMood === "gentle") { if (Math.random() < 0.1) { return { sanityChange: 5, dialogue: "Mehmet: 'What this house lacks is art. Maybe we can fix that together.'" }; } else if (Math.random() < 0.2) { return { sanityChange: 5, dialogue: "Mehmet: 'Empty shelves bother me. It's disrespectful to the works.'" }; } else if (Math.random() < 0.3) { return { sanityChange: 5, dialogue: "Mehmet: 'I'd rather hear your voice than the one in my mind.'" }; } else if (Math.random() < 0.4) { return { sanityChange: 5, dialogue: "Mehmet: 'I'd love to play chess with you. Let our minds compete.'" }; } else { return { sanityChange: 5, dialogue: "Mehmet: 'A cup of tea makes all darkness lighter.'" }; } } else if (character.currentMood === "child") { if (Math.random() < 0.1) { return { sanityChange: 5, dialogue: "Mehmet (Child): 'I hid! Did you count? I don't think you did!'" }; } else if (Math.random() < 0.2) { return { sanityChange: 5, dialogue: "Mehmet (Child): 'My teddy is gone. Did you see it?'" }; } else if (Math.random() < 0.3) { return { sanityChange: 5, dialogue: "Mehmet (Child): 'Will you tell me a story tonight?'" }; } else if (Math.random() < 0.4) { return { sanityChange: 5, dialogue: "Mehmet (Child): 'Pillow fight time!'" }; } else { return { sanityChange: 5, dialogue: "Mehmet (Child): 'I miss my mom… can you be her?'" }; } } else { // dark mood if (Math.random() < 0.1) { return { sanityChange: -10, dialogue: "Mehmet (Dark): 'They left you too. I will as well.'" }; } else if (Math.random() < 0.2) { return { sanityChange: -10, dialogue: "Mehmet (Dark): 'This house hates you. I can hear it.'" }; } else if (Math.random() < 0.3) { return { sanityChange: -10, dialogue: "Mehmet (Dark): 'My darkness spoke to yours. We know the deal.'" }; } else if (Math.random() < 0.4) { return { sanityChange: -10, dialogue: "Mehmet (Dark): 'There's no escape. You've already died.'" }; } else { return { sanityChange: -10, dialogue: "Mehmet (Dark): 'Don't touch me. I'll burn you.'" }; } } if (character.currentMood === "gentle") { return { sanityChange: 10, dialogue: "Mehmet: 'Günaydın dostum, nezaketin benim için çok anlamlı.'" }; } else if (character.currentMood === "child") { if (actionType === "empathetic_talk") { return { sanityChange: 15, dialogue: "Mehmet (Çocuk): 'Benimle oynayacak mısın? Korkuyorum ve yalnızım!'" }; } else { return { sanityChange: 8, dialogue: "Mehmet (Çocuk): 'Bu eğlenceli! Bana karşı çok naziksin!'" }; } } else { // dark mood if (actionType === "give_space") { return { sanityChange: 5, dialogue: "Mehmet (Karanlık): 'Akıllıca seçim. Şu anda yanımda olmak istemezsin.'" }; } else { return { sanityChange: -15, dialogue: "Mehmet (Karanlık): 'Acınası girişimlerin beni iğrendiriyor. Uzak dur.'" }; } } } // Impostor gives specific dialogue responses if (character.isImpostor) { // 70% chance for positive dialogue, 30% chance for negative dialogue var usePositive = Math.random() < 0.7; var selectedDialogue; var sanityChange; if (usePositive) { selectedDialogue = character.name + ": '" + impostorPositiveDialogues[Math.floor(Math.random() * impostorPositiveDialogues.length)] + "'"; sanityChange = 8; // Positive response gives good sanity change } else { selectedDialogue = character.name + ": '" + impostorNegativeDialogues[Math.floor(Math.random() * impostorNegativeDialogues.length)] + "'"; sanityChange = -5; // Negative response gives slight sanity loss } return { sanityChange: sanityChange, dialogue: selectedDialogue }; } return { sanityChange: 2, dialogue: character.name + " çabanızı takdir ediyor." }; } // Create Action Buttons for (var i = 0; i < actions.length; i++) { var action = actions[i]; var button = new ActionButton(action.text + " (-" + action.cost + ")", function (actionData) { return function () { if (selectedCharacter && timeLeft >= actionData.cost) { timeLeft -= actionData.cost; // Check for repetitive behavior if (selectedCharacter.lastAction === actionData.text) { selectedCharacter.sameActionCount++; if (selectedCharacter.sameActionCount >= 3) { selectedCharacter.updateSanity(-50); dialogueBox.showDialogue(selectedCharacter.name + ": 'Yeter artık! Hep aynı şeyi yapıyorsun, bıktım bu davranıştan!'", 3000); selectedCharacter.sameActionCount = 0; // Reset counter after penalty selectedCharacter.lastAction = ""; // Reset last action // Penalize all characters' sanity for (var j = 0; j < characters.length; j++) { characters[j].updateSanity(-30); } hideCharacterActions(); updateUI(); return; } } else { selectedCharacter.sameActionCount = 1; } selectedCharacter.lastAction = actionData.text; actionData.effect(selectedCharacter); selectedCharacter.lastInteractionDay = currentDay; hideCharacterActions(); updateUI(); } }; }(action)); button.y = i * 100; actionButtons.push(button); actionButtonsContainer.addChild(button); } // Add Close Button var closeButton = new ActionButton("Kapat", function () { hideCharacterActions(); }); closeButton.y = actions.length * 100; actionButtonsContainer.addChild(closeButton); // Next Day Button var nextDayButton = new ActionButton("Next Day", function () { if (currentDay < 20) { // Show tutorial hint for first day progression if (tutorialActive && currentDay === 1) { dialogueBox.showDialogue("Good! This is how days progress. Don't forget to interact with characters every day.", 3000); tutorialActive = false; // End tutorial after first day } nextDay(); } }); nextDayButton.x = 1024; nextDayButton.y = 2500; game.addChild(nextDayButton); // Make the next day button text much larger var nextDayButtonChildren = nextDayButton.children; for (var i = 0; i < nextDayButtonChildren.length; i++) { if (nextDayButtonChildren[i] instanceof Text2) { nextDayButtonChildren[i].size = 700; } } // Go to Day 19 Button (for testing) var goToDay19Button = new ActionButton("Go to Day 19", function () { currentDay = 19; timeLeft = maxTimePerDay; updateUI(); dialogueBox.showDialogue("Jumped to Day 19! Only one day left to find the impostor!", 3000); }); goToDay19Button.x = 1536; goToDay19Button.y = 2500; game.addChild(goToDay19Button); // Make the go to day 19 button text larger var goToDay19ButtonChildren = goToDay19Button.children; for (var i = 0; i < goToDay19ButtonChildren.length; i++) { if (goToDay19ButtonChildren[i] instanceof Text2) { goToDay19ButtonChildren[i].size = 500; } } function showCharacterActions() { actionMenuVisible = true; actionButtonsContainer.visible = true; // Update button availability based on time for (var i = 0; i < actionButtons.length && i < actions.length; i++) { var button = actionButtons[i]; var actionCost = actions[i].cost; if (timeLeft >= actionCost) { button.alpha = 1.0; } else { button.alpha = 0.5; } } // Add special actions for Kemal's manic episode if (selectedCharacter.name === "Kemal" && selectedCharacter.currentMood === "manic") { var calmKemalButton = new ActionButton("Yatıştırıcı Konuşma", function () { var success = Math.random() > 0.5; if (success) { selectedCharacter.updateSanity(20); var calmDialogues = ["Kemal: 'Tamam, tamam... belki haklısın. Biraz sakinleşmeye çalışacağım.'", "Kemal: 'Senin sesinde bir şey var... beni rahatlatıyor. Teşekkür ederim.'", "Kemal: 'Bu kadar sinirli olmaya gerek yok değil mi? Özür dilerim.'", "Kemal: 'Derin nefes alacağım... sen de benimle al, olur mu?'"]; dialogueBox.showDialogue(calmDialogues[Math.floor(Math.random() * calmDialogues.length)], 3000); } else { selectedCharacter.updateSanity(-10); var resistDialogues = ["Kemal: 'Hayır! Beni durdurmaya çalışıyorsun! Özgür olmak istiyorum!'", "Kemal: 'Senin sakin sesine ihtiyacım yok! Enerjimi öldürmeye çalışıyorsun!'", "Kemal: 'Bırak beni! Bu hissi yaşamak istiyorum, engelleme beni!'", "Kemal: 'Anlamıyorsun! Bu enerji benim gerçek halim!'"]; dialogueBox.showDialogue(resistDialogues[Math.floor(Math.random() * resistDialogues.length)], 3000); } hideCharacterActions(); updateUI(); }); calmKemalButton.y = actionButtons.length * 100; actionButtons.push(calmKemalButton); actionButtonsContainer.addChild(calmKemalButton); var tackleKemalButton = new ActionButton("Sözle Engelleme", function () { var risk = Math.random() > 0.7; if (risk) { selectedCharacter.updateSanity(-30); var blockDialogues = ["Kemal: 'Dur! Neden beni engelliyorsun? Sadece konuşmak istiyorum!'", "Kemal: 'Pekala, pekala... belki biraz fazla heyecanlandım. Ama yine de haklıyım!'", "Kemal: 'Tamam duruyorum! Ama dinle beni, bu çok önemli!'"]; dialogueBox.showDialogue(blockDialogues[Math.floor(Math.random() * blockDialogues.length)], 3000); } else { selectedCharacter.updateSanity(-10); var resistBlockDialogues = ["Kemal: 'Hayır! Beni susturamayacaksın! Konuşacağım!'", "Kemal: 'Bu benim hakkım! Düşüncelerimi ifade etmeliyim!'", "Kemal: 'Engelleyemezsin beni! Herkese söyleyeceğim!'"]; dialogueBox.showDialogue(resistBlockDialogues[Math.floor(Math.random() * resistBlockDialogues.length)], 3000); } hideCharacterActions(); updateUI(); }); tackleKemalButton.y = (actionButtons.length + 1) * 100; actionButtons.push(tackleKemalButton); actionButtonsContainer.addChild(tackleKemalButton); var hideKemalButton = new ActionButton("Sessizce Dinle", function () { selectedCharacter.updateSanity(-10); var observeDialogues = ["Kemal: 'Kimse beni dinlemiyor... sadece izliyorlar. Bu çok üzücü.'", "Kemal: 'Konuşacak kimse yok... hepsi sessizce bakıyor bana.'", "Kemal: 'Belki haklıydılar... belki gerçekten çok gürültücüydüm.'"]; dialogueBox.showDialogue(observeDialogues[Math.floor(Math.random() * observeDialogues.length)], 3000); hideCharacterActions(); updateUI(); }); hideKemalButton.y = (actionButtons.length + 2) * 100; actionButtons.push(hideKemalButton); actionButtonsContainer.addChild(hideKemalButton); var talkWithElifButton = new ActionButton("Elif’le konuş ve onunla birlikte Kemal'e ulaş", function () { var success = Math.random() > 0.5; if (success) { selectedCharacter.updateSanity(20); dialogueBox.showDialogue("Elif: 'Kemal, senin sesini duyuyor. Birlikte yaklaşalım.'", 3000); } else { selectedCharacter.updateSanity(-10); dialogueBox.showDialogue("Kemal: 'Beni yavaşlatmaya çalışıyorsun! Her şey için enerjim var!'", 3000); } hideCharacterActions(); updateUI(); }); talkWithElifButton.y = (actionButtons.length + 3) * 100; actionButtons.push(talkWithElifButton); actionButtonsContainer.addChild(talkWithElifButton); } } function hideCharacterActions() { actionMenuVisible = false; actionButtonsContainer.visible = false; selectedCharacter = null; } function nextDay() { currentDay++; timeLeft = maxTimePerDay; // Clear any floating text elements from previous day var floatingTexts = game.children.filter(function (child) { return child instanceof Text2 && child !== dayText && child !== timeText && child !== bookText; }); for (var i = 0; i < floatingTexts.length; i++) { floatingTexts[i].destroy(); } // Hide dialogue box dialogueBox.visible = false; // Check for aggressive character attacks during night for (var i = 0; i < characters.length; i++) { var character = characters[i]; if (character.isAggressive && Math.random() < 0.3) { LK.getSound('crash').play(); LK.getSound('horror').play(); showEnding("KÖTÜ", character.name + " gece çok dengesizleşti ve saldırdı. Durum kontrol edilemez hale geldi."); return; } } // Daily sanity decay for characters not interacted with for (var i = 0; i < characters.length; i++) { var character = characters[i]; if (character.lastInteractionDay < currentDay - 1) { character.updateSanity(-5); } // Mood changes for specific characters if (character.personality === "bipolar") { if (Math.random() < 0.4) { var moods = ["manic", "depressive", "normal"]; character.currentMood = moods[Math.floor(Math.random() * moods.length)]; } } else if (character.personality === "did") { // DID character changes personality based on time of day var hour = (maxTimePerDay - timeLeft) / maxTimePerDay * 24; if (hour < 8) { character.currentMood = "gentle"; } else if (hour < 16) { character.currentMood = "child"; } else if (hour < 20) { character.currentMood = "gentle"; } else { character.currentMood = "dark"; } } // Random daily events if (Math.random() < 0.3) { var randomChange = Math.floor(Math.random() * 10) - 5; character.updateSanity(randomChange); } } } updateUI(); checkGameEnd(); if (currentDay > 7) { dialogueBox.showDialogue("Day " + currentDay + " begins. Everyone looks tired after spending a night in the house.", 3000); } function updateUI() { dayText.setText("Day " + currentDay + "/20"); timeText.setText("Time: " + timeLeft); if (timeLeft <= 20) { timeText.tint = 0xff0000; } else if (timeLeft <= 50) { timeText.tint = 0xffa500; } else { timeText.tint = 0xffff00; } } function checkGameEnd() { var dangerousCount = 0; var totalSanity = 0; for (var i = 0; i < characters.length; i++) { if (characters[i].isDangerous) { dangerousCount++; } totalSanity += characters[i].sanity; } // Bad ending - too many dangerous characters if (dangerousCount >= 3) { LK.getSound('crash').play(); LK.getSound('horror').play(); LK.getSound('scream').play(); showEnding("KÖTÜ", "Ev kaosa büründü. Çok fazla kişi krizde olduğu için hayatta kalmak imkansız hale geldi. Kendin dahil kimseyi kurtaramadın."); return; } // Check if reached day 20 if (currentDay > 20) { if (impostorFound) { // They found the impostor AND survived 20 days = perfect victory! showEnding("KAZANDIN", "Mükemmel! İmpostörü " + impostorFoundDay + ". günde buldunuz ve 20 gün boyunca hayatta kaldınız! Gerçek bir zafer!"); } else { // If they survived 20 days without finding impostor = show revelation sequence var impostorName = characters[impostorIndex].name; // Create dramatic revelation sequence currentGameState = "gameOver"; // Clear dialogue box dialogueBox.visible = false; // Create black overlay first var blackOverlay = game.attachAsset('endingOverlay', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366, alpha: 1.0 }); // Show the taunt message var taunMessage = new Text2("Did you think you could escape?", { size: 72, fill: 0xFF0000, wordWrap: true, wordWrapWidth: 1600 }); taunMessage.anchor.set(0.5, 0.5); taunMessage.x = 1024; taunMessage.y = 1366; game.addChild(taunMessage); // After a delay, make screen go dark and show impostor LK.setTimeout(function () { // Make screen completely black blackOverlay.alpha = 1.0; taunMessage.destroy(); // Show the impostor character suddenly var impostor = characters[impostorIndex]; var impostorReveal = game.attachAsset('characterCard' + impostorName, { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366, scaleX: 2.0, scaleY: 2.0 }); impostorReveal.tint = 0xff0000; // Red tint for dramatic effect // Add red glowing eyes var leftEye = game.attachAsset('characterEyes', { anchorX: 0.5, anchorY: 0.5, x: 974, y: 1316 }); var rightEye = game.attachAsset('characterEyes', { anchorX: 0.5, anchorY: 0.5, x: 1074, y: 1316 }); // Play horror sounds LK.getSound('horror').play(); LK.getSound('crash').play(); LK.getSound('scream').play(); // Show final losing message LK.setTimeout(function () { showEnding("KAYBETTİN", "20 gün geçti ama impostörü bulamadınız! " + impostorName + " aslında akıl hastası değildi ve sizi kandırmayı başardı. Kıyma makinesinde yok edildiniz!"); }, 3000); }, 2000); } return; } } function showEnding(type, message) { currentGameState = "gameOver"; // Play lose sound when player loses if (type === "KAYBETTİN" || type === "KÖTÜ") { LK.getSound('686184b09666db472fa4477a').play(); } // Clear all floating text elements and mission texts var floatingTexts = game.children.filter(function (child) { return child instanceof Text2 && child !== dayText && child !== timeText && child !== bookText; }); for (var i = 0; i < floatingTexts.length; i++) { floatingTexts[i].destroy(); } // Clear dialogue box dialogueBox.visible = false; var endingOverlay = game.attachAsset('endingOverlay', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366, alpha: 0.8 }); var endingTitle = new Text2(type + " SON", { size: 96, fill: type === "İYİ" ? "#00ff00" : type === "NÖTR" ? "#ffff00" : "#ff0000" }); endingTitle.anchor.set(0.5, 0.5); endingTitle.x = 1024; endingTitle.y = 1000; game.addChild(endingTitle); var endingText = new Text2(message, { size: 48, fill: 0xFFFFFF, wordWrap: true, wordWrapWidth: 1600 }); endingText.anchor.set(0.5, 0.5); endingText.x = 1024; endingText.y = 1400; game.addChild(endingText); var restartButton = new ActionButton("Tekrar Oyna", function () { LK.showGameOver(); }); restartButton.x = 1024; restartButton.y = 1800; game.addChild(restartButton); // Update high score based on ending var score = 0; if (type === "İYİ") { score = 100; } else if (type === "NÖTR") { score = 50; } else { score = 10; } LK.setScore(score); } // Game loop game.update = function () { if (currentGameState === "playing") { // Time naturally decreases if (LK.ticks % 60 === 0 && timeLeft > 0) { timeLeft--; updateUI(); if (timeLeft <= 0) { dialogueBox.showDialogue("Day ended. Time to rest and prepare for tomorrow.", 2000); } } // Check for game end conditions periodically if (LK.ticks % 180 === 0) { checkGameEnd(); } } // Update Dynamic Background Effects // Calculate time-based color shifts for atmosphere var timePhase = LK.ticks * 0.01 % (Math.PI * 2); var dayPhase = currentDay / 20 * Math.PI; var sanityPhase = chaosIntensity * Math.PI; // Create dynamic background color that shifts based on time, day, and sanity var baseRed = Math.floor(45 + Math.sin(timePhase) * 10 + Math.sin(dayPhase) * 15 + chaosIntensity * 30); var baseGreen = Math.floor(24 + Math.cos(timePhase * 0.7) * 8 + Math.sin(dayPhase * 0.8) * 10 + chaosIntensity * 20); var baseBue = Math.floor(16 + Math.sin(timePhase * 1.3) * 6 + Math.cos(dayPhase * 1.2) * 8 + chaosIntensity * 40); // Ensure values stay in valid range baseRed = Math.max(0, Math.min(255, baseRed)); baseGreen = Math.max(0, Math.min(255, baseGreen)); baseBue = Math.max(0, Math.min(255, baseBue)); var dynamicBgColor = baseRed << 16 | baseGreen << 8 | baseBue; game.setBackgroundColor(dynamicBgColor); // Calculate chaos intensity based on average sanity var totalSanity = 0; for (var i = 0; i < characters.length; i++) { totalSanity += characters[i].sanity; } chaosIntensity = 1.0 - totalSanity / (characters.length * 100); // Update chaos particles with enhanced behaviors for (var i = 0; i < chaosParticles.length; i++) { var particle = chaosParticles[i]; if (particle.speedX !== undefined) { // Moving particles with enhanced motion var motionMultiplier = 1.0 + Math.sin(LK.ticks * 0.02 + i) * 0.3; particle.x += particle.speedX * chaosIntensity * motionMultiplier; particle.y += particle.speedY * chaosIntensity * motionMultiplier; particle.rotation += particle.rotationSpeed * (1.0 + chaosIntensity); // Add subtle gravitational pull towards center for some particles if (i % 3 === 0) { var centerX = 1024; var centerY = 1366; var dx = centerX - particle.x; var dy = centerY - particle.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance > 100) { particle.x += dx / distance * 0.3 * chaosIntensity; particle.y += dy / distance * 0.3 * chaosIntensity; } } // Wrap around screen if (particle.x < -50) { particle.x = 2098; } if (particle.x > 2098) { particle.x = -50; } if (particle.y < -50) { particle.y = 2782; } if (particle.y > 2782) { particle.y = -50; } // Enhanced horror-themed color changes with atmosphere consideration if (Math.random() < 0.05 * chaosIntensity) { var horrorColors = [0x8b0000, 0x800080, 0x2f4f4f, 0x8b008b, 0x696969, 0x000000, 0x4b0082, 0x800000]; var timeBasedColors = [0x4a4a4a, 0x5a3d2b, 0x3d2616, 0x6b4423]; // Day/time influenced colors var colorSet = chaosIntensity > 0.5 ? horrorColors : horrorColors.concat(timeBasedColors); particle.tint = colorSet[Math.floor(Math.random() * colorSet.length)]; } // Enhanced shadow fade effect with breathing motion if (particle.fadeDirection !== undefined) { var breathingEffect = Math.sin(LK.ticks * 0.03 + i * 0.5) * 0.2; particle.alpha += (particle.fadeDirection * 0.02 + breathingEffect * 0.01) * chaosIntensity; if (particle.alpha <= 0.1 || particle.alpha >= 0.8) { particle.fadeDirection *= -1; } // Add subtle scale breathing for shadows particle.scaleX = (2 + Math.random() * 3) * (1.0 + breathingEffect * 0.1); } } else if (particle.pulseSpeed !== undefined) { // Enhanced pulsing circles with complex motion particle.pulsePhase += particle.pulseSpeed * (1.0 + chaosIntensity * 0.5); var pulseIntensity = 1.0 + Math.sin(particle.pulsePhase) * 0.7 * chaosIntensity; var secondaryPulse = Math.cos(particle.pulsePhase * 2.3) * 0.3; particle.scaleX = particle.scaleY = pulseIntensity + secondaryPulse; particle.alpha = 0.2 + Math.sin(particle.pulsePhase) * 0.4 * chaosIntensity + secondaryPulse * 0.1; // Orbital motion for some circles if (i % 4 === 0) { var orbitRadius = 200 + Math.sin(LK.ticks * 0.01 + i) * 100; var orbitSpeed = LK.ticks * 0.02 + i; particle.x = 1024 + Math.cos(orbitSpeed) * orbitRadius; particle.y = 1366 + Math.sin(orbitSpeed * 0.7) * orbitRadius * 0.6; } // Enhanced color shifting for circles if (Math.random() < 0.03 * chaosIntensity) { var circleColors = [0x8b0000, 0x4b0082, 0x2f2f2f, 0x800000, 0x8b008b]; var atmosphericColors = [0x4d3319, 0x5c4033, 0x3e2723]; // Atmospheric colors var finalColors = chaosIntensity > 0.3 ? circleColors : circleColors.concat(atmosphericColors); particle.tint = finalColors[Math.floor(Math.random() * finalColors.length)]; } } } // Update chaos noise with enhanced atmospheric effects for (var i = 0; i < chaosNoiseElements.length; i++) { var noise = chaosNoiseElements[i]; // Create flickering effect that resembles floating embers or dust var flicker = Math.sin(LK.ticks * 0.05 + i * 2) * 0.3 + Math.random() * 0.2; noise.alpha = (Math.random() * 0.3 + 0.2 + flicker) * chaosIntensity; // Slow floating motion for atmospheric depth noise.y -= 0.5 + Math.sin(LK.ticks * 0.01 + i) * 0.3; noise.x += Math.sin(LK.ticks * 0.008 + i * 1.5) * 0.8; if (noise.y < -20) { noise.y = 2752; noise.x = Math.random() * 2048; } if (noise.x < -20) noise.x = 2068; if (noise.x > 2068) noise.x = -20; // Enhanced repositioning and color changes if (Math.random() < 0.1 * chaosIntensity) { noise.x = Math.random() * 2048; noise.y = Math.random() * 2732; // Enhanced atmospheric colors including warm tones var noiseColors = [0x8b0000, 0x2f4f4f, 0x8b008b, 0x000000, 0x800080, 0x4b0082, 0x696969]; var warmColors = [0x8b4513, 0x654321, 0x5d4e37, 0x8b7355]; // Warm atmospheric tones var environmentColors = chaosIntensity > 0.4 ? noiseColors : noiseColors.concat(warmColors); noise.tint = environmentColors[Math.floor(Math.random() * environmentColors.length)]; } // Enhanced atmospheric scaling with breathing and depth effects var depthEffect = noise.y / 2732 * 0.3 + 0.7; // Smaller when higher (further away) var breathingScale = Math.sin(LK.ticks * 0.02 + i) * 0.3 * chaosIntensity; var organicScale = Math.cos(LK.ticks * 0.03 + i * 1.7) * 0.2; noise.scaleX = (1.0 + breathingScale + organicScale) * depthEffect; noise.scaleY = (1.0 + breathingScale + organicScale * 0.8) * depthEffect; // Add rotation for some noise elements to create more dynamic movement if (i % 5 === 0) { noise.rotation += 0.01 + chaosIntensity * 0.02; } } }; // Knowledge Book var knowledgeBook = game.attachAsset('knowledgeBook', { anchorX: 0.5, anchorY: 0.5, x: 1900, y: 200 }); var bookText = new Text2("Book", { size: 48, fill: 0xFFFFFF }); bookText.anchor.set(0.5, 0.5); bookText.x = 1900; bookText.y = 240; game.addChild(bookText); // Notebook var notebook = game.attachAsset('notebook', { anchorX: 0.5, anchorY: 0.5, x: 1700, y: 200 }); var notebookText = new Text2("Notebook", { size: 48, fill: 0xFFFFFF }); notebookText.anchor.set(0.5, 0.5); notebookText.x = 1700; notebookText.y = 240; game.addChild(notebookText); knowledgeBook.down = function (x, y, obj) { // Show tutorial hint for knowledge book if (tutorialActive) { dialogueBox.showDialogue("Great! This book provides information about mental health disorders. Use it to understand the characters.", 3000); } showKnowledgeBook(); LK.getSound('click').play(); }; notebook.down = function (x, y, obj) { // Show tutorial hint for notebook if (tutorialActive) { dialogueBox.showDialogue("This notebook contains the characters' illnesses. Use it to see who has what condition.", 3000); } showNotebook(); LK.getSound('click').play(); }; var notebookVisible = false; function showNotebook() { if (notebookVisible) { return; } notebookVisible = true; var notebookOverlay = game.attachAsset('endingOverlay', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366, alpha: 0.9 }); var notebookTitle = new Text2("CHARACTER DISORDERS NOTEBOOK", { size: 72, fill: 0xFFFFFF }); notebookTitle.anchor.set(0.5, 0.5); notebookTitle.x = 1024; notebookTitle.y = 400; game.addChild(notebookTitle); var yPos = 600; for (var i = 0; i < charactersData.length; i++) { var data = charactersData[i]; var characterName = new Text2(data.name + ":", { size: 60, fill: 0xFFD700 }); characterName.anchor.set(0.5, 0); characterName.x = 1024; characterName.y = yPos; game.addChild(characterName); var characterDisorder = new Text2(data.disorder, { size: 48, fill: 0xFFFFFF, wordWrap: true, wordWrapWidth: 1600 }); characterDisorder.anchor.set(0.5, 0); characterDisorder.x = 1024; characterDisorder.y = yPos + 60; game.addChild(characterDisorder); yPos += 150; } // Add "Someone is fake" text at the bottom var fakeWarningText = new Text2("Someone is fake", { size: 56, fill: 0xFF0000, wordWrap: true, wordWrapWidth: 1600 }); fakeWarningText.anchor.set(0.5, 0); fakeWarningText.x = 1024; fakeWarningText.y = yPos + 20; game.addChild(fakeWarningText); var closeNotebookButton = new ActionButton("Close Notebook", function () { notebookVisible = false; notebookOverlay.destroy(); notebookTitle.destroy(); // Destroy all character information elements var allTextElements = game.children.filter(function (child) { return child instanceof Text2 && child.y >= 400 && child.y <= 2000; }); for (var m = 0; m < allTextElements.length; m++) { if (allTextElements[m] !== dayText && allTextElements[m] !== timeText && allTextElements[m] !== bookText && allTextElements[m] !== notebookText) { allTextElements[m].destroy(); } } closeNotebookButton.destroy(); }); closeNotebookButton.x = 1024; closeNotebookButton.y = yPos + 120; game.addChild(closeNotebookButton); } function showKnowledgeBook() { if (knowledgeBookVisible) { return; } knowledgeBookVisible = true; var bookOverlay = game.attachAsset('endingOverlay', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366, alpha: 0.9 }); var bookTitle = new Text2("MENTAL HEALTH BOOK", { size: 72, fill: 0xFFFFFF }); bookTitle.anchor.set(0.5, 0.5); bookTitle.x = 1024; bookTitle.y = 400; game.addChild(bookTitle); var yPos = 600; var disorders = Object.keys(disorderInfo); for (var i = 0; i < disorders.length; i++) { var disorder = disorders[i]; var info = disorderInfo[disorder]; var disorderTitle = new Text2(disorder, { size: 72, fill: 0xFFD700 }); disorderTitle.anchor.set(0.5, 0); disorderTitle.x = 1024; disorderTitle.y = yPos; game.addChild(disorderTitle); var disorderDesc = new Text2(info, { size: 56, fill: 0xFFFFFF, wordWrap: true, wordWrapWidth: 1600 }); disorderDesc.anchor.set(0.5, 0); disorderDesc.x = 1024; disorderDesc.y = yPos + 50; game.addChild(disorderDesc); yPos += 250; } var closeBookButton = new ActionButton("Close Book", function () { knowledgeBookVisible = false; bookOverlay.destroy(); bookTitle.destroy(); // Destroy all disorder information elements var disorders = Object.keys(disorderInfo); for (var j = 0; j < disorders.length; j++) { var disorderElements = game.children.filter(function (child) { return child instanceof Text2 && child.text && (child.text.indexOf(disorders[j]) !== -1 || child.text === disorderInfo[disorders[j]]); }); for (var k = 0; k < disorderElements.length; k++) { disorderElements[k].destroy(); } } // Also destroy any remaining text elements that might be part of the book var allTextElements = game.children.filter(function (child) { return child instanceof Text2 && child.y >= 400 && child.y <= 2000; }); for (var m = 0; m < allTextElements.length; m++) { if (allTextElements[m] !== dayText && allTextElements[m] !== timeText && allTextElements[m] !== bookText) { allTextElements[m].destroy(); } } closeBookButton.destroy(); }); closeBookButton.x = 1024; closeBookButton.y = yPos + 100; game.addChild(closeBookButton); } // Tutorial System - Reset for new game var tutorialActive = true; var tutorialStep = 0; var tutorialContainer = null; function startTutorial() { tutorialActive = true; tutorialStep = 0; // Start playing tutorial music LK.playMusic('tutorialMusic'); showTutorialStep(); } function showTutorialStep() { // Clear previous tutorial container if (tutorialContainer) { tutorialContainer.destroy(); } tutorialContainer = new Container(); tutorialContainer.x = 1024; tutorialContainer.y = 1366; game.addChild(tutorialContainer); var tutorialMessages = ["WELCOME! You must survive 20 days with 5 people in this house.", "WARNING: There is an IMPOSTOR among you! This person is not mentally ill and is deceiving you!", "Your goal: Survive 20 days and find out who the impostor is.", "You can accuse someone by clicking on them 3 times.", "If you find correctly you win! If you choose wrong you will be destroyed in the meat grinder!", "Each character has different mental health problems. The impostor may appear more stable.", "CLICK on characters and interact. Each action takes time.", "Monitor the characters' mental health. The impostor usually behaves more normally.", "WARNING: When someone's sanity drops to 30 or below, you will hear a special warning sound indicating danger."]; if (tutorialStep < tutorialMessages.length) { var tutorialText = new Text2(tutorialMessages[tutorialStep], { size: 48, fill: 0xFFD700, wordWrap: true, wordWrapWidth: 1600 }); tutorialText.anchor.set(0.5, 0.5); tutorialContainer.addChild(tutorialText); var nextButton = new ActionButton("Continue", function () { tutorialStep++; if (tutorialStep >= tutorialMessages.length) { endTutorial(); } else { showTutorialStep(); } }); nextButton.y = 150; tutorialContainer.addChild(nextButton); var skipButton = new ActionButton("Skip Tutorial", function () { endTutorial(); }); skipButton.y = 250; tutorialContainer.addChild(skipButton); } } function endTutorial() { tutorialActive = false; // Stop tutorial music when tutorial ends LK.stopMusic(); if (tutorialContainer) { tutorialContainer.destroy(); tutorialContainer = null; } // Create red screen overlay var redOverlay = game.attachAsset('endingOverlay', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366, alpha: 0.7 }); redOverlay.tint = 0xFF0000; // Make it red // Show red warning message at end of tutorial var warningContainer = new Container(); warningContainer.x = 1024; warningContainer.y = 1366; game.addChild(warningContainer); var warningText = new Text2("Don't do it they want your soul you can't escape(:", { size: 60, fill: 0xFF0000, // Red text color wordWrap: true, wordWrapWidth: 1600 }); warningText.anchor.set(0.5, 0.5); warningContainer.addChild(warningText); // Start screen shaking effect var shakeInterval = LK.setInterval(function () { var shakeX = (Math.random() - 0.5) * 20; var shakeY = (Math.random() - 0.5) * 20; game.x = shakeX; game.y = shakeY; }, 50); // Start playing the warning sound on loop with increased volume var warningSound = LK.getSound('tutorialWarning'); var warningSoundTimer = LK.setInterval(function () { warningSound.play(); }, 50); // Play every 50ms to create more intense continuous effect var warningSkipButton = new ActionButton("Skip", function () { // Stop all effects when skip button is pressed LK.clearInterval(warningSoundTimer); LK.clearInterval(shakeInterval); // Reset game position game.x = 0; game.y = 0; // Remove red overlay and warning container redOverlay.destroy(); warningContainer.destroy(); // Show initial game dialogue after warning dialogueBox.showDialogue("Day 1: You wake up with 5 people in a strange house. Everyone looks troubled.\nYou must help them survive for 20 days.", 4000); }); warningSkipButton.y = 150; warningContainer.addChild(warningSkipButton); } // Clear all existing game elements var allGameElements = game.children.slice(); // Create a copy of the children array for (var i = 0; i < allGameElements.length; i++) { if (allGameElements[i] !== dayPanel && allGameElements[i] !== dayText && allGameElements[i] !== timeText && allGameElements[i] !== nextDayButton && allGameElements[i] !== knowledgeBook && allGameElements[i] !== bookText && allGameElements[i] !== notebook && allGameElements[i] !== notebookText && allGameElements[i] !== actionButtonsContainer && allGameElements[i] !== dialogueBox) { allGameElements[i].destroy(); } } // Reset characters array and recreate characters = []; for (var i = 0; i < charactersData.length; i++) { var data = charactersData[i]; var character = new Character(data.name, data.disorder, data.sanity, data.triggers, data.calmers); character.personality = data.personality; character.currentMood = data.currentMood; character.timeOfLastChange = data.timeOfLastChange || 0; character.isAggressive = false; character.isHelpful = false; character.lastAction = data.lastAction || ""; character.sameActionCount = data.sameActionCount || 0; // Mark impostor - this character is actually mentally healthy character.isImpostor = i === impostorIndex; if (character.isImpostor) { character.realSanity = 100; // Always mentally healthy character.fakePersonality = character.personality; // Remember fake personality } // Initialize suspicion clicks for each character suspicionClicks[character.name] = 0; characters.push(character); game.addChild(character); } // Position Characters in Grid var startX = 400; var startY = 400; var spacingX = 400; var spacingY = 350; for (var i = 0; i < characters.length; i++) { var row = Math.floor(i / 3); var col = i % 3; characters[i].x = startX + col * spacingX; characters[i].y = startY + row * spacingY; } // Recreate chaos background elements chaosParticles = []; chaosNoiseElements = []; // Create Chaotic Background Elements - Horror Theme for (var i = 0; i < 30; i++) { var particle = game.attachAsset('chaosParticle', { anchorX: 0.5, anchorY: 0.5, x: Math.random() * 2048, y: Math.random() * 2732, alpha: 0.4 }); particle.speedX = (Math.random() - 0.5) * 4; particle.speedY = (Math.random() - 0.5) * 4; particle.rotationSpeed = (Math.random() - 0.5) * 0.1; // Horror color tints - dark reds, purples, grays particle.tint = [0x8b0000, 0x800080, 0x2f4f4f, 0x8b008b, 0x696969][Math.floor(Math.random() * 5)]; chaosParticles.push(particle); } for (var i = 0; i < 20; i++) { var circle = game.attachAsset('chaosCircle', { anchorX: 0.5, anchorY: 0.5, x: Math.random() * 2048, y: Math.random() * 2732, alpha: 0.3 }); circle.pulseSpeed = Math.random() * 0.05 + 0.02; circle.pulsePhase = Math.random() * Math.PI * 2; // Dark horror colors for circles circle.tint = [0x8b0000, 0x4b0082, 0x2f2f2f, 0x800000][Math.floor(Math.random() * 4)]; chaosParticles.push(circle); } for (var i = 0; i < 80; i++) { var noise = game.attachAsset('chaosNoise', { anchorX: 0.5, anchorY: 0.5, x: Math.random() * 2048, y: Math.random() * 2732, alpha: 0.15 }); noise.flickerSpeed = Math.random() * 0.3 + 0.1; // Dark, unsettling colors for noise noise.tint = [0x8b0000, 0x2f4f4f, 0x8b008b, 0x000000, 0x800080][Math.floor(Math.random() * 5)]; chaosNoiseElements.push(noise); } // Add creepy shadow elements for (var i = 0; i < 15; i++) { var shadow = game.attachAsset('chaosParticle', { anchorX: 0.5, anchorY: 0.5, x: Math.random() * 2048, y: Math.random() * 2732, alpha: 0.6, scaleX: 2 + Math.random() * 3, scaleY: 0.3 + Math.random() * 0.7 }); shadow.tint = 0x000000; // Pure black shadows shadow.speedX = (Math.random() - 0.5) * 1.5; shadow.speedY = (Math.random() - 0.5) * 1.5; shadow.fadeDirection = Math.random() > 0.5 ? 1 : -1; chaosParticles.push(shadow); } // Reset UI updateUI(); // Start tutorial immediately for new game startTutorial();
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var ActionButton = Container.expand(function (text, action) {
var self = Container.call(this);
var buttonBg = self.attachAsset('actionButton', {
anchorX: 0.5,
anchorY: 0.5
});
var buttonText = new Text2(text, {
size: 36,
fill: 0xFFFFFF
});
buttonText.anchor.set(0.5, 0.5);
self.addChild(buttonText);
self.action = action;
self.down = function (x, y, obj) {
if (self.action) {
self.action();
LK.getSound('click').play();
}
};
return self;
});
var ArrowButton = Container.expand(function (direction, onPress) {
var self = Container.call(this);
var arrow = self.attachAsset('actionButton', {
anchorX: 0.5,
anchorY: 0.5
});
var arrowText = new Text2(direction, {
size: 36,
fill: 0xFFFFFF
});
arrowText.anchor.set(0.5, 0.5);
self.addChild(arrowText);
self.down = function () {
if (onPress) {
self.holdInterval = LK.setInterval(onPress, 50); // Further increase speed by calling onPress every 50ms
}
};
self.up = function () {
if (self.holdInterval) {
LK.clearInterval(self.holdInterval);
self.holdInterval = null;
}
};
return self;
});
var Character = Container.expand(function (name, disorder, initialSanity, triggers, calmers) {
var self = Container.call(this);
self.name = name;
self.disorder = disorder;
self.maxSanity = 100;
self.sanity = initialSanity || 100;
self.triggers = triggers || [];
self.calmers = calmers || [];
self.lastInteractionDay = 0;
self.isDangerous = false;
var cardAssetName = 'characterCard' + name;
var cardBg = self.attachAsset(cardAssetName, {
anchorX: 0.5,
anchorY: 0.5
});
var nameText = new Text2(self.name, {
size: 48,
fill: 0xFFFF00
});
nameText.anchor.set(0.5, 0);
nameText.x = 0;
nameText.y = -120;
self.addChild(nameText);
// Disorder text removed - players must discover disorders through interaction
var sanityBg = self.attachAsset('sanityBarBg', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: 60
});
var sanityBar = self.attachAsset('sanityBar', {
anchorX: 0,
anchorY: 0.5,
x: -100,
y: 60
});
var sanityText = new Text2(self.sanity + "/100", {
size: 42,
fill: 0xFFFFFF
});
sanityText.anchor.set(0.5, 0.5);
sanityText.x = 0;
sanityText.y = 85;
self.addChild(sanityText);
self.updateSanity = function (amount) {
if (self.isImpostor) {
// Impostor maintains fake sanity levels but acts more subtly
self.sanity = Math.max(30, Math.min(100, self.sanity + Math.floor(amount * 0.5))); // Reduced impact
// Impostor never goes below 30 to avoid being too obvious
} else {
self.sanity = Math.max(0, Math.min(100, self.sanity + amount));
}
var sanityPercent = self.sanity / self.maxSanity;
sanityBar.width = 200 * sanityPercent;
if (sanityPercent > 0.6) {
sanityBar.tint = 0x228b22;
} else if (sanityPercent > 0.3) {
sanityBar.tint = 0xffa500;
} else {
sanityBar.tint = 0xff0000;
}
sanityText.setText(self.sanity + "/100");
// Check if sanity has reached zero
if (self.sanity === 0) {
// Trigger self-destruction and game over
LK.getSound('crash').play();
LK.getSound('scream').play();
LK.getSound('686184b09666db472fa4477a').play();
showEnding("BAD", self.name + " completely lost their mental health and harmed themselves. The situation became uncontrollable.");
}
// Check for very low sanity (below 20) and play warning sound
if (self.sanity < 20 && (self.lastSanityWarning === undefined || self.lastSanityWarning >= 20)) {
LK.getSound('lowSanityWarning').play();
self.lastSanityWarning = self.sanity;
}
// Check for laughing sound trigger (30 or below)
if (self.sanity <= 30 && (self.lastLaughingTrigger === undefined || self.lastLaughingTrigger > 30)) {
LK.getSound('lowSanityLaughing').play();
self.lastLaughingTrigger = self.sanity;
}
// Check for aggressive state (below 30)
if (self.sanity < 30 && !self.isDangerous) {
self.isDangerous = true;
self.isAggressive = true;
LK.getSound('warning').play();
LK.getSound('scream').play();
cardBg.tint = 0x8b0000; // Dark red for aggressive
} else if (self.sanity >= 30 && self.isDangerous) {
self.isDangerous = false;
self.isAggressive = false;
cardBg.tint = 0xffffff;
}
// Check for helpful state (above 90)
if (self.sanity > 90) {
self.isHelpful = true;
cardBg.tint = 0x00ff00; // Green for helpful
} else {
self.isHelpful = false;
}
};
self.clickCount = 0;
self.lastClickTime = 0;
self.down = function (x, y, obj) {
if (currentGameState === "playing" && timeLeft > 0) {
var currentTime = LK.ticks;
// Check for impostor accusation (3 quick clicks)
if (currentTime - self.lastClickTime < 60) {
// Within 1 second
suspicionClicks[self.name]++;
if (suspicionClicks[self.name] >= 3) {
// Player is accusing this character of being the impostor
if (self.isImpostor) {
// Correct accusation! Mark impostor as found but continue game
impostorFound = true;
impostorFoundDay = currentDay;
dialogueBox.showDialogue("CORRECT! " + self.name + " was indeed the impostor! Their identity is now revealed, but you need to survive 20 days!", 4000);
// Remove impostor abilities and make them act normally
self.isImpostor = false;
self.sanity = self.realSanity || 100;
} else {
// Wrong accusation!
LK.getSound('horror').play();
LK.getSound('scream').play();
showEnding("YOU LOST", "Wrong choice! " + self.name + " was really mentally ill. Since you couldn't find the impostor, you were destroyed in the meat grinder. Game over!");
}
return;
}
dialogueBox.showDialogue(suspicionClicks[self.name] + "/3 - You're suspicious of " + self.name + "...", 2000);
} else {
suspicionClicks[self.name] = 1;
dialogueBox.showDialogue("1/3 - You're starting to suspect " + self.name + "...", 2000);
}
self.lastClickTime = currentTime;
selectedCharacter = self;
// Show tutorial hint for first character interaction
if (tutorialActive && tutorialStep >= 8) {
dialogueBox.showDialogue("Perfect! Now select an action. Pay attention to the mental health bar.", 3000);
}
showCharacterActions();
LK.getSound('click').play();
}
};
return self;
});
var DialogueBox = Container.expand(function () {
var self = Container.call(this);
var dialogueBg = self.attachAsset('dialogueBox', {
anchorX: 0.5,
anchorY: 0.5
});
var dialogueText = new Text2("", {
size: 48,
fill: 0x000000
});
dialogueText.anchor.set(0.5, 0.5);
self.addChild(dialogueText);
self.showDialogue = function (text, duration) {
// Clear any existing skip buttons first
var existingButtons = self.children.filter(function (child) {
return child instanceof ActionButton;
});
for (var i = 0; i < existingButtons.length; i++) {
existingButtons[i].destroy();
}
dialogueText.setText(text);
self.visible = true;
// Add skip button
var skipButton = new ActionButton("Skip", function () {
self.visible = false;
skipButton.destroy();
});
skipButton.x = 0;
skipButton.y = 200;
self.addChild(skipButton);
// Removed automatic timeout to keep dialogue on screen until skip button is pressed
};
self.visible = false;
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x2d1810
});
/****
* Game Code
****/
// Game State Variables - Reset for new game
var currentDay = 1;
var timeLeft = 100;
var maxTimePerDay = 100;
var currentGameState = "playing"; // playing, gameOver, victory
var selectedCharacter = null;
var actionMenuVisible = false;
var discoveredDisorders = {};
var knowledgeBookVisible = false;
var diagnosisAttempts = {};
// Impostor system variables - Reset with new random impostor
var impostorIndex; // Will be set after charactersData is defined
var suspicionClicks = {};
var gameObjective = "impostor"; // New objective: find the impostor
var impostorFound = false; // Track if impostor has been correctly identified
var impostorFoundDay = 0; // Track which day impostor was found
// Impostor dialogue arrays
var impostorPositiveDialogues = ["Talking to you... feels good to me. I think I can trust you.", "This house is a bit strange but... I'm used to it. I adapt to the environment quickly.", "If I were you, I would be more careful... but you're making good progress.", "Nothing easily shakes me. I like composure.", "Everyone here has a weakness. But you seem more resilient.", "Spending time with you... is more enjoyable than I thought.", "Everyone seems confused about me. I think this is fun.", "There are many people here with problems. But we're fine, aren't we?", "I usually control myself very well. In every situation.", "One of them will break. But you will endure. You must endure."];
var impostorNegativeDialogues = ["You protect them... but they won't protect you. Remember this.", "When night comes, everyone's eyes shine. Why are yours so calm?", "Only one will leave this house in the end. It's that simple.", "I don't break. But watching those who are broken... is enjoyable.", "I've seen many who think like you. They usually can't pass the 15th day.", "Don't you really wonder why I'm here?", "I have no past. Maybe that's why I look at the future so comfortably.", "Predicting who will fall when is child's play for me.", "Do you think which one of us will give up first? I already know the answer.", "You trust me, don't you? This might be your biggest mistake."];
// Chaos Background Variables
var chaosParticles = [];
var chaosIntensity = 1.0;
var backgroundFlickerTimer = 0;
var chaosNoiseElements = [];
// Disorder Information
var disorderInfo = {
"Paranoid Disorder": "Constant suspicion and distrust. Belief that others will harm them. Avoiding eye contact, preferring to be alone.",
"Schizophrenia": "Loss of connection with reality, hearing voices, hallucinations. Likes to speak softly, music soothes them.",
"Bipolar Disorder": "Alternating between extremely happy (manic) and extremely sad (depressive) periods. Mood changes can be sudden.",
"OCD": "Obsessive thoughts and compulsive behaviors. Cleanliness, order and symmetry obsession. Disruption of routines causes panic.",
"Dissociative Identity Disorder": "Multiple personality. Taking on different personalities at different times. Can display gentle, childish or dark personalities.",
"Anxiety Disorder": "Excessive worry and fear. Panic attacks, shortness of breath. Avoiding uncertainty and changes. Calming with quiet environment and routine."
};
// Characters Data
var charactersData = [{
name: "Kemal",
disorder: "Bipolar Disorder",
sanity: 85,
triggers: ["criticism", "restrictions", "boredom", "artwork moved"],
calmers: ["activities", "praise", "routine", "engagement"],
personality: "bipolar",
currentMood: "normal",
// can be: manic, depressive, normal
lastAction: "",
sameActionCount: 0
}, {
name: "Yusuf",
disorder: "Paranoid Disorder",
sanity: 80,
triggers: ["sudden movements", "being watched", "loud noises", "eye contact"],
calmers: ["honesty", "being left alone", "quiet environment", "trust building"],
personality: "paranoid",
currentMood: "suspicious",
lastAction: "",
sameActionCount: 0
}, {
name: "Zeynep",
disorder: "OCD",
sanity: 90,
triggers: ["disorder", "asymmetry", "dirty objects", "interrupted rituals"],
calmers: ["organization", "cleaning together", "respecting routines", "symmetry"],
personality: "ocd",
currentMood: "anxious",
lastAction: "",
sameActionCount: 0
}, {
name: "Mehmet",
disorder: "Dissociative Identity Disorder",
sanity: 75,
triggers: ["trauma reminders", "stress", "dark personality emergence"],
calmers: ["personality-appropriate response", "safe spaces", "gentle approach"],
personality: "did",
currentMood: "gentle",
// can be: gentle, child, dark
timeOfLastChange: 0,
lastAction: "",
sameActionCount: 0
}, {
name: "Elif",
disorder: "Schizophrenia",
sanity: 70,
triggers: ["confrontation", "judgment", "disbelief"],
calmers: ["listening", "music", "soft voice", "validation"],
personality: "schizophrenic",
currentMood: "hearing_voices",
lastAction: "",
sameActionCount: 0
}, {
name: "Ege",
disorder: "Anxiety Disorder",
sanity: 78,
triggers: ["loud noises", "sudden changes", "crowded spaces", "uncertainty"],
calmers: ["calm environment", "routine", "reassurance", "breathing exercises"],
personality: "anxious",
currentMood: "worried",
// can be: worried, panicked, calm
lastAction: "",
sameActionCount: 0
}];
// Set impostor index now that charactersData is defined
impostorIndex = Math.floor(Math.random() * charactersData.length);
// Create Characters
var characters = [];
for (var i = 0; i < charactersData.length; i++) {
var data = charactersData[i];
var character = new Character(data.name, data.disorder, data.sanity, data.triggers, data.calmers);
character.personality = data.personality;
character.currentMood = data.currentMood;
character.timeOfLastChange = data.timeOfLastChange || 0;
character.isAggressive = false;
character.isHelpful = false;
character.lastAction = data.lastAction || "";
character.sameActionCount = data.sameActionCount || 0;
// Mark impostor - this character is actually mentally healthy
character.isImpostor = i === impostorIndex;
if (character.isImpostor) {
character.realSanity = 100; // Always mentally healthy
character.fakePersonality = character.personality; // Remember fake personality
}
// Initialize suspicion clicks for each character
suspicionClicks[character.name] = 0;
// Reset impostor tracking variables for new game
impostorFound = false;
impostorFoundDay = 0;
characters.push(character);
game.addChild(character);
}
// Position Characters in Grid
var startX = 400;
var startY = 400;
var spacingX = 400;
var spacingY = 350;
for (var i = 0; i < characters.length; i++) {
var row = Math.floor(i / 3);
var col = i % 3;
characters[i].x = startX + col * spacingX;
characters[i].y = startY + row * spacingY;
}
// Create Chaotic Background Elements - Horror Theme
for (var i = 0; i < 30; i++) {
var particle = game.attachAsset('chaosParticle', {
anchorX: 0.5,
anchorY: 0.5,
x: Math.random() * 2048,
y: Math.random() * 2732,
alpha: 0.4
});
particle.speedX = (Math.random() - 0.5) * 4;
particle.speedY = (Math.random() - 0.5) * 4;
particle.rotationSpeed = (Math.random() - 0.5) * 0.1;
// Horror color tints - dark reds, purples, grays
particle.tint = [0x8b0000, 0x800080, 0x2f4f4f, 0x8b008b, 0x696969][Math.floor(Math.random() * 5)];
chaosParticles.push(particle);
}
for (var i = 0; i < 20; i++) {
var circle = game.attachAsset('chaosCircle', {
anchorX: 0.5,
anchorY: 0.5,
x: Math.random() * 2048,
y: Math.random() * 2732,
alpha: 0.3
});
circle.pulseSpeed = Math.random() * 0.05 + 0.02;
circle.pulsePhase = Math.random() * Math.PI * 2;
// Dark horror colors for circles
circle.tint = [0x8b0000, 0x4b0082, 0x2f2f2f, 0x800000][Math.floor(Math.random() * 4)];
chaosParticles.push(circle);
}
for (var i = 0; i < 80; i++) {
var noise = game.attachAsset('chaosNoise', {
anchorX: 0.5,
anchorY: 0.5,
x: Math.random() * 2048,
y: Math.random() * 2732,
alpha: 0.15
});
noise.flickerSpeed = Math.random() * 0.3 + 0.1;
// Dark, unsettling colors for noise
noise.tint = [0x8b0000, 0x2f4f4f, 0x8b008b, 0x000000, 0x800080][Math.floor(Math.random() * 5)];
chaosNoiseElements.push(noise);
}
// Add creepy shadow elements
for (var i = 0; i < 15; i++) {
var shadow = game.attachAsset('chaosParticle', {
anchorX: 0.5,
anchorY: 0.5,
x: Math.random() * 2048,
y: Math.random() * 2732,
alpha: 0.6,
scaleX: 2 + Math.random() * 3,
scaleY: 0.3 + Math.random() * 0.7
});
shadow.tint = 0x000000; // Pure black shadows
shadow.speedX = (Math.random() - 0.5) * 1.5;
shadow.speedY = (Math.random() - 0.5) * 1.5;
shadow.fadeDirection = Math.random() > 0.5 ? 1 : -1;
chaosParticles.push(shadow);
}
// UI Elements
var dayPanel = game.attachAsset('dayPanel', {
anchorX: 0.5,
anchorY: 0,
x: 1024,
y: 50
});
var dayText = new Text2("Day " + currentDay + "/20", {
size: 54,
fill: 0xFFFFFF
});
dayText.anchor.set(0.5, 0.5);
dayText.x = 1024;
dayText.y = 110;
game.addChild(dayText);
var timeText = new Text2("Time: " + timeLeft, {
size: 42,
fill: 0xFFFFFF
});
timeText.anchor.set(0.5, 0.5);
timeText.x = 1024;
timeText.y = 150;
game.addChild(timeText);
// Action Buttons
var actionButtons = [];
var actionButtonsContainer = new Container();
actionButtonsContainer.x = 1024;
actionButtonsContainer.y = 1800;
actionButtonsContainer.visible = false;
game.addChild(actionButtonsContainer);
// Dialogue System
var dialogueBox = new DialogueBox();
dialogueBox.x = 1024;
dialogueBox.y = 1366; // Center vertically on screen
game.addChild(dialogueBox);
// Action Definitions
var actions = [{
text: "Empathetic Talk",
cost: 15,
effect: function effect(character) {
var response = getCharacterResponse(character, "empathetic_talk");
character.updateSanity(response.sanityChange);
dialogueBox.showDialogue(response.dialogue, 3000);
}
}, {
text: "Art Therapy",
cost: 25,
effect: function effect(character) {
var response = getCharacterResponse(character, "art_therapy");
character.updateSanity(response.sanityChange);
dialogueBox.showDialogue(response.dialogue, 3000);
}
}, {
text: "Read Together",
cost: 20,
effect: function effect(character) {
var response = getCharacterResponse(character, "read_together");
character.updateSanity(response.sanityChange);
dialogueBox.showDialogue(response.dialogue, 3000);
}
}, {
text: "Organize/Clean",
cost: 30,
effect: function effect(character) {
var response = getCharacterResponse(character, "organize");
character.updateSanity(response.sanityChange);
dialogueBox.showDialogue(response.dialogue, 3000);
}
}, {
text: "Give Space",
cost: 50,
effect: function effect(character) {
var response = getCharacterResponse(character, "give_space");
character.updateSanity(response.sanityChange);
dialogueBox.showDialogue(response.dialogue, 3000);
}
}];
function getCharacterResponse(character, actionType) {
if (character.isAggressive) {
// Aggressive characters now engage in verbal conflicts instead of physical fights
var aggressiveDialogues = [character.name + ": 'I'm sick of your advice! You always say the same things!'", character.name + ": 'You don't understand me! Nobody understands anyway!'", character.name + ": 'Enough already! Leave me alone, stop following me around!'", character.name + ": 'You're just like the others, you're just trying to control me!'", character.name + ": 'What you're doing makes no sense! You're wasting your time!'"];
return {
sanityChange: -10,
dialogue: aggressiveDialogues[Math.floor(Math.random() * aggressiveDialogues.length)]
};
}
if (character.isHelpful) {
return {
sanityChange: 5,
dialogue: character.name + " is in a great mood and appreciates your effort. They're even helping others!"
};
}
// Character-specific responses based on personality and mood
if (character.personality === "paranoid") {
if (Math.random() < 0.1) {
return {
sanityChange: 5,
dialogue: "Yusuf: 'I feel a bit safer with you around… this is rare.'"
};
} else if (Math.random() < 0.2) {
return {
sanityChange: 5,
dialogue: "Yusuf: 'Maybe not everyone is an enemy… if there's someone like you.'"
};
} else if (Math.random() < 0.3) {
return {
sanityChange: 5,
dialogue: "Yusuf: 'No one watched me today. Maybe it's because of you.'"
};
} else if (Math.random() < 0.4) {
return {
sanityChange: 5,
dialogue: "Yusuf: 'I slept peacefully last night. I think the voices decreased.'"
};
} else if (Math.random() < 0.5) {
return {
sanityChange: 5,
dialogue: "Yusuf: 'What you said… made me think. Thank you.'"
};
} else if (Math.random() < 0.6) {
return {
sanityChange: 5,
dialogue: "Yusuf: 'I'll tell you a secret. Because I'm starting to trust.'"
};
} else if (Math.random() < 0.7) {
return {
sanityChange: 5,
dialogue: "Yusuf: 'For the first time in this house, silence brought peace.'"
};
} else if (Math.random() < 0.8) {
return {
sanityChange: 5,
dialogue: "Yusuf: 'For not leaving me alone today… I'm grateful.'"
};
} else if (Math.random() < 0.9) {
return {
sanityChange: 5,
dialogue: "Yusuf: 'I can look out the window now. I'm not afraid.'"
};
} else {
return {
sanityChange: 5,
dialogue: "Yusuf: 'Maybe… we can leave this house together.'"
};
}
if (Math.random() < 0.1) {
return {
sanityChange: -5,
dialogue: "Yusuf: 'There's something inside the wall… can you feel the vibration?'"
};
} else if (Math.random() < 0.2) {
return {
sanityChange: -5,
dialogue: "Yusuf: 'Someone was behind the door just now. Didn't you blink?'"
};
} else if (Math.random() < 0.3) {
return {
sanityChange: -5,
dialogue: "Yusuf: 'Don't trust anyone. Especially at night.'"
};
} else if (Math.random() < 0.4) {
return {
sanityChange: -5,
dialogue: "Yusuf: 'Who enters your room at night?'"
};
} else if (Math.random() < 0.5) {
return {
sanityChange: -5,
dialogue: "Yusuf: 'I'm starting to trust you… but this could be a trap too.'"
};
} else if (Math.random() < 0.6) {
return {
sanityChange: -5,
dialogue: "Yusuf: 'I turned off the cameras but I'm still being watched.'"
};
} else if (Math.random() < 0.7) {
return {
sanityChange: -5,
dialogue: "Yusuf: 'I'll ask you something… be honest. You're a test subject too, aren't you?'"
};
} else if (Math.random() < 0.8) {
return {
sanityChange: -5,
dialogue: "Yusuf: 'Radio waves are behind everything. They're doing mind control.'"
};
} else if (Math.random() < 0.9) {
return {
sanityChange: -5,
dialogue: "Yusuf: 'Someone came to my room last night. Had a shadow but no footsteps.'"
};
} else {
return {
sanityChange: -5,
dialogue: "Yusuf: 'I don't have glasses but the mask on your face hasn't fallen yet.'"
};
}
if (actionType === "empathetic_talk") {
return Math.random() > 0.5 ? {
sanityChange: 10,
dialogue: "Yusuf: 'You seem honest... maybe I can trust you a little.'"
} : {
sanityChange: -5,
dialogue: "Yusuf: 'You're just like them, trying to get information from me!'"
};
} else if (actionType === "give_space") {
return {
sanityChange: 8,
dialogue: "Yusuf: 'Thanks for leaving me alone. I need to think.'"
};
} else {
return {
sanityChange: -3,
dialogue: "Yusuf: 'Stop trying to control me! I know what you're doing.'"
};
}
} else if (character.personality === "schizophrenic") {
if (Math.random() < 0.1) {
return {
sanityChange: 5,
dialogue: "The voices are quieter. I think talking to you helps.'"
};
} else if (Math.random() < 0.2) {
return {
sanityChange: 5,
dialogue: "Elif: 'I feel less alone when you're here..'"
};
} else if (Math.random() < 0.3) {
return {
sanityChange: 5,
dialogue: "Elif: 'Your voice is different from the others. Clear and calm..'"
};
} else if (Math.random() < 0.4) {
return {
sanityChange: 5,
dialogue: "Elif: 'The wall was silent today… a beautiful silence..'"
};
} else if (Math.random() < 0.5) {
return {
sanityChange: 5,
dialogue: "Elif: 'If this is real, then you're real. That’s good.'"
};
} else if (Math.random() < 0.6) {
return {
sanityChange: 5,
dialogue: "Elif: 'You believing me calms me down.'"
};
} else if (Math.random() < 0.7) {
return {
sanityChange: 5,
dialogue: "Elif: 'I painted a picture. I imagined you choosing the colors with me.'"
};
} else if (Math.random() < 0.8) {
return {
sanityChange: 5,
dialogue: "Elif: 'or the first time, I feel like myself'"
};
} else if (Math.random() < 0.9) {
return {
sanityChange: 5,
dialogue: "Elif: 'They only whisper now. Maybe they’ll stop completely soon..'"
};
} else {
return {
sanityChange: 5,
dialogue: "Elif: 'I trust you. That doesn’t happen often..'"
};
}
if (Math.random() < 0.1) {
return {
sanityChange: 5,
dialogue: "Elif: 'The voices are quieter. I think talking to you helps.'"
};
} else if (Math.random() < 0.2) {
return {
sanityChange: 5,
dialogue: "Elif: 'I feel less alone when you're here.'"
};
} else if (Math.random() < 0.3) {
return {
sanityChange: 5,
dialogue: "Elif: 'Your voice is different from the others. Clear and calm.'"
};
} else if (Math.random() < 0.4) {
return {
sanityChange: 5,
dialogue: "Elif: 'The wall was silent today… a beautiful silence.'"
};
} else if (Math.random() < 0.5) {
return {
sanityChange: 5,
dialogue: "Elif: 'If this is real, then you're real. That's good.'"
};
} else if (Math.random() < 0.6) {
return {
sanityChange: 5,
dialogue: "Elif: 'You believing me calms me down.'"
};
} else if (Math.random() < 0.7) {
return {
sanityChange: 5,
dialogue: "Elif: 'I painted a picture. I imagined you choosing the colors with me.'"
};
} else if (Math.random() < 0.8) {
return {
sanityChange: 5,
dialogue: "Elif: 'For the first time, I feel like myself.'"
};
} else if (Math.random() < 0.9) {
return {
sanityChange: 5,
dialogue: "Elif: 'They only whisper now. Maybe they'll stop completely soon.'"
};
} else {
return {
sanityChange: 5,
dialogue: "Elif: 'I trust you. That doesn't happen often.'"
};
}
if (actionType === "empathetic_talk") {
return {
sanityChange: 15,
dialogue: "Elif: 'Seslere inandın mı? Beni dinlediğin için teşekkürler.'"
};
} else if (actionType === "art_therapy") {
return {
sanityChange: 12,
dialogue: "Elif: 'Müzik sesleri daha sessiz yapıyor. Bu çok yardımcı oluyor.'"
};
} else {
return {
sanityChange: -8,
dialogue: "Elif: 'Sesler daha yüksek oluyor! Yaptığın şeyi sevmiyorlar!'"
};
}
} else if (character.personality === "bipolar") {
if (Math.random() < 0.1) {
return {
sanityChange: 5,
dialogue: "Kemal: 'My emotions feel balanced today. Talking to you helped.'"
};
} else if (Math.random() < 0.2) {
return {
sanityChange: 5,
dialogue: "Kemal: 'Smiling hasn't been this easy in a long time.'"
};
} else if (Math.random() < 0.3) {
return {
sanityChange: 5,
dialogue: "Kemal: 'The little things we do together keep me alive.'"
};
} else if (Math.random() < 0.4) {
return {
sanityChange: 5,
dialogue: "Kemal: 'My energy is high, but this time it doesn't scare me.'"
};
} else if (Math.random() < 0.5) {
return {
sanityChange: 5,
dialogue: "Kemal: 'Even my lows don't crush me when you're around.'"
};
} else if (Math.random() < 0.6) {
return {
sanityChange: 5,
dialogue: "Kemal: 'Sometimes a simple conversation is the meaning of life.'"
};
} else if (Math.random() < 0.7) {
return {
sanityChange: 5,
dialogue: "Kemal: 'Your eyes calm the storm inside me.'"
};
} else if (Math.random() < 0.8) {
return {
sanityChange: 5,
dialogue: "Kemal: 'Time moves differently with you here. I'm not alone.'"
};
} else if (Math.random() < 0.9) {
return {
sanityChange: 5,
dialogue: "Kemal: 'I'm trying to make peace with myself… starting with you.'"
};
} else {
return {
sanityChange: 5,
dialogue: "Kemal: 'I hope you'll be there when we finally leave this place.'"
};
}
if (Math.random() < 0.1) {
return {
sanityChange: -5,
dialogue: "Kemal: 'Come on! Let's dance! Why are you still standing?!'"
};
} else if (Math.random() < 0.2) {
return {
sanityChange: -5,
dialogue: "Kemal: 'Nothing matters. Why are we even trying?'"
};
} else if (Math.random() < 0.3) {
return {
sanityChange: -5,
dialogue: "Kemal: 'I painted something new! Should we cover all the walls with it?'"
};
} else if (Math.random() < 0.4) {
return {
sanityChange: -5,
dialogue: "Kemal: 'I really love you today. That might change tomorrow, but right now it matters.'"
};
} else if (Math.random() < 0.5) {
return {
sanityChange: -5,
dialogue: "Kemal: 'This house is boring. What if we knock down a wall?'"
};
} else if (Math.random() < 0.6) {
return {
sanityChange: -5,
dialogue: "Kemal: 'I hate you. But don't take it seriously. It'll pass.'"
};
} else if (Math.random() < 0.7) {
return {
sanityChange: -5,
dialogue: "Kemal: 'Nobody understands me. Not even you. Especially you.'"
};
} else if (Math.random() < 0.8) {
return {
sanityChange: -5,
dialogue: "Kemal: 'I'm so high right now. I don't want to fall.'"
};
} else if (Math.random() < 0.9) {
return {
sanityChange: -5,
dialogue: "Kemal: 'If we're going to die, let's do it with a beautiful chord.'"
};
} else {
return {
sanityChange: -5,
dialogue: "Kemal: 'Don't forget me, okay? I sometimes forget myself.'"
};
}
if (character.currentMood === "manic") {
if (actionType === "empathetic_talk") {
return {
sanityChange: -5,
dialogue: "Kemal: 'Konuşmak sıkıcı! Hadi tüm duvarları boyayalım ve dans edelim!'"
};
} else if (actionType === "art_therapy") {
return {
sanityChange: 10,
dialogue: "Kemal: 'EVET! Bu mükemmel! Harika bir şey yaratalım!'"
};
} else {
return {
sanityChange: -10,
dialogue: "Kemal: 'Beni yavaşlatmaya çalışıyorsun! Her şey için enerjim var!'"
};
}
} else if (character.currentMood === "depressive") {
if (actionType === "empathetic_talk") {
return {
sanityChange: 12,
dialogue: "Kemal: 'Umursayan birinin olması iyi hissettiriyor... belki bugün o kadar karanlık olmaz.'"
};
} else {
return {
sanityChange: 2,
dialogue: "Kemal: 'Artık hiçbir şeyin anlamı yok... ama denediğin için teşekkürler.'"
};
}
} else {
return {
sanityChange: 6,
dialogue: "Kemal: 'Çabanı takdir ediyorum. Bugün daha dengeli hissediyorum.'"
};
}
} else if (character.personality === "ocd") {
if (Math.random() < 0.1) {
return {
sanityChange: 5,
dialogue: "Zeynep: 'Today everything was almost perfect… and that was enough.'"
};
} else if (Math.random() < 0.2) {
return {
sanityChange: 5,
dialogue: "Zeynep: 'You helping me really put my mind at ease.'"
};
} else if (Math.random() < 0.3) {
return {
sanityChange: 5,
dialogue: "Zeynep: 'Organizing the room with you helped me feel better.'"
};
} else if (Math.random() < 0.4) {
return {
sanityChange: 5,
dialogue: "Zeynep: 'My thoughts are still fast, but not scary.'"
};
} else if (Math.random() < 0.5) {
return {
sanityChange: 5,
dialogue: "Zeynep: 'With you, I can accept things I can't control.'"
};
} else if (Math.random() < 0.6) {
return {
sanityChange: 5,
dialogue: "Zeynep: 'My hands still tremble, but I don't feel alone.'"
};
} else if (Math.random() < 0.7) {
return {
sanityChange: 5,
dialogue: "Zeynep: 'You're like my routine… reliable.'"
};
} else if (Math.random() < 0.8) {
return {
sanityChange: 5,
dialogue: "Zeynep: 'Sharing things feels like setting everything in order.'"
};
} else if (Math.random() < 0.9) {
return {
sanityChange: 5,
dialogue: "Zeynep: 'No breakdown today. Maybe it's because of you.'"
};
} else {
return {
sanityChange: 5,
dialogue: "Zeynep: 'I feel valuable, even without being perfect.'"
};
}
if (Math.random() < 0.1) {
return {
sanityChange: -5,
dialogue: "Zeynep: 'Did you fold the pillowcase symmetrically? Are you sure?'"
};
} else if (Math.random() < 0.2) {
return {
sanityChange: -5,
dialogue: "Zeynep: 'I washed my hands 11 times this morning. Still feels dirty.'"
};
} else if (Math.random() < 0.3) {
return {
sanityChange: -5,
dialogue: "Zeynep: 'Everything needs its place. You… don't seem to have one.'"
};
} else if (Math.random() < 0.4) {
return {
sanityChange: -5,
dialogue: "Zeynep: 'If I don't spin this pen three times… someone might die.'"
};
} else if (Math.random() < 0.5) {
return {
sanityChange: -5,
dialogue: "Zeynep: 'Did you clean your shoes before stepping in?'"
};
} else if (Math.random() < 0.6) {
return {
sanityChange: -5,
dialogue: "Zeynep: 'Symmetry is divine order. Chaos breaks the soul.'"
};
} else if (Math.random() < 0.7) {
return {
sanityChange: -5,
dialogue: "Zeynep: 'That picture is crooked. If I leave, something bad will happen.'"
};
} else if (Math.random() < 0.8) {
return {
sanityChange: -5,
dialogue: "Zeynep: 'A voice tells me not to walk unless I take seven steps.'"
};
} else if (Math.random() < 0.9) {
return {
sanityChange: -5,
dialogue: "Zeynep: 'Dust... there's dust everywhere. Don't you see it?!'"
};
} else {
return {
sanityChange: -5,
dialogue: "Zeynep: 'Can you check... did you lock the door five times? Are you sure?'"
};
}
if (actionType === "organize") {
return {
sanityChange: 20,
dialogue: "Zeynep: 'Mükemmel! Artık her şey yerli yerinde. Çok daha iyi hissediyorum!'"
};
} else if (actionType === "empathetic_talk") {
return {
sanityChange: 5,
dialogue: "Zeynep: 'Düzen ihtiyacımı anladığın için teşekkürler.'"
};
} else {
return {
sanityChange: -8,
dialogue: "Zeynep: 'Hayır, hayır! Her şeyi dağınık yapıyorsun! Düzen yanlış!'"
};
}
} else if (character.personality === "anxious") {
if (Math.random() < 0.1) {
return {
sanityChange: 5,
dialogue: "Ege: 'Talking to you calms me down... my worries are decreasing.'"
};
} else if (Math.random() < 0.2) {
return {
sanityChange: 5,
dialogue: "Ege: 'I think I can sleep with less anxiety tonight.'"
};
} else if (Math.random() < 0.3) {
return {
sanityChange: 5,
dialogue: "Ege: 'I forgot to breathe... you reminded me.'"
};
} else if (Math.random() < 0.4) {
return {
sanityChange: 5,
dialogue: "Ege: 'I don't panic when I'm with you. This is very nice.'"
};
} else {
return {
sanityChange: 5,
dialogue: "Ege: 'Now I can think that not everything will go wrong.'"
};
}
if (Math.random() < 0.1) {
return {
sanityChange: -5,
dialogue: "Ege: 'What if something happens now? What if this house collapses?'"
};
} else if (Math.random() < 0.2) {
return {
sanityChange: -5,
dialogue: "Ege: 'My heart is beating too fast... I can't breathe.'"
};
} else if (Math.random() < 0.3) {
return {
sanityChange: -5,
dialogue: "Ege: 'I can't stop my worries... I keep thinking bad things.'"
};
} else if (Math.random() < 0.4) {
return {
sanityChange: -5,
dialogue: "Ege: 'We can't get out of here, can we? We'll stay here forever.'"
};
} else {
return {
sanityChange: -5,
dialogue: "Ege: 'Everything is going wrong... nothing is going as planned.'"
};
}
if (actionType === "empathetic_talk") {
return {
sanityChange: 12,
dialogue: "Ege: 'Thank you for being so patient with me... this makes me feel much better.'"
};
} else if (actionType === "give_space") {
return {
sanityChange: 8,
dialogue: "Ege: 'I needed to be alone for a while... thank you.'"
};
} else {
return {
sanityChange: -5,
dialogue: "Ege: 'This makes me even more anxious... please approach slowly.'"
};
}
} else if (character.personality === "did") {
if (character.currentMood === "gentle") {
if (Math.random() < 0.1) {
return {
sanityChange: 5,
dialogue: "Mehmet: 'Talking to you quiets the noise in my head.'"
};
} else if (Math.random() < 0.2) {
return {
sanityChange: 5,
dialogue: "Mehmet: 'I forgot I could connect with someone. You reminded me.'"
};
} else if (Math.random() < 0.3) {
return {
sanityChange: 5,
dialogue: "Mehmet: 'I want to play chess with you because you care.'"
};
} else if (Math.random() < 0.4) {
return {
sanityChange: 5,
dialogue: "Mehmet: 'If someone like you exists… maybe the war inside can end.'"
};
} else {
return {
sanityChange: 5,
dialogue: "Mehmet: 'Being kind isn't just a mask. With you, it feels real.'"
};
}
} else if (character.currentMood === "child") {
if (Math.random() < 0.1) {
return {
sanityChange: 5,
dialogue: "Mehmet (Child): 'I'm so happy today! Playing with you was fun!'"
};
} else if (Math.random() < 0.2) {
return {
sanityChange: 5,
dialogue: "Mehmet (Child): 'You gave me cake! That's my favorite!'"
};
} else if (Math.random() < 0.3) {
return {
sanityChange: 5,
dialogue: "Mehmet (Child): 'I'm not a bad person. You showed me that.'"
};
} else if (Math.random() < 0.4) {
return {
sanityChange: 5,
dialogue: "Mehmet (Child): 'I wish you were my big brother.'"
};
} else {
return {
sanityChange: 5,
dialogue: "Mehmet (Child): 'I'm not scared anymore… because you're here.'"
};
}
} else {
// dark mood
if (Math.random() < 0.1) {
return {
sanityChange: 5,
dialogue: "Mehmet (Dark): 'When I talk to you, the darkness sometimes goes quiet.'"
};
} else if (Math.random() < 0.2) {
return {
sanityChange: 5,
dialogue: "Mehmet (Dark): 'Your words… even the others inside are listening.'"
};
} else if (Math.random() < 0.3) {
return {
sanityChange: 5,
dialogue: "Mehmet (Dark): 'I used to want to be alone… but not with you.'"
};
} else if (Math.random() < 0.4) {
return {
sanityChange: 5,
dialogue: "Mehmet (Dark): 'I felt light inside for the first time. Short, but real.'"
};
} else {
return {
sanityChange: 5,
dialogue: "Mehmet (Dark): 'I don't want to be afraid anymore. Maybe… you can help.'"
};
}
}
if (character.currentMood === "gentle") {
if (Math.random() < 0.1) {
return {
sanityChange: 5,
dialogue: "Mehmet: 'What this house lacks is art. Maybe we can fix that together.'"
};
} else if (Math.random() < 0.2) {
return {
sanityChange: 5,
dialogue: "Mehmet: 'Empty shelves bother me. It's disrespectful to the works.'"
};
} else if (Math.random() < 0.3) {
return {
sanityChange: 5,
dialogue: "Mehmet: 'I'd rather hear your voice than the one in my mind.'"
};
} else if (Math.random() < 0.4) {
return {
sanityChange: 5,
dialogue: "Mehmet: 'I'd love to play chess with you. Let our minds compete.'"
};
} else {
return {
sanityChange: 5,
dialogue: "Mehmet: 'A cup of tea makes all darkness lighter.'"
};
}
} else if (character.currentMood === "child") {
if (Math.random() < 0.1) {
return {
sanityChange: 5,
dialogue: "Mehmet (Child): 'I hid! Did you count? I don't think you did!'"
};
} else if (Math.random() < 0.2) {
return {
sanityChange: 5,
dialogue: "Mehmet (Child): 'My teddy is gone. Did you see it?'"
};
} else if (Math.random() < 0.3) {
return {
sanityChange: 5,
dialogue: "Mehmet (Child): 'Will you tell me a story tonight?'"
};
} else if (Math.random() < 0.4) {
return {
sanityChange: 5,
dialogue: "Mehmet (Child): 'Pillow fight time!'"
};
} else {
return {
sanityChange: 5,
dialogue: "Mehmet (Child): 'I miss my mom… can you be her?'"
};
}
} else {
// dark mood
if (Math.random() < 0.1) {
return {
sanityChange: -10,
dialogue: "Mehmet (Dark): 'They left you too. I will as well.'"
};
} else if (Math.random() < 0.2) {
return {
sanityChange: -10,
dialogue: "Mehmet (Dark): 'This house hates you. I can hear it.'"
};
} else if (Math.random() < 0.3) {
return {
sanityChange: -10,
dialogue: "Mehmet (Dark): 'My darkness spoke to yours. We know the deal.'"
};
} else if (Math.random() < 0.4) {
return {
sanityChange: -10,
dialogue: "Mehmet (Dark): 'There's no escape. You've already died.'"
};
} else {
return {
sanityChange: -10,
dialogue: "Mehmet (Dark): 'Don't touch me. I'll burn you.'"
};
}
}
if (character.currentMood === "gentle") {
return {
sanityChange: 10,
dialogue: "Mehmet: 'Günaydın dostum, nezaketin benim için çok anlamlı.'"
};
} else if (character.currentMood === "child") {
if (actionType === "empathetic_talk") {
return {
sanityChange: 15,
dialogue: "Mehmet (Çocuk): 'Benimle oynayacak mısın? Korkuyorum ve yalnızım!'"
};
} else {
return {
sanityChange: 8,
dialogue: "Mehmet (Çocuk): 'Bu eğlenceli! Bana karşı çok naziksin!'"
};
}
} else {
// dark mood
if (actionType === "give_space") {
return {
sanityChange: 5,
dialogue: "Mehmet (Karanlık): 'Akıllıca seçim. Şu anda yanımda olmak istemezsin.'"
};
} else {
return {
sanityChange: -15,
dialogue: "Mehmet (Karanlık): 'Acınası girişimlerin beni iğrendiriyor. Uzak dur.'"
};
}
}
}
// Impostor gives specific dialogue responses
if (character.isImpostor) {
// 70% chance for positive dialogue, 30% chance for negative dialogue
var usePositive = Math.random() < 0.7;
var selectedDialogue;
var sanityChange;
if (usePositive) {
selectedDialogue = character.name + ": '" + impostorPositiveDialogues[Math.floor(Math.random() * impostorPositiveDialogues.length)] + "'";
sanityChange = 8; // Positive response gives good sanity change
} else {
selectedDialogue = character.name + ": '" + impostorNegativeDialogues[Math.floor(Math.random() * impostorNegativeDialogues.length)] + "'";
sanityChange = -5; // Negative response gives slight sanity loss
}
return {
sanityChange: sanityChange,
dialogue: selectedDialogue
};
}
return {
sanityChange: 2,
dialogue: character.name + " çabanızı takdir ediyor."
};
}
// Create Action Buttons
for (var i = 0; i < actions.length; i++) {
var action = actions[i];
var button = new ActionButton(action.text + " (-" + action.cost + ")", function (actionData) {
return function () {
if (selectedCharacter && timeLeft >= actionData.cost) {
timeLeft -= actionData.cost;
// Check for repetitive behavior
if (selectedCharacter.lastAction === actionData.text) {
selectedCharacter.sameActionCount++;
if (selectedCharacter.sameActionCount >= 3) {
selectedCharacter.updateSanity(-50);
dialogueBox.showDialogue(selectedCharacter.name + ": 'Yeter artık! Hep aynı şeyi yapıyorsun, bıktım bu davranıştan!'", 3000);
selectedCharacter.sameActionCount = 0; // Reset counter after penalty
selectedCharacter.lastAction = ""; // Reset last action
// Penalize all characters' sanity
for (var j = 0; j < characters.length; j++) {
characters[j].updateSanity(-30);
}
hideCharacterActions();
updateUI();
return;
}
} else {
selectedCharacter.sameActionCount = 1;
}
selectedCharacter.lastAction = actionData.text;
actionData.effect(selectedCharacter);
selectedCharacter.lastInteractionDay = currentDay;
hideCharacterActions();
updateUI();
}
};
}(action));
button.y = i * 100;
actionButtons.push(button);
actionButtonsContainer.addChild(button);
}
// Add Close Button
var closeButton = new ActionButton("Kapat", function () {
hideCharacterActions();
});
closeButton.y = actions.length * 100;
actionButtonsContainer.addChild(closeButton);
// Next Day Button
var nextDayButton = new ActionButton("Next Day", function () {
if (currentDay < 20) {
// Show tutorial hint for first day progression
if (tutorialActive && currentDay === 1) {
dialogueBox.showDialogue("Good! This is how days progress. Don't forget to interact with characters every day.", 3000);
tutorialActive = false; // End tutorial after first day
}
nextDay();
}
});
nextDayButton.x = 1024;
nextDayButton.y = 2500;
game.addChild(nextDayButton);
// Make the next day button text much larger
var nextDayButtonChildren = nextDayButton.children;
for (var i = 0; i < nextDayButtonChildren.length; i++) {
if (nextDayButtonChildren[i] instanceof Text2) {
nextDayButtonChildren[i].size = 700;
}
}
// Go to Day 19 Button (for testing)
var goToDay19Button = new ActionButton("Go to Day 19", function () {
currentDay = 19;
timeLeft = maxTimePerDay;
updateUI();
dialogueBox.showDialogue("Jumped to Day 19! Only one day left to find the impostor!", 3000);
});
goToDay19Button.x = 1536;
goToDay19Button.y = 2500;
game.addChild(goToDay19Button);
// Make the go to day 19 button text larger
var goToDay19ButtonChildren = goToDay19Button.children;
for (var i = 0; i < goToDay19ButtonChildren.length; i++) {
if (goToDay19ButtonChildren[i] instanceof Text2) {
goToDay19ButtonChildren[i].size = 500;
}
}
function showCharacterActions() {
actionMenuVisible = true;
actionButtonsContainer.visible = true;
// Update button availability based on time
for (var i = 0; i < actionButtons.length && i < actions.length; i++) {
var button = actionButtons[i];
var actionCost = actions[i].cost;
if (timeLeft >= actionCost) {
button.alpha = 1.0;
} else {
button.alpha = 0.5;
}
}
// Add special actions for Kemal's manic episode
if (selectedCharacter.name === "Kemal" && selectedCharacter.currentMood === "manic") {
var calmKemalButton = new ActionButton("Yatıştırıcı Konuşma", function () {
var success = Math.random() > 0.5;
if (success) {
selectedCharacter.updateSanity(20);
var calmDialogues = ["Kemal: 'Tamam, tamam... belki haklısın. Biraz sakinleşmeye çalışacağım.'", "Kemal: 'Senin sesinde bir şey var... beni rahatlatıyor. Teşekkür ederim.'", "Kemal: 'Bu kadar sinirli olmaya gerek yok değil mi? Özür dilerim.'", "Kemal: 'Derin nefes alacağım... sen de benimle al, olur mu?'"];
dialogueBox.showDialogue(calmDialogues[Math.floor(Math.random() * calmDialogues.length)], 3000);
} else {
selectedCharacter.updateSanity(-10);
var resistDialogues = ["Kemal: 'Hayır! Beni durdurmaya çalışıyorsun! Özgür olmak istiyorum!'", "Kemal: 'Senin sakin sesine ihtiyacım yok! Enerjimi öldürmeye çalışıyorsun!'", "Kemal: 'Bırak beni! Bu hissi yaşamak istiyorum, engelleme beni!'", "Kemal: 'Anlamıyorsun! Bu enerji benim gerçek halim!'"];
dialogueBox.showDialogue(resistDialogues[Math.floor(Math.random() * resistDialogues.length)], 3000);
}
hideCharacterActions();
updateUI();
});
calmKemalButton.y = actionButtons.length * 100;
actionButtons.push(calmKemalButton);
actionButtonsContainer.addChild(calmKemalButton);
var tackleKemalButton = new ActionButton("Sözle Engelleme", function () {
var risk = Math.random() > 0.7;
if (risk) {
selectedCharacter.updateSanity(-30);
var blockDialogues = ["Kemal: 'Dur! Neden beni engelliyorsun? Sadece konuşmak istiyorum!'", "Kemal: 'Pekala, pekala... belki biraz fazla heyecanlandım. Ama yine de haklıyım!'", "Kemal: 'Tamam duruyorum! Ama dinle beni, bu çok önemli!'"];
dialogueBox.showDialogue(blockDialogues[Math.floor(Math.random() * blockDialogues.length)], 3000);
} else {
selectedCharacter.updateSanity(-10);
var resistBlockDialogues = ["Kemal: 'Hayır! Beni susturamayacaksın! Konuşacağım!'", "Kemal: 'Bu benim hakkım! Düşüncelerimi ifade etmeliyim!'", "Kemal: 'Engelleyemezsin beni! Herkese söyleyeceğim!'"];
dialogueBox.showDialogue(resistBlockDialogues[Math.floor(Math.random() * resistBlockDialogues.length)], 3000);
}
hideCharacterActions();
updateUI();
});
tackleKemalButton.y = (actionButtons.length + 1) * 100;
actionButtons.push(tackleKemalButton);
actionButtonsContainer.addChild(tackleKemalButton);
var hideKemalButton = new ActionButton("Sessizce Dinle", function () {
selectedCharacter.updateSanity(-10);
var observeDialogues = ["Kemal: 'Kimse beni dinlemiyor... sadece izliyorlar. Bu çok üzücü.'", "Kemal: 'Konuşacak kimse yok... hepsi sessizce bakıyor bana.'", "Kemal: 'Belki haklıydılar... belki gerçekten çok gürültücüydüm.'"];
dialogueBox.showDialogue(observeDialogues[Math.floor(Math.random() * observeDialogues.length)], 3000);
hideCharacterActions();
updateUI();
});
hideKemalButton.y = (actionButtons.length + 2) * 100;
actionButtons.push(hideKemalButton);
actionButtonsContainer.addChild(hideKemalButton);
var talkWithElifButton = new ActionButton("Elif’le konuş ve onunla birlikte Kemal'e ulaş", function () {
var success = Math.random() > 0.5;
if (success) {
selectedCharacter.updateSanity(20);
dialogueBox.showDialogue("Elif: 'Kemal, senin sesini duyuyor. Birlikte yaklaşalım.'", 3000);
} else {
selectedCharacter.updateSanity(-10);
dialogueBox.showDialogue("Kemal: 'Beni yavaşlatmaya çalışıyorsun! Her şey için enerjim var!'", 3000);
}
hideCharacterActions();
updateUI();
});
talkWithElifButton.y = (actionButtons.length + 3) * 100;
actionButtons.push(talkWithElifButton);
actionButtonsContainer.addChild(talkWithElifButton);
}
}
function hideCharacterActions() {
actionMenuVisible = false;
actionButtonsContainer.visible = false;
selectedCharacter = null;
}
function nextDay() {
currentDay++;
timeLeft = maxTimePerDay;
// Clear any floating text elements from previous day
var floatingTexts = game.children.filter(function (child) {
return child instanceof Text2 && child !== dayText && child !== timeText && child !== bookText;
});
for (var i = 0; i < floatingTexts.length; i++) {
floatingTexts[i].destroy();
}
// Hide dialogue box
dialogueBox.visible = false;
// Check for aggressive character attacks during night
for (var i = 0; i < characters.length; i++) {
var character = characters[i];
if (character.isAggressive && Math.random() < 0.3) {
LK.getSound('crash').play();
LK.getSound('horror').play();
showEnding("KÖTÜ", character.name + " gece çok dengesizleşti ve saldırdı. Durum kontrol edilemez hale geldi.");
return;
}
}
// Daily sanity decay for characters not interacted with
for (var i = 0; i < characters.length; i++) {
var character = characters[i];
if (character.lastInteractionDay < currentDay - 1) {
character.updateSanity(-5);
}
// Mood changes for specific characters
if (character.personality === "bipolar") {
if (Math.random() < 0.4) {
var moods = ["manic", "depressive", "normal"];
character.currentMood = moods[Math.floor(Math.random() * moods.length)];
}
} else if (character.personality === "did") {
// DID character changes personality based on time of day
var hour = (maxTimePerDay - timeLeft) / maxTimePerDay * 24;
if (hour < 8) {
character.currentMood = "gentle";
} else if (hour < 16) {
character.currentMood = "child";
} else if (hour < 20) {
character.currentMood = "gentle";
} else {
character.currentMood = "dark";
}
}
// Random daily events
if (Math.random() < 0.3) {
var randomChange = Math.floor(Math.random() * 10) - 5;
character.updateSanity(randomChange);
}
}
}
updateUI();
checkGameEnd();
if (currentDay > 7) {
dialogueBox.showDialogue("Day " + currentDay + " begins. Everyone looks tired after spending a night in the house.", 3000);
}
function updateUI() {
dayText.setText("Day " + currentDay + "/20");
timeText.setText("Time: " + timeLeft);
if (timeLeft <= 20) {
timeText.tint = 0xff0000;
} else if (timeLeft <= 50) {
timeText.tint = 0xffa500;
} else {
timeText.tint = 0xffff00;
}
}
function checkGameEnd() {
var dangerousCount = 0;
var totalSanity = 0;
for (var i = 0; i < characters.length; i++) {
if (characters[i].isDangerous) {
dangerousCount++;
}
totalSanity += characters[i].sanity;
}
// Bad ending - too many dangerous characters
if (dangerousCount >= 3) {
LK.getSound('crash').play();
LK.getSound('horror').play();
LK.getSound('scream').play();
showEnding("KÖTÜ", "Ev kaosa büründü. Çok fazla kişi krizde olduğu için hayatta kalmak imkansız hale geldi. Kendin dahil kimseyi kurtaramadın.");
return;
}
// Check if reached day 20
if (currentDay > 20) {
if (impostorFound) {
// They found the impostor AND survived 20 days = perfect victory!
showEnding("KAZANDIN", "Mükemmel! İmpostörü " + impostorFoundDay + ". günde buldunuz ve 20 gün boyunca hayatta kaldınız! Gerçek bir zafer!");
} else {
// If they survived 20 days without finding impostor = show revelation sequence
var impostorName = characters[impostorIndex].name;
// Create dramatic revelation sequence
currentGameState = "gameOver";
// Clear dialogue box
dialogueBox.visible = false;
// Create black overlay first
var blackOverlay = game.attachAsset('endingOverlay', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366,
alpha: 1.0
});
// Show the taunt message
var taunMessage = new Text2("Did you think you could escape?", {
size: 72,
fill: 0xFF0000,
wordWrap: true,
wordWrapWidth: 1600
});
taunMessage.anchor.set(0.5, 0.5);
taunMessage.x = 1024;
taunMessage.y = 1366;
game.addChild(taunMessage);
// After a delay, make screen go dark and show impostor
LK.setTimeout(function () {
// Make screen completely black
blackOverlay.alpha = 1.0;
taunMessage.destroy();
// Show the impostor character suddenly
var impostor = characters[impostorIndex];
var impostorReveal = game.attachAsset('characterCard' + impostorName, {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366,
scaleX: 2.0,
scaleY: 2.0
});
impostorReveal.tint = 0xff0000; // Red tint for dramatic effect
// Add red glowing eyes
var leftEye = game.attachAsset('characterEyes', {
anchorX: 0.5,
anchorY: 0.5,
x: 974,
y: 1316
});
var rightEye = game.attachAsset('characterEyes', {
anchorX: 0.5,
anchorY: 0.5,
x: 1074,
y: 1316
});
// Play horror sounds
LK.getSound('horror').play();
LK.getSound('crash').play();
LK.getSound('scream').play();
// Show final losing message
LK.setTimeout(function () {
showEnding("KAYBETTİN", "20 gün geçti ama impostörü bulamadınız! " + impostorName + " aslında akıl hastası değildi ve sizi kandırmayı başardı. Kıyma makinesinde yok edildiniz!");
}, 3000);
}, 2000);
}
return;
}
}
function showEnding(type, message) {
currentGameState = "gameOver";
// Play lose sound when player loses
if (type === "KAYBETTİN" || type === "KÖTÜ") {
LK.getSound('686184b09666db472fa4477a').play();
}
// Clear all floating text elements and mission texts
var floatingTexts = game.children.filter(function (child) {
return child instanceof Text2 && child !== dayText && child !== timeText && child !== bookText;
});
for (var i = 0; i < floatingTexts.length; i++) {
floatingTexts[i].destroy();
}
// Clear dialogue box
dialogueBox.visible = false;
var endingOverlay = game.attachAsset('endingOverlay', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366,
alpha: 0.8
});
var endingTitle = new Text2(type + " SON", {
size: 96,
fill: type === "İYİ" ? "#00ff00" : type === "NÖTR" ? "#ffff00" : "#ff0000"
});
endingTitle.anchor.set(0.5, 0.5);
endingTitle.x = 1024;
endingTitle.y = 1000;
game.addChild(endingTitle);
var endingText = new Text2(message, {
size: 48,
fill: 0xFFFFFF,
wordWrap: true,
wordWrapWidth: 1600
});
endingText.anchor.set(0.5, 0.5);
endingText.x = 1024;
endingText.y = 1400;
game.addChild(endingText);
var restartButton = new ActionButton("Tekrar Oyna", function () {
LK.showGameOver();
});
restartButton.x = 1024;
restartButton.y = 1800;
game.addChild(restartButton);
// Update high score based on ending
var score = 0;
if (type === "İYİ") {
score = 100;
} else if (type === "NÖTR") {
score = 50;
} else {
score = 10;
}
LK.setScore(score);
}
// Game loop
game.update = function () {
if (currentGameState === "playing") {
// Time naturally decreases
if (LK.ticks % 60 === 0 && timeLeft > 0) {
timeLeft--;
updateUI();
if (timeLeft <= 0) {
dialogueBox.showDialogue("Day ended. Time to rest and prepare for tomorrow.", 2000);
}
}
// Check for game end conditions periodically
if (LK.ticks % 180 === 0) {
checkGameEnd();
}
}
// Update Dynamic Background Effects
// Calculate time-based color shifts for atmosphere
var timePhase = LK.ticks * 0.01 % (Math.PI * 2);
var dayPhase = currentDay / 20 * Math.PI;
var sanityPhase = chaosIntensity * Math.PI;
// Create dynamic background color that shifts based on time, day, and sanity
var baseRed = Math.floor(45 + Math.sin(timePhase) * 10 + Math.sin(dayPhase) * 15 + chaosIntensity * 30);
var baseGreen = Math.floor(24 + Math.cos(timePhase * 0.7) * 8 + Math.sin(dayPhase * 0.8) * 10 + chaosIntensity * 20);
var baseBue = Math.floor(16 + Math.sin(timePhase * 1.3) * 6 + Math.cos(dayPhase * 1.2) * 8 + chaosIntensity * 40);
// Ensure values stay in valid range
baseRed = Math.max(0, Math.min(255, baseRed));
baseGreen = Math.max(0, Math.min(255, baseGreen));
baseBue = Math.max(0, Math.min(255, baseBue));
var dynamicBgColor = baseRed << 16 | baseGreen << 8 | baseBue;
game.setBackgroundColor(dynamicBgColor);
// Calculate chaos intensity based on average sanity
var totalSanity = 0;
for (var i = 0; i < characters.length; i++) {
totalSanity += characters[i].sanity;
}
chaosIntensity = 1.0 - totalSanity / (characters.length * 100);
// Update chaos particles with enhanced behaviors
for (var i = 0; i < chaosParticles.length; i++) {
var particle = chaosParticles[i];
if (particle.speedX !== undefined) {
// Moving particles with enhanced motion
var motionMultiplier = 1.0 + Math.sin(LK.ticks * 0.02 + i) * 0.3;
particle.x += particle.speedX * chaosIntensity * motionMultiplier;
particle.y += particle.speedY * chaosIntensity * motionMultiplier;
particle.rotation += particle.rotationSpeed * (1.0 + chaosIntensity);
// Add subtle gravitational pull towards center for some particles
if (i % 3 === 0) {
var centerX = 1024;
var centerY = 1366;
var dx = centerX - particle.x;
var dy = centerY - particle.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance > 100) {
particle.x += dx / distance * 0.3 * chaosIntensity;
particle.y += dy / distance * 0.3 * chaosIntensity;
}
}
// Wrap around screen
if (particle.x < -50) {
particle.x = 2098;
}
if (particle.x > 2098) {
particle.x = -50;
}
if (particle.y < -50) {
particle.y = 2782;
}
if (particle.y > 2782) {
particle.y = -50;
}
// Enhanced horror-themed color changes with atmosphere consideration
if (Math.random() < 0.05 * chaosIntensity) {
var horrorColors = [0x8b0000, 0x800080, 0x2f4f4f, 0x8b008b, 0x696969, 0x000000, 0x4b0082, 0x800000];
var timeBasedColors = [0x4a4a4a, 0x5a3d2b, 0x3d2616, 0x6b4423]; // Day/time influenced colors
var colorSet = chaosIntensity > 0.5 ? horrorColors : horrorColors.concat(timeBasedColors);
particle.tint = colorSet[Math.floor(Math.random() * colorSet.length)];
}
// Enhanced shadow fade effect with breathing motion
if (particle.fadeDirection !== undefined) {
var breathingEffect = Math.sin(LK.ticks * 0.03 + i * 0.5) * 0.2;
particle.alpha += (particle.fadeDirection * 0.02 + breathingEffect * 0.01) * chaosIntensity;
if (particle.alpha <= 0.1 || particle.alpha >= 0.8) {
particle.fadeDirection *= -1;
}
// Add subtle scale breathing for shadows
particle.scaleX = (2 + Math.random() * 3) * (1.0 + breathingEffect * 0.1);
}
} else if (particle.pulseSpeed !== undefined) {
// Enhanced pulsing circles with complex motion
particle.pulsePhase += particle.pulseSpeed * (1.0 + chaosIntensity * 0.5);
var pulseIntensity = 1.0 + Math.sin(particle.pulsePhase) * 0.7 * chaosIntensity;
var secondaryPulse = Math.cos(particle.pulsePhase * 2.3) * 0.3;
particle.scaleX = particle.scaleY = pulseIntensity + secondaryPulse;
particle.alpha = 0.2 + Math.sin(particle.pulsePhase) * 0.4 * chaosIntensity + secondaryPulse * 0.1;
// Orbital motion for some circles
if (i % 4 === 0) {
var orbitRadius = 200 + Math.sin(LK.ticks * 0.01 + i) * 100;
var orbitSpeed = LK.ticks * 0.02 + i;
particle.x = 1024 + Math.cos(orbitSpeed) * orbitRadius;
particle.y = 1366 + Math.sin(orbitSpeed * 0.7) * orbitRadius * 0.6;
}
// Enhanced color shifting for circles
if (Math.random() < 0.03 * chaosIntensity) {
var circleColors = [0x8b0000, 0x4b0082, 0x2f2f2f, 0x800000, 0x8b008b];
var atmosphericColors = [0x4d3319, 0x5c4033, 0x3e2723]; // Atmospheric colors
var finalColors = chaosIntensity > 0.3 ? circleColors : circleColors.concat(atmosphericColors);
particle.tint = finalColors[Math.floor(Math.random() * finalColors.length)];
}
}
}
// Update chaos noise with enhanced atmospheric effects
for (var i = 0; i < chaosNoiseElements.length; i++) {
var noise = chaosNoiseElements[i];
// Create flickering effect that resembles floating embers or dust
var flicker = Math.sin(LK.ticks * 0.05 + i * 2) * 0.3 + Math.random() * 0.2;
noise.alpha = (Math.random() * 0.3 + 0.2 + flicker) * chaosIntensity;
// Slow floating motion for atmospheric depth
noise.y -= 0.5 + Math.sin(LK.ticks * 0.01 + i) * 0.3;
noise.x += Math.sin(LK.ticks * 0.008 + i * 1.5) * 0.8;
if (noise.y < -20) {
noise.y = 2752;
noise.x = Math.random() * 2048;
}
if (noise.x < -20) noise.x = 2068;
if (noise.x > 2068) noise.x = -20;
// Enhanced repositioning and color changes
if (Math.random() < 0.1 * chaosIntensity) {
noise.x = Math.random() * 2048;
noise.y = Math.random() * 2732;
// Enhanced atmospheric colors including warm tones
var noiseColors = [0x8b0000, 0x2f4f4f, 0x8b008b, 0x000000, 0x800080, 0x4b0082, 0x696969];
var warmColors = [0x8b4513, 0x654321, 0x5d4e37, 0x8b7355]; // Warm atmospheric tones
var environmentColors = chaosIntensity > 0.4 ? noiseColors : noiseColors.concat(warmColors);
noise.tint = environmentColors[Math.floor(Math.random() * environmentColors.length)];
}
// Enhanced atmospheric scaling with breathing and depth effects
var depthEffect = noise.y / 2732 * 0.3 + 0.7; // Smaller when higher (further away)
var breathingScale = Math.sin(LK.ticks * 0.02 + i) * 0.3 * chaosIntensity;
var organicScale = Math.cos(LK.ticks * 0.03 + i * 1.7) * 0.2;
noise.scaleX = (1.0 + breathingScale + organicScale) * depthEffect;
noise.scaleY = (1.0 + breathingScale + organicScale * 0.8) * depthEffect;
// Add rotation for some noise elements to create more dynamic movement
if (i % 5 === 0) {
noise.rotation += 0.01 + chaosIntensity * 0.02;
}
}
};
// Knowledge Book
var knowledgeBook = game.attachAsset('knowledgeBook', {
anchorX: 0.5,
anchorY: 0.5,
x: 1900,
y: 200
});
var bookText = new Text2("Book", {
size: 48,
fill: 0xFFFFFF
});
bookText.anchor.set(0.5, 0.5);
bookText.x = 1900;
bookText.y = 240;
game.addChild(bookText);
// Notebook
var notebook = game.attachAsset('notebook', {
anchorX: 0.5,
anchorY: 0.5,
x: 1700,
y: 200
});
var notebookText = new Text2("Notebook", {
size: 48,
fill: 0xFFFFFF
});
notebookText.anchor.set(0.5, 0.5);
notebookText.x = 1700;
notebookText.y = 240;
game.addChild(notebookText);
knowledgeBook.down = function (x, y, obj) {
// Show tutorial hint for knowledge book
if (tutorialActive) {
dialogueBox.showDialogue("Great! This book provides information about mental health disorders. Use it to understand the characters.", 3000);
}
showKnowledgeBook();
LK.getSound('click').play();
};
notebook.down = function (x, y, obj) {
// Show tutorial hint for notebook
if (tutorialActive) {
dialogueBox.showDialogue("This notebook contains the characters' illnesses. Use it to see who has what condition.", 3000);
}
showNotebook();
LK.getSound('click').play();
};
var notebookVisible = false;
function showNotebook() {
if (notebookVisible) {
return;
}
notebookVisible = true;
var notebookOverlay = game.attachAsset('endingOverlay', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366,
alpha: 0.9
});
var notebookTitle = new Text2("CHARACTER DISORDERS NOTEBOOK", {
size: 72,
fill: 0xFFFFFF
});
notebookTitle.anchor.set(0.5, 0.5);
notebookTitle.x = 1024;
notebookTitle.y = 400;
game.addChild(notebookTitle);
var yPos = 600;
for (var i = 0; i < charactersData.length; i++) {
var data = charactersData[i];
var characterName = new Text2(data.name + ":", {
size: 60,
fill: 0xFFD700
});
characterName.anchor.set(0.5, 0);
characterName.x = 1024;
characterName.y = yPos;
game.addChild(characterName);
var characterDisorder = new Text2(data.disorder, {
size: 48,
fill: 0xFFFFFF,
wordWrap: true,
wordWrapWidth: 1600
});
characterDisorder.anchor.set(0.5, 0);
characterDisorder.x = 1024;
characterDisorder.y = yPos + 60;
game.addChild(characterDisorder);
yPos += 150;
}
// Add "Someone is fake" text at the bottom
var fakeWarningText = new Text2("Someone is fake", {
size: 56,
fill: 0xFF0000,
wordWrap: true,
wordWrapWidth: 1600
});
fakeWarningText.anchor.set(0.5, 0);
fakeWarningText.x = 1024;
fakeWarningText.y = yPos + 20;
game.addChild(fakeWarningText);
var closeNotebookButton = new ActionButton("Close Notebook", function () {
notebookVisible = false;
notebookOverlay.destroy();
notebookTitle.destroy();
// Destroy all character information elements
var allTextElements = game.children.filter(function (child) {
return child instanceof Text2 && child.y >= 400 && child.y <= 2000;
});
for (var m = 0; m < allTextElements.length; m++) {
if (allTextElements[m] !== dayText && allTextElements[m] !== timeText && allTextElements[m] !== bookText && allTextElements[m] !== notebookText) {
allTextElements[m].destroy();
}
}
closeNotebookButton.destroy();
});
closeNotebookButton.x = 1024;
closeNotebookButton.y = yPos + 120;
game.addChild(closeNotebookButton);
}
function showKnowledgeBook() {
if (knowledgeBookVisible) {
return;
}
knowledgeBookVisible = true;
var bookOverlay = game.attachAsset('endingOverlay', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366,
alpha: 0.9
});
var bookTitle = new Text2("MENTAL HEALTH BOOK", {
size: 72,
fill: 0xFFFFFF
});
bookTitle.anchor.set(0.5, 0.5);
bookTitle.x = 1024;
bookTitle.y = 400;
game.addChild(bookTitle);
var yPos = 600;
var disorders = Object.keys(disorderInfo);
for (var i = 0; i < disorders.length; i++) {
var disorder = disorders[i];
var info = disorderInfo[disorder];
var disorderTitle = new Text2(disorder, {
size: 72,
fill: 0xFFD700
});
disorderTitle.anchor.set(0.5, 0);
disorderTitle.x = 1024;
disorderTitle.y = yPos;
game.addChild(disorderTitle);
var disorderDesc = new Text2(info, {
size: 56,
fill: 0xFFFFFF,
wordWrap: true,
wordWrapWidth: 1600
});
disorderDesc.anchor.set(0.5, 0);
disorderDesc.x = 1024;
disorderDesc.y = yPos + 50;
game.addChild(disorderDesc);
yPos += 250;
}
var closeBookButton = new ActionButton("Close Book", function () {
knowledgeBookVisible = false;
bookOverlay.destroy();
bookTitle.destroy();
// Destroy all disorder information elements
var disorders = Object.keys(disorderInfo);
for (var j = 0; j < disorders.length; j++) {
var disorderElements = game.children.filter(function (child) {
return child instanceof Text2 && child.text && (child.text.indexOf(disorders[j]) !== -1 || child.text === disorderInfo[disorders[j]]);
});
for (var k = 0; k < disorderElements.length; k++) {
disorderElements[k].destroy();
}
}
// Also destroy any remaining text elements that might be part of the book
var allTextElements = game.children.filter(function (child) {
return child instanceof Text2 && child.y >= 400 && child.y <= 2000;
});
for (var m = 0; m < allTextElements.length; m++) {
if (allTextElements[m] !== dayText && allTextElements[m] !== timeText && allTextElements[m] !== bookText) {
allTextElements[m].destroy();
}
}
closeBookButton.destroy();
});
closeBookButton.x = 1024;
closeBookButton.y = yPos + 100;
game.addChild(closeBookButton);
}
// Tutorial System - Reset for new game
var tutorialActive = true;
var tutorialStep = 0;
var tutorialContainer = null;
function startTutorial() {
tutorialActive = true;
tutorialStep = 0;
// Start playing tutorial music
LK.playMusic('tutorialMusic');
showTutorialStep();
}
function showTutorialStep() {
// Clear previous tutorial container
if (tutorialContainer) {
tutorialContainer.destroy();
}
tutorialContainer = new Container();
tutorialContainer.x = 1024;
tutorialContainer.y = 1366;
game.addChild(tutorialContainer);
var tutorialMessages = ["WELCOME! You must survive 20 days with 5 people in this house.", "WARNING: There is an IMPOSTOR among you! This person is not mentally ill and is deceiving you!", "Your goal: Survive 20 days and find out who the impostor is.", "You can accuse someone by clicking on them 3 times.", "If you find correctly you win! If you choose wrong you will be destroyed in the meat grinder!", "Each character has different mental health problems. The impostor may appear more stable.", "CLICK on characters and interact. Each action takes time.", "Monitor the characters' mental health. The impostor usually behaves more normally.", "WARNING: When someone's sanity drops to 30 or below, you will hear a special warning sound indicating danger."];
if (tutorialStep < tutorialMessages.length) {
var tutorialText = new Text2(tutorialMessages[tutorialStep], {
size: 48,
fill: 0xFFD700,
wordWrap: true,
wordWrapWidth: 1600
});
tutorialText.anchor.set(0.5, 0.5);
tutorialContainer.addChild(tutorialText);
var nextButton = new ActionButton("Continue", function () {
tutorialStep++;
if (tutorialStep >= tutorialMessages.length) {
endTutorial();
} else {
showTutorialStep();
}
});
nextButton.y = 150;
tutorialContainer.addChild(nextButton);
var skipButton = new ActionButton("Skip Tutorial", function () {
endTutorial();
});
skipButton.y = 250;
tutorialContainer.addChild(skipButton);
}
}
function endTutorial() {
tutorialActive = false;
// Stop tutorial music when tutorial ends
LK.stopMusic();
if (tutorialContainer) {
tutorialContainer.destroy();
tutorialContainer = null;
}
// Create red screen overlay
var redOverlay = game.attachAsset('endingOverlay', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366,
alpha: 0.7
});
redOverlay.tint = 0xFF0000; // Make it red
// Show red warning message at end of tutorial
var warningContainer = new Container();
warningContainer.x = 1024;
warningContainer.y = 1366;
game.addChild(warningContainer);
var warningText = new Text2("Don't do it they want your soul you can't escape(:", {
size: 60,
fill: 0xFF0000,
// Red text color
wordWrap: true,
wordWrapWidth: 1600
});
warningText.anchor.set(0.5, 0.5);
warningContainer.addChild(warningText);
// Start screen shaking effect
var shakeInterval = LK.setInterval(function () {
var shakeX = (Math.random() - 0.5) * 20;
var shakeY = (Math.random() - 0.5) * 20;
game.x = shakeX;
game.y = shakeY;
}, 50);
// Start playing the warning sound on loop with increased volume
var warningSound = LK.getSound('tutorialWarning');
var warningSoundTimer = LK.setInterval(function () {
warningSound.play();
}, 50); // Play every 50ms to create more intense continuous effect
var warningSkipButton = new ActionButton("Skip", function () {
// Stop all effects when skip button is pressed
LK.clearInterval(warningSoundTimer);
LK.clearInterval(shakeInterval);
// Reset game position
game.x = 0;
game.y = 0;
// Remove red overlay and warning container
redOverlay.destroy();
warningContainer.destroy();
// Show initial game dialogue after warning
dialogueBox.showDialogue("Day 1: You wake up with 5 people in a strange house. Everyone looks troubled.\nYou must help them survive for 20 days.", 4000);
});
warningSkipButton.y = 150;
warningContainer.addChild(warningSkipButton);
}
// Clear all existing game elements
var allGameElements = game.children.slice(); // Create a copy of the children array
for (var i = 0; i < allGameElements.length; i++) {
if (allGameElements[i] !== dayPanel && allGameElements[i] !== dayText && allGameElements[i] !== timeText && allGameElements[i] !== nextDayButton && allGameElements[i] !== knowledgeBook && allGameElements[i] !== bookText && allGameElements[i] !== notebook && allGameElements[i] !== notebookText && allGameElements[i] !== actionButtonsContainer && allGameElements[i] !== dialogueBox) {
allGameElements[i].destroy();
}
}
// Reset characters array and recreate
characters = [];
for (var i = 0; i < charactersData.length; i++) {
var data = charactersData[i];
var character = new Character(data.name, data.disorder, data.sanity, data.triggers, data.calmers);
character.personality = data.personality;
character.currentMood = data.currentMood;
character.timeOfLastChange = data.timeOfLastChange || 0;
character.isAggressive = false;
character.isHelpful = false;
character.lastAction = data.lastAction || "";
character.sameActionCount = data.sameActionCount || 0;
// Mark impostor - this character is actually mentally healthy
character.isImpostor = i === impostorIndex;
if (character.isImpostor) {
character.realSanity = 100; // Always mentally healthy
character.fakePersonality = character.personality; // Remember fake personality
}
// Initialize suspicion clicks for each character
suspicionClicks[character.name] = 0;
characters.push(character);
game.addChild(character);
}
// Position Characters in Grid
var startX = 400;
var startY = 400;
var spacingX = 400;
var spacingY = 350;
for (var i = 0; i < characters.length; i++) {
var row = Math.floor(i / 3);
var col = i % 3;
characters[i].x = startX + col * spacingX;
characters[i].y = startY + row * spacingY;
}
// Recreate chaos background elements
chaosParticles = [];
chaosNoiseElements = [];
// Create Chaotic Background Elements - Horror Theme
for (var i = 0; i < 30; i++) {
var particle = game.attachAsset('chaosParticle', {
anchorX: 0.5,
anchorY: 0.5,
x: Math.random() * 2048,
y: Math.random() * 2732,
alpha: 0.4
});
particle.speedX = (Math.random() - 0.5) * 4;
particle.speedY = (Math.random() - 0.5) * 4;
particle.rotationSpeed = (Math.random() - 0.5) * 0.1;
// Horror color tints - dark reds, purples, grays
particle.tint = [0x8b0000, 0x800080, 0x2f4f4f, 0x8b008b, 0x696969][Math.floor(Math.random() * 5)];
chaosParticles.push(particle);
}
for (var i = 0; i < 20; i++) {
var circle = game.attachAsset('chaosCircle', {
anchorX: 0.5,
anchorY: 0.5,
x: Math.random() * 2048,
y: Math.random() * 2732,
alpha: 0.3
});
circle.pulseSpeed = Math.random() * 0.05 + 0.02;
circle.pulsePhase = Math.random() * Math.PI * 2;
// Dark horror colors for circles
circle.tint = [0x8b0000, 0x4b0082, 0x2f2f2f, 0x800000][Math.floor(Math.random() * 4)];
chaosParticles.push(circle);
}
for (var i = 0; i < 80; i++) {
var noise = game.attachAsset('chaosNoise', {
anchorX: 0.5,
anchorY: 0.5,
x: Math.random() * 2048,
y: Math.random() * 2732,
alpha: 0.15
});
noise.flickerSpeed = Math.random() * 0.3 + 0.1;
// Dark, unsettling colors for noise
noise.tint = [0x8b0000, 0x2f4f4f, 0x8b008b, 0x000000, 0x800080][Math.floor(Math.random() * 5)];
chaosNoiseElements.push(noise);
}
// Add creepy shadow elements
for (var i = 0; i < 15; i++) {
var shadow = game.attachAsset('chaosParticle', {
anchorX: 0.5,
anchorY: 0.5,
x: Math.random() * 2048,
y: Math.random() * 2732,
alpha: 0.6,
scaleX: 2 + Math.random() * 3,
scaleY: 0.3 + Math.random() * 0.7
});
shadow.tint = 0x000000; // Pure black shadows
shadow.speedX = (Math.random() - 0.5) * 1.5;
shadow.speedY = (Math.random() - 0.5) * 1.5;
shadow.fadeDirection = Math.random() > 0.5 ? 1 : -1;
chaosParticles.push(shadow);
}
// Reset UI
updateUI();
// Start tutorial immediately for new game
startTutorial();
ev ama kuş bakışı. In-Game asset. 2d. High contrast. No shadows
elinde bıçak var . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
korkutucu bir gülümseme . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
tahta ama hafif kırık . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
korkunç bir göze sahip bir kitap . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
kanlı kağıt . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
korkunç gülüşler olan bir not defteri sşyah . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat