User prompt
Please fix the bug: 'TypeError: Cannot use 'in' operator to search for 'scaleX' in null' in or related to this line: 'tween(phoneGuySkipBtn, {' Line Number: 2379 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
eğer sadece "Freddy karakterinin derecesini 1, Bonnie karakterinin derecesini 9, Chica karakterinin derecesi 8 ve foxy Karakterinin derecesini 7 yapıpı "Start Night" butonuna basarsak Golden Freddy jumpscare'si gelsin" bu koşul sağlanıyorsa Golden Freddy jumpscaresi gelsin
User prompt
eğer saat 6 A.M olursa farklı bir ses çalsın ve kazanalım
User prompt
eğer saat 6 A.M olursa birir ses çalsın ve kazanalım ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Golden Freddy karakterinin jumpscare sesi diğerlerinden farklı olsun
User prompt
Freddy karakterinin derecesini 1, Bonnie karakterinin derecesini 9, Chica karakterinin derecesi 8 ve foxy Karakterinin derecesini 7 yapıpı "Start Night" butonuna basarsak Golden Freddy jumpscare'si gelsin
User prompt
eğer Pupppet karakterine bir değer verilmez ise Puppet karakteri ile ilgili eşyaları (müzik kutusunu) gösterme değer verilirse göster
User prompt
Puppet karakterinin müzik kutusunun slideri aşağı doğu kayarak azalıyor onu düzelt yukarıdan aşağı sabit konumunda durarak azalsın farkettiğim bir diğer şey aşağı doğru inerken yine sağdan sola doğru azaldığı onu istemiyorum yukarıdan aşağı doğru azalsın ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Puppet karakterinin müzik kutusunun sliderini yukarıdan aşağı doğru azalacak şekilde yap ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Puppet karakterinin müzik kutusunun sliderini öteki yanına al (sol tarafa)
User prompt
Puppet karakterinin müzik kutusunun sağ tarafına bir tane slider bar al diklemesine oda azalsın oradaki sayıyuı okuyamayan o bardan anlasın ne kadar azalmış... birde azalışını yavaşlat azıcık çok hızlı ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
derece ayarlarken bir ses ekle oyunu daha iyi etkisi olacak
User prompt
son 4 karakteri de ekleyelim (scp 173,siren hat,scp 096,sponge bob)
User prompt
enerji biraz fazla hızlı bitiyor gibi hiç birşey kullanmazsak bitmesin ama eğer kapılar,ışıklar ve kameraya baktığımızda azalmaya başlasın ayrıca hiç birşey yokken %0 eğer bir kapı kapalı veya bir ışık açıksa ise %25 hızda azalsın eğer iki kapı kapalı veya iki ışık açıksa ise %50 eğer iki kapı kapalı + kamera açıksa %55 hızda azalsın eğer iki kapı kapalı + kamera açık + iki ışık açıksa %100 hızda azalsın
User prompt
saat ilerlemiyor gibi sanki o saati 12 A.M den 6 A.M ye kadar ilerlet her saatin arası 1 dakika olsun. Saat 6 A.M olduğunda da oyun kazanılsın ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
sol üste enerji göstergesini yap ne kadar enerji kaldığını anlayalım. Enerji o kadar da hızlı bitmesin ama ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
ne kadar elektiriğimin kaldığını gösteren bir enerji göstergesi yap... Aynı zamanda elektrik çok hızlı bitmesin uzun sürsün böylece oyun daha oynalınır olur
User prompt
Devasa bir güncelleme yap kendin eklemeyi uygun gördüğün şeyler varsa yap, hata ve eksikler varsa onları düzelt yani oyunu güncelle ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Phone guy karakterinin sesi eğer bir kere çalıyorsa diğer sesi hemen verme ya "skip" butonuna basılmasını bekle yada tamamen bitmesini bekle üst üste gelmesin
User prompt
Phone guy Karakterinin sesi çalmıyor "skip" butonu da gelmiyor
User prompt
1.Phone guy karakterinin derecesini ayarlamamıza rağmen oyunun haritasında gözükmesin 2.Phone guy karakterinin derecesini ayarlamamıza rağmen Hiç hareket etmesin 3. Phone guy karakterinin derecesine bağlı olarak sadece ona atadığımız sesi çalsın 4. Phone guy karakterinin sesini durdurmak için ise bir tane "skip" butonu oluşturulsun o butona basınca ses dursun 5.Phone guy karakterinin derecesinin özlliği "skip" butonuna bastıtan sonra sesi tekrar çalma arası (delay) olarak 6. "skip" butonun bir texture ayarla ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Phone guy karakterine bir ses ekle ve karakterin derecesine göre sesin çalma sıklığı fazlalaşsın ve bir tane skip butonu olsun o butona basınca ses kapansın ama tekrardan çalsın. İşte karakterin derecesine göre sesi kapattıktan sonraki çalma aralığı azalacak ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Phone guy karakteri jumpscare atmayacak onun işi sadece telefonu çaldirip konuşmak yani sadece dikkat dağıtmak
User prompt
Dört yeni karakter daha ekle "phone guy, Puple guy, testere ve çığlık"
User prompt
Dört yeni karakter daha ekle "Among us red, Stickman, Cartoon Cat ve baby doll"
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ // AggroSlider class removed (no longer needed) // Animatronic class var Animatronic = Container.expand(function () { var self = Container.call(this); // Properties self.name = ''; self.aggression = 0; // 0-10 self.position = 0; // 0: stage, 1: hall, 2: door self.active = false; self.lastMoveTick = 0; self.moveInterval = 0; // How often to try to move (in ticks) self.headAsset = null; self.hasMovedFirstTime = false; // Track if animatronic has moved for the first time self.waitingAtDoor = false; // Track if waiting at closed door self.doorWaitStartTick = 0; // When started waiting at door self.returningToStart = false; // Track if returning to start position self.returnedToStartTick = 0; // When returned to start position self.musicPlaying = false; // Track if music is currently playing // Set animatronic type self.setType = function (type) { self.name = type; if (type === 'Freddy') { self.headAsset = self.attachAsset('freddy_head', { anchorX: 0.5, anchorY: 0.5 }); } else if (type === 'Bonnie') { self.headAsset = self.attachAsset('bonnie_head', { anchorX: 0.5, anchorY: 0.5 }); } else if (type === 'Chica') { self.headAsset = self.attachAsset('chica_head', { anchorX: 0.5, anchorY: 0.5 }); } else if (type === 'Foxy') { self.headAsset = self.attachAsset('foxy_head', { anchorX: 0.5, anchorY: 0.5 }); } else if (type === 'Mangle') { self.headAsset = self.attachAsset('mangle_head', { anchorX: 0.5, anchorY: 0.5 }); } else if (type === 'Puppet') { self.headAsset = self.attachAsset('puppet_head', { anchorX: 0.5, anchorY: 0.5 }); } else if (type === 'Balloon Boy') { self.headAsset = self.attachAsset('balloon_boy_head', { anchorX: 0.5, anchorY: 0.5 }); } else if (type === 'Golden Freddy') { self.headAsset = self.attachAsset('golden_freddy_head', { anchorX: 0.5, anchorY: 0.5 }); } else if (type === 'Baldi') { self.headAsset = self.attachAsset('baldi_head', { anchorX: 0.5, anchorY: 0.5 }); } else if (type === 'Herobrine') { self.headAsset = self.attachAsset('herobrine_head', { anchorX: 0.5, anchorY: 0.5 }); } else if (type === 'McDonalds Clown') { self.headAsset = self.attachAsset('mcdonalds_clown_head', { anchorX: 0.5, anchorY: 0.5 }); } else if (type === 'Chuck E Cheese') { self.headAsset = self.attachAsset('chuck_e_cheese_head', { anchorX: 0.5, anchorY: 0.5 }); } else if (type === 'Freddy Krueger') { self.headAsset = self.attachAsset('freddy_krueger_head', { anchorX: 0.5, anchorY: 0.5 }); } else if (type === 'Testo Taylan') { self.headAsset = self.attachAsset('testo_taylan_head', { anchorX: 0.5, anchorY: 0.5 }); } else if (type === 'Jeff The Killer') { self.headAsset = self.attachAsset('jeff_the_killer_head', { anchorX: 0.5, anchorY: 0.5 }); } else if (type === 'Smile Dog') { self.headAsset = self.attachAsset('smile_dog_head', { anchorX: 0.5, anchorY: 0.5 }); } else if (type === 'Pennywise') { self.headAsset = self.attachAsset('pennywise_head', { anchorX: 0.5, anchorY: 0.5 }); } else if (type === 'Chucky') { self.headAsset = self.attachAsset('chucky_head', { anchorX: 0.5, anchorY: 0.5 }); } else if (type === 'Momo') { self.headAsset = self.attachAsset('momo_head', { anchorX: 0.5, anchorY: 0.5 }); } else if (type === 'KY kız') { self.headAsset = self.attachAsset('ky_kiz_head', { anchorX: 0.5, anchorY: 0.5 }); } else if (type === 'Among Us Red') { self.headAsset = self.attachAsset('among_us_red_head', { anchorX: 0.5, anchorY: 0.5 }); } else if (type === 'Stickman') { self.headAsset = self.attachAsset('stickman_head', { anchorX: 0.5, anchorY: 0.5 }); } else if (type === 'Cartoon Cat') { self.headAsset = self.attachAsset('cartoon_cat_head', { anchorX: 0.5, anchorY: 0.5 }); } else if (type === 'Baby Doll') { self.headAsset = self.attachAsset('baby_doll_head', { anchorX: 0.5, anchorY: 0.5 }); } else if (type === 'Phone Guy') { self.headAsset = self.attachAsset('phone_guy_head', { anchorX: 0.5, anchorY: 0.5 }); } else if (type === 'Purple Guy') { self.headAsset = self.attachAsset('purple_guy_head', { anchorX: 0.5, anchorY: 0.5 }); } else if (type === 'Testere') { self.headAsset = self.attachAsset('testere_head', { anchorX: 0.5, anchorY: 0.5 }); } else if (type === 'Çığlık') { self.headAsset = self.attachAsset('ciglik_head', { anchorX: 0.5, anchorY: 0.5 }); } else if (type === 'SCP 173') { self.headAsset = self.attachAsset('scp_173_head', { anchorX: 0.5, anchorY: 0.5 }); } else if (type === 'Siren Head') { self.headAsset = self.attachAsset('siren_head_head', { anchorX: 0.5, anchorY: 0.5 }); } else if (type === 'SCP 096') { self.headAsset = self.attachAsset('scp_096_head', { anchorX: 0.5, anchorY: 0.5 }); } else if (type === 'SpongeBob') { self.headAsset = self.attachAsset('spongebob_head', { anchorX: 0.5, anchorY: 0.5 }); } }; // Set aggression (0-10) self.setAggression = function (level) { self.aggression = level; // Lower interval = more aggressive self.moveInterval = 180 - level * 15; // 180 ticks (3s) at 0, 30 ticks (0.5s) at 10 if (self.moveInterval < 30) { self.moveInterval = 30; } }; // Reset animatronic to start self.reset = function () { self.position = 0; self.active = self.aggression > 0; self.lastMoveTick = LK.ticks; self.hasMovedFirstTime = false; self.waitingAtDoor = false; self.doorWaitStartTick = 0; self.returningToStart = false; self.returnedToStartTick = 0; self.musicPlaying = false; }; // Try to move forward self.tryMove = function () { if (!self.active) { return; } // Special case for Phone Guy: never moves, only makes calls if (self.name === 'Phone Guy') { return; } // Special case for Puppet: only move when music box is at 0 if (self.name === 'Puppet' && musicBoxLevel > 0) { return; } if (LK.ticks - self.lastMoveTick < self.moveInterval) { return; } // Check if returning to start if (self.returningToStart) { // Wait 6-7 seconds after returning before moving again var waitAfterReturn = 360 + Math.random() * 60; // 6-7 seconds in ticks if (LK.ticks - self.returnedToStartTick >= waitAfterReturn) { self.returningToStart = false; self.lastMoveTick = LK.ticks; } return; } // Check if waiting at door if (self.waitingAtDoor) { // Wait 3-4 seconds then return to start var doorWaitTime = 180 + Math.random() * 60; // 3-4 seconds in ticks if (LK.ticks - self.doorWaitStartTick >= doorWaitTime) { // Return to start position self.position = 0; self.waitingAtDoor = false; self.returningToStart = true; self.returnedToStartTick = LK.ticks; // Stop Testo Taylan music when returning to start if (self.name === 'Testo Taylan' && self.musicPlaying) { LK.getSound('testo_taylan_music').stop(); self.musicPlaying = false; } } return; } // Check if at door and door is closed if (self.position === 2) { var doorClosed = false; // Check which side this animatronic belongs to if (self.name === 'Bonnie' || self.name === 'Foxy' || self.name === 'Mangle' || self.name === 'Puppet' || self.name === 'Baldi' || self.name === 'Herobrine' || self.name === 'Jeff The Killer' || self.name === 'Chucky' || self.name === 'KY kız' || self.name === 'Among Us Red' || self.name === 'Stickman' || self.name === 'Phone Guy' || self.name === 'Testere' || self.name === 'SCP 173' || self.name === 'Siren Head') { doorClosed = leftDoorClosed; } else { doorClosed = rightDoorClosed; } if (doorClosed) { if (!self.waitingAtDoor) { // Start waiting at door self.waitingAtDoor = true; self.doorWaitStartTick = LK.ticks; } return; } } // Normal movement logic var chance = self.aggression / 10; if (Math.random() < chance) { // Play sound for Foxy's first movement if (self.name === 'Foxy' && !self.hasMovedFirstTime) { LK.getSound('foxy_move').play(); self.hasMovedFirstTime = true; } // Start playing music for Testo Taylan when starting to move if (self.name === 'Testo Taylan' && !self.musicPlaying && self.position === 0) { LK.getSound('testo_taylan_music').play(); self.musicPlaying = true; } // Add footstep sounds for certain characters if ((self.name === 'Bonnie' || self.name === 'Chica' || self.name === 'Freddy') && Math.random() < 0.3) { LK.setTimeout(function () { LK.getSound('footstep').play(); }, Math.random() * 1000); } self.position++; if (self.position > 2) { self.position = 2; } } self.lastMoveTick = LK.ticks; }; // For camera view: get current room name self.getRoom = function () { if (self.position === 0) { return 'Stage'; } if (self.position === 1) { return self.name === 'Bonnie' || self.name === 'Foxy' || self.name === 'Mangle' || self.name === 'Puppet' || self.name === 'Baldi' || self.name === 'Herobrine' || self.name === 'Jeff The Killer' || self.name === 'Chucky' || self.name === 'KY kız' || self.name === 'Among Us Red' || self.name === 'Stickman' || self.name === 'Phone Guy' || self.name === 'Testere' || self.name === 'SCP 173' || self.name === 'Siren Head' ? 'Left Hall' : 'Right Hall'; } if (self.position === 2) { return self.name === 'Bonnie' || self.name === 'Foxy' || self.name === 'Mangle' || self.name === 'Puppet' || self.name === 'Baldi' || self.name === 'Herobrine' || self.name === 'Jeff The Killer' || self.name === 'Chucky' || self.name === 'KY kız' || self.name === 'Among Us Red' || self.name === 'Stickman' || self.name === 'Phone Guy' || self.name === 'Testere' || self.name === 'SCP 173' || self.name === 'Siren Head' ? 'Left Door' : 'Right Door'; } return ''; }; // For office jumpscare self.isAtDoor = function () { return self.position === 2; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x111111 }); /**** * Game Code ****/ // --- GLOBALS --- // Animatronic heads (simple colored ellipses for each animatronic) // Door buttons // Door panels // Camera button // Office background // Camera view background // Aggression slider bar // Start button var animatronics = []; var aggroSliders = []; var aggroLabels = []; var aggroValueTexts = []; var startBtn = null; var nightStarted = false; var nightStartTick = 0; var timeTxt = null; var hour = 12; var minute = 0; var leftDoorClosed = false; var rightDoorClosed = false; var leftLightOn = false; var rightLightOn = false; var camOpen = false; var camBtn = null; var leftDoorBtn = null; var rightDoorBtn = null; var leftLightBtn = null; var rightLightBtn = null; var officeBg = null; var camBg = null; var camAnimatronicHeads = []; var jumpscareActive = false; var jumpscareAnim = null; var jumpscareAnimatronic = null; var jumpscareTick = 0; var jumpscareText = null; var officeAnimatronicHeads = []; var leftDoorPanel = null; var rightDoorPanel = null; var camRoomTxt = null; var camCloseBtn = null; var camCloseTxt = null; var camAnimatronicRoomTxts = []; var camAnimatronicRoomHeads = []; var camAnimatronicRoomNames = []; var camAnimatronicRoomHeadObjs = []; var camAnimatronicRoomTxtObjs = []; var camAnimatronicRoomY = 300; var camAnimatronicRoomSpacing = 300; var camAnimatronicRoomStartX = 400; var camAnimatronicRoomStartY = 300; var camAnimatronicRoomHeadSize = 120; var camAnimatronicRoomTxtSize = 60; var camAnimatronicRoomTxtColor = "#ffffff"; var camAnimatronicRoomHeadAnchor = 0.5; var camAnimatronicRoomTxtAnchor = 0.5; var camAnimatronicRoomTxtYOffset = 100; var camAnimatronicRoomHeadYOffset = 0; var pennywiseBalloon = null; var balloonSpawnTick = 0; var balloonClickDeadline = 0; var balloonClicked = false; var mapBg = null; var musicBox = null; var musicBoxHandle = null; var musicBoxLevel = 100; var musicBoxDecayRate = 0.3; var musicBoxLevelText = null; var musicBoxHeld = false; var musicBoxWindingRate = 2.0; var phoneGuyCallActive = false; var phoneGuyLastCallTick = 0; var phoneGuyCallInterval = 3600; // Default 1 minute (60 seconds * 60 ticks) var phoneGuySkipBtn = null; var phoneGuySkipTxt = null; var powerLevel = 100; var powerUsageRate = 0.008; // Further reduced for much longer gameplay var powerTxt = null; var usageTxt = null; var gameOverReason = ''; var lastPowerSound = 0; var ambientSoundPlaying = false; var mapRooms = []; var mapAnimatronicHeads = []; var mapRoomLabels = []; var roomPositions = { 'Stage': { x: 900, y: 300 }, 'Left Hall': { x: 600, y: 450 }, 'Right Hall': { x: 1200, y: 450 }, 'Left Door': { x: 400, y: 600 }, 'Right Door': { x: 1400, y: 600 }, 'Office': { x: 900, y: 750 } }; // --- SETUP: Custom Night Menu --- function setupCustomNightMenu() { // Clear game children while (game.children.length > 0) { game.children[0].destroy(); } nightStarted = false; jumpscareActive = false; jumpscareText = null; // Clean up Pennywise balloon if (pennywiseBalloon) { pennywiseBalloon.destroy(); pennywiseBalloon = null; } balloonClicked = false; phoneGuyCallActive = false; phoneGuyLastCallTick = 0; powerLevel = 100; gameOverReason = ''; // Reset power meter references game.powerMeterFill = null; game.powerMeterBg = null; game.topPowerTxt = null; game.topPowerBarFill = null; game.topPowerBarBg = null; // Reset music box slider references game.musicBoxSliderFill = null; game.musicBoxSliderBg = null; animatronics = []; aggroSliders = []; aggroLabels = []; aggroValueTexts = []; officeAnimatronicHeads = []; // Title var titleTxt = new Text2('Custom Night', { size: 140, fill: "#fff" }); titleTxt.anchor.set(0.5, 0); titleTxt.x = 2048 / 2; titleTxt.y = 120; game.addChild(titleTxt); // Animatronic names var names = ['Freddy', 'Bonnie', 'Chica', 'Foxy', 'Mangle', 'Puppet', 'Balloon Boy', 'Golden Freddy', 'Baldi', 'Herobrine', 'McDonalds Clown', 'Chuck E Cheese', 'Freddy Krueger', 'Testo Taylan', 'Jeff The Killer', 'Smile Dog', 'Pennywise', 'Chucky', 'Momo', 'KY kız', 'Among Us Red', 'Stickman', 'Cartoon Cat', 'Baby Doll', 'Phone Guy', 'Purple Guy', 'Testere', 'Çığlık', 'SCP 173', 'Siren Head', 'SCP 096', 'SpongeBob']; var colors = [0x8B5C2A, 0x4B5B9E, 0xE6D13A, 0xB13A2A, 0xFF69B4, 0x800080, 0x32CD32, 0xFFD700, 0x8B7355, 0x2F4F2F, 0xFF0000, 0x800080, 0x8B0000, 0x4169E1, 0x000000, 0x654321]; // Store heads array to set visibility after sliders are created var heads = []; for (var i = 0; i < 32; i++) { // Calculate position for 8 rows of 4 characters each var row = Math.floor(i / 4); var col = i % 4; var xPos = 400 + col * 400; var yPos = 350 + row * 280; // Head icon var headId = names[i].toLowerCase().replace(' ', '_') + '_head'; // Special case for Chuck E Cheese if (names[i] === 'Chuck E Cheese') { headId = 'chuck_e_cheese_head'; } else if (names[i] === 'Freddy Krueger') { headId = 'freddy_krueger_head'; } else if (names[i] === 'Testo Taylan') { headId = 'testo_taylan_head'; } else if (names[i] === 'Jeff The Killer') { headId = 'jeff_the_killer_head'; } else if (names[i] === 'Smile Dog') { headId = 'smile_dog_head'; } else if (names[i] === 'Pennywise') { headId = 'pennywise_head'; } else if (names[i] === 'Chucky') { headId = 'chucky_head'; } else if (names[i] === 'Momo') { headId = 'momo_head'; } else if (names[i] === 'KY kız') { headId = 'ky_kiz_head'; } else if (names[i] === 'Among Us Red') { headId = 'among_us_red_head'; } else if (names[i] === 'Stickman') { headId = 'stickman_head'; } else if (names[i] === 'Cartoon Cat') { headId = 'cartoon_cat_head'; } else if (names[i] === 'Baby Doll') { headId = 'baby_doll_head'; } else if (names[i] === 'Phone Guy') { headId = 'phone_guy_head'; } else if (names[i] === 'Purple Guy') { headId = 'purple_guy_head'; } else if (names[i] === 'Testere') { headId = 'testere_head'; } else if (names[i] === 'Çığlık') { headId = 'ciglik_head'; } else if (names[i] === 'SCP 173') { headId = 'scp_173_head'; } else if (names[i] === 'Siren Head') { headId = 'siren_head_head'; } else if (names[i] === 'SCP 096') { headId = 'scp_096_head'; } else if (names[i] === 'SpongeBob') { headId = 'spongebob_head'; } var head = LK.getAsset(headId, { anchorX: 0.5, anchorY: 0.5, x: xPos, y: yPos }); game.addChild(head); heads.push(head); // Name label var label = new Text2(names[i], { size: 50, fill: "#fff" }); label.anchor.set(0.5, 0); label.x = xPos; label.y = yPos + 90; game.addChild(label); aggroLabels.push(label); // Aggression value (no slider, just value) var slider = { value: 0, setValue: function setValue(val) { if (val < 0) { val = 0; } if (val > 10) { val = 10; } this.value = val; } }; aggroSliders.push(slider); // Up button (smaller, positioned to the right of character) var upBtn = LK.getAsset('cam_btn', { anchorX: 0.5, anchorY: 0.5, x: xPos + 150, y: yPos - 30, scaleX: 0.6, scaleY: 0.6 }); game.addChild(upBtn); var upTxt = new Text2('▲', { size: 30, fill: "#fff" }); upTxt.anchor.set(0.5, 0.5); upTxt.x = xPos + 150; upTxt.y = yPos - 30; game.addChild(upTxt); // Down button (smaller, positioned to the right of character) var downBtn = LK.getAsset('cam_btn', { anchorX: 0.5, anchorY: 0.5, x: xPos + 150, y: yPos + 30, scaleX: 0.6, scaleY: 0.6 }); game.addChild(downBtn); var downTxt = new Text2('▼', { size: 30, fill: "#fff" }); downTxt.anchor.set(0.5, 0.5); downTxt.x = xPos + 150; downTxt.y = yPos + 30; game.addChild(downTxt); // Value text (smaller, positioned to the right of character) var valueTxt = new Text2('0', { size: 40, fill: "#fff" }); valueTxt.anchor.set(0.5, 0.5); valueTxt.x = xPos + 150; valueTxt.y = yPos; game.addChild(valueTxt); aggroValueTexts.push(valueTxt); // Slider change event (function (idx, sliderRef, valueTxtRef, headRef) { sliderRef.onChange = function (val) { valueTxtRef.setText(val); headRef.visible = val > 0; }; upBtn.down = function (x, y, obj) { sliderRef.setValue(sliderRef.value + 1); if (sliderRef.onChange) { sliderRef.onChange(sliderRef.value); } }; upTxt.down = upBtn.down; downBtn.down = function (x, y, obj) { sliderRef.setValue(sliderRef.value - 1); if (sliderRef.onChange) { sliderRef.onChange(sliderRef.value); } }; downTxt.down = downBtn.down; })(i, slider, valueTxt, heads[i]); } // Set initial head visibility now that sliders exist for (var i = 0; i < heads.length; i++) { heads[i].visible = aggroSliders[i].value > 0; } // Start button startBtn = LK.getAsset('start_btn', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2 + 400, y: 190 }); game.addChild(startBtn); var startTxt = new Text2('Start Night', { size: 70, fill: "#fff" }); startTxt.anchor.set(0.5, 0.5); startTxt.x = 2048 / 2 + 400; startTxt.y = 190; game.addChild(startTxt); // Start button event startBtn.down = function (x, y, obj) { startNight(); }; startTxt.down = function (x, y, obj) { startNight(); }; } // --- START NIGHT --- function startNight() { // Remove menu elements while (game.children.length > 0) { game.children[0].destroy(); } nightStarted = true; jumpscareActive = false; hour = 12; minute = 0; nightStartTick = LK.ticks + 1; // Prevent instant win by offsetting start tick leftDoorClosed = false; rightDoorClosed = false; leftLightOn = false; rightLightOn = false; camOpen = false; officeAnimatronicHeads = []; camAnimatronicHeads = []; camAnimatronicRoomTxtObjs = []; camAnimatronicRoomHeadObjs = []; camAnimatronicRoomNames = []; camAnimatronicRoomHeads = []; camAnimatronicRoomTxts = []; // Reset Pennywise balloon state if (pennywiseBalloon) { pennywiseBalloon.destroy(); pennywiseBalloon = null; } balloonClicked = false; phoneGuyCallActive = false; phoneGuyLastCallTick = LK.ticks; // Calculate Phone Guy call interval based on aggression var phoneGuyIndex = -1; for (var i = 0; i < animatronics.length; i++) { if (animatronics[i].name === 'Phone Guy') { phoneGuyIndex = i; break; } } if (phoneGuyIndex !== -1) { var aggression = animatronics[phoneGuyIndex].aggression; phoneGuyCallInterval = Math.max(600, 3600 - aggression * 300); // 1 minute at 0, 10 seconds at 10 } // Create animatronics var names = ['Freddy', 'Bonnie', 'Chica', 'Foxy', 'Mangle', 'Puppet', 'Balloon Boy', 'Golden Freddy', 'Baldi', 'Herobrine', 'McDonalds Clown', 'Chuck E Cheese', 'Freddy Krueger', 'Testo Taylan', 'Jeff The Killer', 'Smile Dog', 'Pennywise', 'Chucky', 'Momo', 'KY kız', 'Among Us Red', 'Stickman', 'Cartoon Cat', 'Baby Doll', 'Phone Guy', 'Purple Guy', 'Testere', 'Çığlık', 'SCP 173', 'Siren Head', 'SCP 096', 'SpongeBob']; animatronics = []; for (var i = 0; i < 32; i++) { var a = new Animatronic(); a.setType(names[i]); a.setAggression(aggroSliders[i].value); a.reset(); animatronics.push(a); } // Office background officeBg = LK.getAsset('office_bg', { anchorX: 0, anchorY: 0, x: 0, y: 0 }); game.addChild(officeBg); // Visible button for Freddy nose sound effect on "My Fun Day" poster var freddyNoseBtn = LK.getAsset('cam_btn', { anchorX: 0.5, anchorY: 0.5, x: 1550, // Position above the My Fun Day poster y: 300, // Position above the My Fun Day poster scaleX: 0.3, scaleY: 0.3 }); game.addChild(freddyNoseBtn); // Add nose button text var freddyNoseText = new Text2('♪', { size: 30, fill: "#fff" }); freddyNoseText.anchor.set(0.5, 0.5); freddyNoseText.x = 50; freddyNoseText.y = 50; game.addChild(freddyNoseText); // Add click handler for nose button freddyNoseBtn.down = function (x, y, obj) { LK.getSound('freddy_nose_honk').play(); }; // Add click handler for nose text as well freddyNoseText.down = function (x, y, obj) { LK.getSound('freddy_nose_honk').play(); }; // Create music box for Puppet musicBox = LK.getAsset('music_box_bg', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 400 }); game.addChild(musicBox); musicBoxHandle = LK.getAsset('music_box_handle', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 380 }); game.addChild(musicBoxHandle); musicBoxLevelText = new Text2('100', { size: 30, fill: "#fff" }); musicBoxLevelText.anchor.set(0.5, 0.5); musicBoxLevelText.x = 2048 / 2; musicBoxLevelText.y = 350; game.addChild(musicBoxLevelText); // Add vertical slider bar to the left of music box var musicBoxSliderBg = LK.getAsset('slider_bar', { anchorX: 0.5, anchorY: 1, x: 2048 / 2 - 150, y: 480, scaleX: 0.4, scaleY: 2.0, rotation: Math.PI / 2 }); game.addChild(musicBoxSliderBg); var musicBoxSliderFill = LK.getAsset('slider_bar', { anchorX: 0.5, anchorY: 1, x: 2048 / 2 - 150, y: 480, scaleX: 0.4, scaleY: 2.0, rotation: Math.PI / 2, tint: 0x00FF00 }); game.addChild(musicBoxSliderFill); // Store references for updates game.musicBoxSliderFill = musicBoxSliderFill; game.musicBoxSliderBg = musicBoxSliderBg; // Music box click handler - start holding musicBox.down = function (x, y, obj) { musicBoxHeld = true; if (musicBoxLevel < 100) { LK.getSound('music_box').play(); } }; musicBoxHandle.down = function (x, y, obj) { musicBoxHeld = true; if (musicBoxLevel < 100) { LK.getSound('music_box').play(); } }; musicBoxLevelText.down = function (x, y, obj) { musicBoxHeld = true; if (musicBoxLevel < 100) { LK.getSound('music_box').play(); } }; // Music box release handlers - stop holding musicBox.up = function (x, y, obj) { musicBoxHeld = false; }; musicBoxHandle.up = function (x, y, obj) { musicBoxHeld = false; }; musicBoxLevelText.up = function (x, y, obj) { musicBoxHeld = false; }; // Reset music box level and held state musicBoxLevel = 100; musicBoxHeld = false; // Door panels leftDoorPanel = LK.getAsset('left_door', { anchorX: 0, anchorY: 0, x: 0, y: 200, scaleX: 2.5, scaleY: 2.2 }); rightDoorPanel = LK.getAsset('right_door', { anchorX: 1, anchorY: 0, x: 2048, y: 200, scaleX: 2.5, scaleY: 2.2 }); leftDoorPanel.visible = false; rightDoorPanel.visible = false; game.addChild(leftDoorPanel); game.addChild(rightDoorPanel); // Door buttons leftDoorBtn = LK.getAsset('door_btn', { anchorX: 0, anchorY: 0, x: 40, y: 1300 }); rightDoorBtn = LK.getAsset('door_btn', { anchorX: 0, anchorY: 0, x: 2048 - 220, y: 1300 }); game.addChild(leftDoorBtn); game.addChild(rightDoorBtn); var leftDoorTxt = new Text2('Left Door', { size: 40, fill: "#fff" }); leftDoorTxt.anchor.set(0.5, 0.5); leftDoorTxt.x = 40 + 90; leftDoorTxt.y = 1300 + 45; game.addChild(leftDoorTxt); var rightDoorTxt = new Text2('Right Door', { size: 40, fill: "#fff" }); rightDoorTxt.anchor.set(0.5, 0.5); rightDoorTxt.x = 2048 - 220 + 90; rightDoorTxt.y = 1300 + 45; game.addChild(rightDoorTxt); // Light buttons leftLightBtn = LK.getAsset('light_btn', { anchorX: 0, anchorY: 0, x: 40, y: 1420 }); rightLightBtn = LK.getAsset('light_btn', { anchorX: 0, anchorY: 0, x: 2048 - 220, y: 1420 }); game.addChild(leftLightBtn); game.addChild(rightLightBtn); var leftLightTxt = new Text2('Left Light', { size: 40, fill: "#222" }); leftLightTxt.anchor.set(0.5, 0.5); leftLightTxt.x = 40 + 90; leftLightTxt.y = 1420 + 45; game.addChild(leftLightTxt); var rightLightTxt = new Text2('Right Light', { size: 40, fill: "#222" }); rightLightTxt.anchor.set(0.5, 0.5); rightLightTxt.x = 2048 - 220 + 90; rightLightTxt.y = 1420 + 45; game.addChild(rightLightTxt); // Camera button camBtn = LK.getAsset('cam_btn', { anchorX: 0.5, anchorY: 0, x: 2048 / 2, y: 1300 }); game.addChild(camBtn); var camBtnTxt = new Text2('CAM', { size: 50, fill: "#fff" }); camBtnTxt.anchor.set(0.5, 0.5); camBtnTxt.x = 2048 / 2; camBtnTxt.y = 1300 + 45; game.addChild(camBtnTxt); // Time text - positioned in top left corner timeTxt = new Text2('12:00 A.M', { size: 90, fill: "#fff" }); timeTxt.anchor.set(0, 0); timeTxt.x = 150; // Avoid the top left 100x100 menu area timeTxt.y = 30; LK.gui.top.addChild(timeTxt); // Power meter in top left area var topPowerLabel = new Text2('POWER', { size: 60, fill: 0xFFFFFF }); topPowerLabel.anchor.set(0, 0); topPowerLabel.x = 150; topPowerLabel.y = 150; LK.gui.top.addChild(topPowerLabel); // Power percentage text in top left var topPowerTxt = new Text2('100%', { size: 80, fill: 0x00FF00 }); topPowerTxt.anchor.set(0, 0); topPowerTxt.x = 150; topPowerTxt.y = 220; LK.gui.top.addChild(topPowerTxt); // Power bar background in top left var topPowerBarBg = LK.getAsset('slider_bar', { anchorX: 0, anchorY: 0, x: 150, y: 320, scaleX: 1.2, scaleY: 1.0 }); LK.gui.top.addChild(topPowerBarBg); // Power bar fill in top left var topPowerBarFill = LK.getAsset('slider_bar', { anchorX: 0, anchorY: 0, x: 150, y: 320, scaleX: 1.2, scaleY: 1.0, tint: 0x00FF00 }); LK.gui.top.addChild(topPowerBarFill); // Store references for updates game.topPowerTxt = topPowerTxt; game.topPowerBarFill = topPowerBarFill; game.topPowerBarBg = topPowerBarBg; // Power system UI with visual indicator powerTxt = new Text2('Power: 100%', { size: 60, fill: 0x00FF00 }); powerTxt.anchor.set(0, 1); powerTxt.x = 150; powerTxt.y = 2732 - 30; LK.gui.bottom.addChild(powerTxt); // Power meter background bar var powerMeterBg = LK.getAsset('slider_bar', { anchorX: 0, anchorY: 1, x: 150, y: 2732 - 120, scaleX: 0.8, scaleY: 0.8 }); LK.gui.bottom.addChild(powerMeterBg); // Power meter fill bar (green indicator) var powerMeterFill = LK.getAsset('slider_bar', { anchorX: 0, anchorY: 1, x: 150, y: 2732 - 120, scaleX: 0.8, scaleY: 0.8, tint: 0x00FF00 }); LK.gui.bottom.addChild(powerMeterFill); // Power meter label var powerMeterLabel = new Text2('POWER', { size: 40, fill: 0xFFFFFF }); powerMeterLabel.anchor.set(0, 1); powerMeterLabel.x = 150; powerMeterLabel.y = 2732 - 150; LK.gui.bottom.addChild(powerMeterLabel); usageTxt = new Text2('Usage: Low', { size: 50, fill: 0xFFFFFF }); usageTxt.anchor.set(0, 1); usageTxt.x = 150; usageTxt.y = 2732 - 180; LK.gui.bottom.addChild(usageTxt); // Store power meter references for updates game.powerMeterFill = powerMeterFill; game.powerMeterBg = powerMeterBg; // Start ambient music LK.playMusic('night_ambience'); powerLevel = 100; // Office animatronic heads (hidden unless at door) for (var i = 0; i < 32; i++) { var headId = animatronics[i].name.toLowerCase().replace(/ /g, '_') + '_head'; // Special case for Chuck E Cheese if (animatronics[i].name === 'Chuck E Cheese') { headId = 'chuck_e_cheese_head'; } else if (animatronics[i].name === 'Freddy Krueger') { headId = 'freddy_krueger_head'; } else if (animatronics[i].name === 'Testo Taylan') { headId = 'testo_taylan_head'; } else if (animatronics[i].name === 'Jeff The Killer') { headId = 'jeff_the_killer_head'; } else if (animatronics[i].name === 'Smile Dog') { headId = 'smile_dog_head'; } else if (animatronics[i].name === 'Pennywise') { headId = 'pennywise_head'; } else if (animatronics[i].name === 'Chucky') { headId = 'chucky_head'; } else if (animatronics[i].name === 'Momo') { headId = 'momo_head'; } else if (animatronics[i].name === 'KY kız') { headId = 'ky_kiz_head'; } else if (animatronics[i].name === 'Among Us Red') { headId = 'among_us_red_head'; } else if (animatronics[i].name === 'Stickman') { headId = 'stickman_head'; } else if (animatronics[i].name === 'Cartoon Cat') { headId = 'cartoon_cat_head'; } else if (animatronics[i].name === 'Baby Doll') { headId = 'baby_doll_head'; } else if (animatronics[i].name === 'Phone Guy') { headId = 'phone_guy_head'; } else if (animatronics[i].name === 'Purple Guy') { headId = 'purple_guy_head'; } else if (animatronics[i].name === 'Testere') { headId = 'testere_head'; } else if (animatronics[i].name === 'Çığlık') { headId = 'ciglik_head'; } else if (animatronics[i].name === 'SCP 173') { headId = 'scp_173_head'; } else if (animatronics[i].name === 'Siren Head') { headId = 'siren_head_head'; } else if (animatronics[i].name === 'SCP 096') { headId = 'scp_096_head'; } else if (animatronics[i].name === 'SpongeBob') { headId = 'spongebob_head'; } var head = LK.getAsset(headId, { anchorX: 0.5, anchorY: 0.5, x: 0, y: 0 }); head.visible = false; officeAnimatronicHeads.push(head); game.addChild(head); } // Button events leftDoorBtn.down = function (x, y, obj) { if (powerLevel <= 0) return; // Can't use doors without power var wasOpen = !leftDoorClosed; leftDoorClosed = !leftDoorClosed; // Only play sound when door goes from open to closed if (wasOpen && leftDoorClosed) { LK.getSound('door_sound').play(); // Add slight screen shake for impact tween(officeBg, { x: -10 }, { duration: 100, onFinish: function onFinish() { tween(officeBg, { x: 0 }, { duration: 100 }); } }); } leftDoorPanel.visible = leftDoorClosed; // Change button color based on door state if (leftDoorClosed) { tween(leftDoorBtn, { tint: 0xff0000 }, { duration: 200 }); } else { tween(leftDoorBtn, { tint: 0xffffff }, { duration: 200 }); } }; rightDoorBtn.down = function (x, y, obj) { if (powerLevel <= 0) return; // Can't use doors without power var wasOpen = !rightDoorClosed; rightDoorClosed = !rightDoorClosed; // Only play sound when door goes from open to closed if (wasOpen && rightDoorClosed) { LK.getSound('door_sound').play(); // Add slight screen shake for impact tween(officeBg, { x: 10 }, { duration: 100, onFinish: function onFinish() { tween(officeBg, { x: 0 }, { duration: 100 }); } }); } rightDoorPanel.visible = rightDoorClosed; // Change button color based on door state if (rightDoorClosed) { tween(rightDoorBtn, { tint: 0xff0000 }, { duration: 200 }); } else { tween(rightDoorBtn, { tint: 0xffffff }, { duration: 200 }); } }; leftLightBtn.down = function (x, y, obj) { if (powerLevel <= 0) return; // Can't use lights without power var wasOff = !leftLightOn; leftLightOn = !leftLightOn; // Check if any left-side animatronic is at door var leftSideAtDoor = false; for (var i = 0; i < animatronics.length; i++) { var a = animatronics[i]; if ((a.name === 'Bonnie' || a.name === 'Foxy' || a.name === 'Mangle' || a.name === 'Puppet' || a.name === 'Baldi' || a.name === 'Herobrine' || a.name === 'Jeff The Killer' || a.name === 'Chucky' || a.name === 'KY kız' || a.name === 'Among Us Red' || a.name === 'Stickman' || a.name === 'Phone Guy' || a.name === 'Testere' || a.name === 'SCP 173' || a.name === 'Siren Head') && a.isAtDoor()) { leftSideAtDoor = true; break; } } // Only play sound when light goes from off to on if (wasOff && leftLightOn) { if (leftSideAtDoor) { LK.getSound('light_character_sound').play(); // Add breathing sound for tension LK.getSound('breathing').play(); } else { LK.getSound('light_sound').play(); } } // Set button color based on whether someone is at door if (leftLightOn) { if (leftSideAtDoor) { tween(leftLightBtn, { tint: 0xff0000 }, { duration: 200 }); // Flash office for dramatic effect when character detected LK.effects.flashScreen(0x440000, 300); } else { tween(leftLightBtn, { tint: 0x00ff00 }, { duration: 200 }); } } else { tween(leftLightBtn, { tint: 0xffffff }, { duration: 200 }); } }; rightLightBtn.down = function (x, y, obj) { if (powerLevel <= 0) return; // Can't use lights without power var wasOff = !rightLightOn; rightLightOn = !rightLightOn; // Check if any right-side animatronic is at door var rightSideAtDoor = false; for (var i = 0; i < animatronics.length; i++) { var a = animatronics[i]; if ((a.name === 'Freddy' || a.name === 'Chica' || a.name === 'Balloon Boy' || a.name === 'Golden Freddy' || a.name === 'McDonalds Clown' || a.name === 'Chuck E Cheese' || a.name === 'Freddy Krueger' || a.name === 'Testo Taylan' || a.name === 'Smile Dog' || a.name === 'Pennywise' || a.name === 'Momo' || a.name === 'Cartoon Cat' || a.name === 'Baby Doll' || a.name === 'Purple Guy' || a.name === 'Çığlık' || a.name === 'SCP 096' || a.name === 'SpongeBob') && a.isAtDoor()) { rightSideAtDoor = true; break; } } // Only play sound when light goes from off to on if (wasOff && rightLightOn) { if (rightSideAtDoor) { LK.getSound('light_character_sound').play(); // Add breathing sound for tension LK.getSound('breathing').play(); } else { LK.getSound('light_sound').play(); } } // Set button color based on whether someone is at door if (rightLightOn) { if (rightSideAtDoor) { tween(rightLightBtn, { tint: 0xff0000 }, { duration: 200 }); // Flash office for dramatic effect when character detected LK.effects.flashScreen(0x440000, 300); } else { tween(rightLightBtn, { tint: 0x00ff00 }, { duration: 200 }); } } else { tween(rightLightBtn, { tint: 0xffffff }, { duration: 200 }); } }; camBtn.down = function (x, y, obj) { openCamera(); }; } // --- CAMERA VIEW --- function openCamera() { camOpen = true; // Play camera sound when opening LK.getSound('camera_sound').play(); // Hide Phone Guy skip button if active if (phoneGuySkipBtn) { phoneGuySkipBtn.visible = false; } if (phoneGuySkipTxt) { phoneGuySkipTxt.visible = false; } // Hide CAM button camBtn.visible = false; // Create map background mapBg = LK.getAsset('map_bg', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 900 / 2 }); game.addChild(mapBg); // Create room representations mapRooms = []; mapRoomLabels = []; mapAnimatronicHeads = []; // Stage room var stageRoom = LK.getAsset('room_stage', { anchorX: 0.5, anchorY: 0.5, x: roomPositions['Stage'].x, y: roomPositions['Stage'].y }); game.addChild(stageRoom); mapRooms.push(stageRoom); var stageLabel = new Text2('STAGE', { size: 30, fill: 0xFFFFFF }); stageLabel.anchor.set(0.5, 0.5); stageLabel.x = roomPositions['Stage'].x; stageLabel.y = roomPositions['Stage'].y - 90; game.addChild(stageLabel); mapRoomLabels.push(stageLabel); // Left Hall room var leftHallRoom = LK.getAsset('room_left_hall', { anchorX: 0.5, anchorY: 0.5, x: roomPositions['Left Hall'].x, y: roomPositions['Left Hall'].y }); game.addChild(leftHallRoom); mapRooms.push(leftHallRoom); var leftHallLabel = new Text2('LEFT HALL', { size: 25, fill: 0xFFFFFF }); leftHallLabel.anchor.set(0.5, 0.5); leftHallLabel.x = roomPositions['Left Hall'].x; leftHallLabel.y = roomPositions['Left Hall'].y - 70; game.addChild(leftHallLabel); mapRoomLabels.push(leftHallLabel); // Right Hall room var rightHallRoom = LK.getAsset('room_right_hall', { anchorX: 0.5, anchorY: 0.5, x: roomPositions['Right Hall'].x, y: roomPositions['Right Hall'].y }); game.addChild(rightHallRoom); mapRooms.push(rightHallRoom); var rightHallLabel = new Text2('RIGHT HALL', { size: 25, fill: 0xFFFFFF }); rightHallLabel.anchor.set(0.5, 0.5); rightHallLabel.x = roomPositions['Right Hall'].x; rightHallLabel.y = roomPositions['Right Hall'].y - 70; game.addChild(rightHallLabel); mapRoomLabels.push(rightHallLabel); // Left Door room var leftDoorRoom = LK.getAsset('room_left_door', { anchorX: 0.5, anchorY: 0.5, x: roomPositions['Left Door'].x, y: roomPositions['Left Door'].y }); game.addChild(leftDoorRoom); mapRooms.push(leftDoorRoom); var leftDoorLabel = new Text2('LEFT DOOR', { size: 20, fill: 0xFFFFFF }); leftDoorLabel.anchor.set(0.5, 0.5); leftDoorLabel.x = roomPositions['Left Door'].x; leftDoorLabel.y = roomPositions['Left Door'].y - 60; game.addChild(leftDoorLabel); mapRoomLabels.push(leftDoorLabel); // Right Door room var rightDoorRoom = LK.getAsset('room_right_door', { anchorX: 0.5, anchorY: 0.5, x: roomPositions['Right Door'].x, y: roomPositions['Right Door'].y }); game.addChild(rightDoorRoom); mapRooms.push(rightDoorRoom); var rightDoorLabel = new Text2('RIGHT DOOR', { size: 20, fill: 0xFFFFFF }); rightDoorLabel.anchor.set(0.5, 0.5); rightDoorLabel.x = roomPositions['Right Door'].x; rightDoorLabel.y = roomPositions['Right Door'].y - 60; game.addChild(rightDoorLabel); mapRoomLabels.push(rightDoorLabel); // Office room (player location) var officeRoom = LK.getAsset('office_room', { anchorX: 0.5, anchorY: 0.5, x: roomPositions['Office'].x, y: roomPositions['Office'].y }); game.addChild(officeRoom); mapRooms.push(officeRoom); var officeLabel = new Text2('OFFICE (YOU)', { size: 25, fill: 0x00FF00 }); officeLabel.anchor.set(0.5, 0.5); officeLabel.x = roomPositions['Office'].x; officeLabel.y = roomPositions['Office'].y - 75; game.addChild(officeLabel); mapRoomLabels.push(officeLabel); // Position animatronics on map for (var i = 0; i < 32; i++) { var a = animatronics[i]; if (a.aggression > 0 && a.name !== 'Phone Guy') { var room = a.getRoom(); var roomPos = roomPositions[room]; if (roomPos) { var headId = a.name.toLowerCase().replace(/ /g, '_') + '_head'; // Special case for Chuck E Cheese if (a.name === 'Chuck E Cheese') { headId = 'chuck_e_cheese_head'; } else if (a.name === 'Freddy Krueger') { headId = 'freddy_krueger_head'; } else if (a.name === 'Testo Taylan') { headId = 'testo_taylan_head'; } else if (a.name === 'Jeff The Killer') { headId = 'jeff_the_killer_head'; } else if (a.name === 'Smile Dog') { headId = 'smile_dog_head'; } else if (a.name === 'Pennywise') { headId = 'pennywise_head'; } else if (a.name === 'Chucky') { headId = 'chucky_head'; } else if (a.name === 'Momo') { headId = 'momo_head'; } else if (a.name === 'KY kız') { headId = 'ky_kiz_head'; } else if (a.name === 'Among Us Red') { headId = 'among_us_red_head'; } else if (a.name === 'Stickman') { headId = 'stickman_head'; } else if (a.name === 'Cartoon Cat') { headId = 'cartoon_cat_head'; } else if (a.name === 'Baby Doll') { headId = 'baby_doll_head'; } else if (a.name === 'Purple Guy') { headId = 'purple_guy_head'; } else if (a.name === 'Testere') { headId = 'testere_head'; } else if (a.name === 'Çığlık') { headId = 'ciglik_head'; } else if (a.name === 'SCP 173') { headId = 'scp_173_head'; } else if (a.name === 'Siren Head') { headId = 'siren_head_head'; } else if (a.name === 'SCP 096') { headId = 'scp_096_head'; } else if (a.name === 'SpongeBob') { headId = 'spongebob_head'; } // Count how many animatronics are in this room to position them properly var animatronicsInRoom = []; for (var j = 0; j < 32; j++) { if (animatronics[j].aggression > 0 && animatronics[j].name !== 'Phone Guy' && animatronics[j].getRoom() === room) { animatronicsInRoom.push(j); } } var indexInRoom = animatronicsInRoom.indexOf(i); var offsetX = (indexInRoom - (animatronicsInRoom.length - 1) / 2) * 80; var head = LK.getAsset(headId, { anchorX: 0.5, anchorY: 0.5, x: roomPos.x + offsetX, y: roomPos.y + 20, scaleX: 0.4, scaleY: 0.4 }); game.addChild(head); mapAnimatronicHeads.push({ head: head, animatronic: a, index: i }); // Add animatronic name below head var nameLabel = new Text2(a.name, { size: 18, fill: 0xFFFF00 }); nameLabel.anchor.set(0.5, 0.5); nameLabel.x = roomPos.x + offsetX; nameLabel.y = roomPos.y + 50; game.addChild(nameLabel); mapRoomLabels.push(nameLabel); } } } // Close camera button camCloseBtn = LK.getAsset('cam_btn', { anchorX: 0.5, anchorY: 0, x: 2048 / 2, y: 1500 }); game.addChild(camCloseBtn); camCloseTxt = new Text2('CLOSE MAP', { size: 50, fill: "#fff" }); camCloseTxt.anchor.set(0.5, 0.5); camCloseTxt.x = 2048 / 2; camCloseTxt.y = 1500 + 45; game.addChild(camCloseTxt); camCloseBtn.down = function (x, y, obj) { closeCamera(); }; camCloseTxt.down = function (x, y, obj) { closeCamera(); }; } function closeCamera() { camOpen = false; // Play camera sound when closing LK.getSound('camera_sound').play(); // Show Phone Guy skip button if active if (phoneGuySkipBtn) { phoneGuySkipBtn.visible = true; } if (phoneGuySkipTxt) { phoneGuySkipTxt.visible = true; } // Show CAM button camBtn.visible = true; // Clean up map background if (mapBg) { mapBg.destroy(); mapBg = null; } // Clean up room elements for (var i = 0; i < mapRooms.length; i++) { if (mapRooms[i]) { mapRooms[i].destroy(); } } mapRooms = []; // Clean up room labels and animatronic names for (var i = 0; i < mapRoomLabels.length; i++) { if (mapRoomLabels[i]) { mapRoomLabels[i].destroy(); } } mapRoomLabels = []; // Clean up animatronic heads on map for (var i = 0; i < mapAnimatronicHeads.length; i++) { if (mapAnimatronicHeads[i] && mapAnimatronicHeads[i].head) { mapAnimatronicHeads[i].head.destroy(); } } mapAnimatronicHeads = []; // Clean up close button if (camCloseBtn) { camCloseBtn.down = null; camCloseBtn.destroy(); camCloseBtn = null; } if (camCloseTxt) { camCloseTxt.down = null; camCloseTxt.destroy(); camCloseTxt = null; } } // --- JUMPSCARE --- function triggerJumpscare(animatronicIdx) { jumpscareActive = true; jumpscareAnimatronic = animatronicIdx; jumpscareTick = LK.ticks; gameOverReason = animatronics[animatronicIdx] ? animatronics[animatronicIdx].name + ' got you!' : 'Power ran out!'; // Stop Testo Taylan music if playing if (animatronics[animatronicIdx].name === 'Testo Taylan' && animatronics[animatronicIdx].musicPlaying) { LK.getSound('testo_taylan_music').stop(); animatronics[animatronicIdx].musicPlaying = false; } // Play jumpscare sound LK.getSound('jumpscare').play(); // Show animatronic head in center, scale up var headId = animatronics[animatronicIdx].name.toLowerCase().replace(/ /g, '_') + '_head'; // Special case for Chuck E Cheese if (animatronics[animatronicIdx].name === 'Chuck E Cheese') { headId = 'chuck_e_cheese_head'; } else if (animatronics[animatronicIdx].name === 'Freddy Krueger') { headId = 'freddy_krueger_head'; } else if (animatronics[animatronicIdx].name === 'Testo Taylan') { headId = 'testo_taylan_head'; } else if (animatronics[animatronicIdx].name === 'Jeff The Killer') { headId = 'jeff_the_killer_head'; } else if (animatronics[animatronicIdx].name === 'Smile Dog') { headId = 'smile_dog_head'; } else if (animatronics[animatronicIdx].name === 'Pennywise') { headId = 'pennywise_head'; } else if (animatronics[animatronicIdx].name === 'Chucky') { headId = 'chucky_head'; } else if (animatronics[animatronicIdx].name === 'Momo') { headId = 'momo_head'; } else if (animatronics[animatronicIdx].name === 'KY kız') { headId = 'ky_kiz_head'; } else if (animatronics[animatronicIdx].name === 'Among Us Red') { headId = 'among_us_red_head'; } else if (animatronics[animatronicIdx].name === 'Stickman') { headId = 'stickman_head'; } else if (animatronics[animatronicIdx].name === 'Cartoon Cat') { headId = 'cartoon_cat_head'; } else if (animatronics[animatronicIdx].name === 'Baby Doll') { headId = 'baby_doll_head'; } else if (animatronics[animatronicIdx].name === 'Phone Guy') { headId = 'phone_guy_head'; } else if (animatronics[animatronicIdx].name === 'Purple Guy') { headId = 'purple_guy_head'; } else if (animatronics[animatronicIdx].name === 'Testere') { headId = 'testere_head'; } else if (animatronics[animatronicIdx].name === 'Çığlık') { headId = 'ciglik_head'; } else if (animatronics[animatronicIdx].name === 'SCP 173') { headId = 'scp_173_head'; } else if (animatronics[animatronicIdx].name === 'Siren Head') { headId = 'siren_head_head'; } else if (animatronics[animatronicIdx].name === 'SCP 096') { headId = 'scp_096_head'; } else if (animatronics[animatronicIdx].name === 'SpongeBob') { headId = 'spongebob_head'; } jumpscareAnim = LK.getAsset(headId, { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 900 / 2 + 300, scaleX: 1, scaleY: 1 }); game.addChild(jumpscareAnim); tween(jumpscareAnim, { scaleX: 3, scaleY: 3 }, { duration: 800, easing: tween.cubicOut }); // Flash screen red LK.effects.flashScreen(0xff0000, 800); // Show jumpscare text for Testo Taylan if (animatronics[animatronicIdx].name === 'Testo Taylan') { jumpscareText = new Text2('EV ZİYARETLENDİN!!', { size: 120, fill: 0xFFFFFF }); jumpscareText.anchor.set(0.5, 1); jumpscareText.x = 2048 / 2; jumpscareText.y = 2732 - 100; // Position at bottom of screen game.addChild(jumpscareText); } // After 1s, show game over LK.setTimeout(function () { if (jumpscareAnim) { jumpscareAnim.destroy(); } // Don't destroy jumpscareText here - keep it visible on Game Over screen LK.showGameOver(); }, 1000); } // --- UPDATE LOOP --- game.update = function () { if (!nightStarted) { return; } // Time progression: Each hour = 1 minute = 60 seconds = 3600 ticks (60 seconds * 60 ticks per second) var ticksSinceStart = LK.ticks - nightStartTick; var gameHours = Math.floor(ticksSinceStart / 3600); // 1 real minute = 1 game hour var newHour = 12 + gameHours; var newMinute = 0; // Always show :00 minutes for each hour // Handle hour progression properly (12 AM -> 1 AM -> 2 AM -> ... -> 6 AM) if (newHour > 12) { newHour = newHour - 12; // Convert to AM format (13 -> 1, 14 -> 2, etc.) } if (newHour === 0) { newHour = 12; } // Ensure 12 AM shows as 12, not 0 // Cap at 6 AM if (gameHours >= 6) { newHour = 6; newMinute = 0; } if (newHour !== hour || newMinute !== minute) { hour = newHour; minute = newMinute; var ampm = 'A.M'; var hourStr = hour.toString(); var minStr = '00'; // Always show :00 timeTxt.setText(hourStr + ':' + minStr + ' ' + ampm); } // Strategic power consumption system var powerUsagePercent = 0; // Base usage: 0% when nothing is active // Count active systems var doorsActive = 0; var lightsActive = 0; if (leftDoorClosed) doorsActive++; if (rightDoorClosed) doorsActive++; if (leftLightOn) lightsActive++; if (rightLightOn) lightsActive++; // Store previous power usage to detect changes if (typeof game.previousPowerUsage === 'undefined') { game.previousPowerUsage = 0; } // Calculate power usage based on active systems if (doorsActive === 0 && lightsActive === 0 && !camOpen) { powerUsagePercent = 0; // Nothing active: 0% } else if (doorsActive === 1 && lightsActive === 0 && !camOpen) { powerUsagePercent = 25; // One door: 25% } else if (doorsActive === 0 && lightsActive === 1 && !camOpen) { powerUsagePercent = 25; // One light: 25% } else if (doorsActive === 2 && lightsActive === 0 && !camOpen) { powerUsagePercent = 50; // Two doors: 50% } else if (doorsActive === 0 && lightsActive === 2 && !camOpen) { powerUsagePercent = 50; // Two lights: 50% } else if (doorsActive === 1 && lightsActive === 1 && !camOpen) { powerUsagePercent = 50; // One door + one light: 50% } else if (doorsActive === 2 && camOpen && lightsActive === 0) { powerUsagePercent = 55; // Two doors + camera: 55% } else if (doorsActive === 2 && camOpen && lightsActive === 2) { powerUsagePercent = 100; // Two doors + camera + two lights: 100% } else { // Handle other combinations proportionally var baseUsage = doorsActive * 25 + lightsActive * 25; if (camOpen) baseUsage += 5; powerUsagePercent = Math.min(100, baseUsage); } // Play sound when power usage changes (degree setting sound effect) if (powerUsagePercent !== game.previousPowerUsage) { LK.getSound('ambient_hum').play(); game.previousPowerUsage = powerUsagePercent; } // Apply power drain based on usage percentage var actualUsageRate = powerUsageRate * (powerUsagePercent / 100); powerLevel -= actualUsageRate; if (powerLevel < 0) powerLevel = 0; // Update power UI var powerPercent = Math.floor(powerLevel); powerTxt.setText('Power: ' + powerPercent + '%'); // Update power meter visual indicator if (game.powerMeterFill) { var fillWidth = powerLevel / 100 * 0.8; // Scale width based on power level game.powerMeterFill.scaleX = fillWidth; // Change color based on power level var fillColor = 0x00FF00; // Green if (powerLevel <= 50) fillColor = 0xFFFF00; // Yellow if (powerLevel <= 25) fillColor = 0xFF6600; // Orange if (powerLevel <= 10) fillColor = 0xFF0000; // Red tween(game.powerMeterFill, { tint: fillColor }, { duration: 300 }); } // Update top left power meter if (game.topPowerTxt) { var powerPercent = Math.floor(powerLevel); game.topPowerTxt.setText(powerPercent + '%'); // Change color based on power level var textColor = 0x00FF00; // Green if (powerLevel <= 50) textColor = 0xFFFF00; // Yellow if (powerLevel <= 25) textColor = 0xFF6600; // Orange if (powerLevel <= 10) textColor = 0xFF0000; // Red tween(game.topPowerTxt, { tint: textColor }, { duration: 300 }); } // Update top left power bar if (game.topPowerBarFill) { var fillWidth = powerLevel / 100 * 1.2; // Scale width based on power level game.topPowerBarFill.scaleX = fillWidth; // Change color based on power level var barColor = 0x00FF00; // Green if (powerLevel <= 50) barColor = 0xFFFF00; // Yellow if (powerLevel <= 25) barColor = 0xFF6600; // Orange if (powerLevel <= 10) barColor = 0xFF0000; // Red tween(game.topPowerBarFill, { tint: barColor }, { duration: 300 }); } // Update usage display with actual percentage var usageText = 'Usage: ' + powerUsagePercent + '%'; usageTxt.setText(usageText); // Update usage text color based on consumption level var usageColor = 0xFFFFFF; // White if (powerUsagePercent >= 75) usageColor = 0xFF0000; // Red for high usage else if (powerUsagePercent >= 50) usageColor = 0xFF6600; // Orange for medium-high usage else if (powerUsagePercent >= 25) usageColor = 0xFFFF00; // Yellow for medium usage else if (powerUsagePercent > 0) usageColor = 0x00FF00; // Green for low usage tween(usageTxt, { tint: usageColor }, { duration: 300 }); // Change power text color based on level if (powerLevel > 50) { tween(powerTxt, { tint: 0x00ff00 }, { duration: 200 }); } else if (powerLevel > 25) { tween(powerTxt, { tint: 0xffff00 }, { duration: 200 }); } else if (powerLevel > 10) { tween(powerTxt, { tint: 0xFF6600 }, { duration: 200 }); } else { tween(powerTxt, { tint: 0xff0000 }, { duration: 200 }); } // Power warnings if (powerLevel <= 20 && powerLevel > 10 && LK.ticks - lastPowerSound > 300) { LK.getSound('ambient_hum').play(); lastPowerSound = LK.ticks; } // Power outage if (powerLevel <= 0 && !jumpscareActive) { // Close all doors and turn off lights leftDoorClosed = false; rightDoorClosed = false; leftLightOn = false; rightLightOn = false; camOpen = false; leftDoorPanel.visible = false; rightDoorPanel.visible = false; // Reset button colors tween(leftDoorBtn, { tint: 0x444444 }, { duration: 500 }); tween(rightDoorBtn, { tint: 0x444444 }, { duration: 500 }); tween(leftLightBtn, { tint: 0x444444 }, { duration: 500 }); tween(rightLightBtn, { tint: 0x444444 }, { duration: 500 }); tween(camBtn, { tint: 0x444444 }, { duration: 500 }); // Power down sound and dark screen LK.getSound('power_down').play(); LK.effects.flashScreen(0x000000, 3000); // Freddy's special power outage sequence LK.setTimeout(function () { // Play Freddy's song before jumpscare LK.getSound('testo_taylan_music').play(); LK.setTimeout(function () { gameOverReason = 'Power ran out!'; triggerJumpscare(0); // Trigger Freddy jumpscare }, 5000); }, 2000); return; } // Win condition: 6 AM (requires 6 game hours * 1 real minute = 6 real minutes total) // Prevent instant win by requiring proper game duration if (gameHours >= 6 && !jumpscareActive) { LK.showYouWin(); return; } // Music box decay and Puppet mechanics var puppetIndex = -1; for (var i = 0; i < animatronics.length; i++) { if (animatronics[i].name === 'Puppet') { puppetIndex = i; break; } } if (puppetIndex !== -1 && animatronics[puppetIndex].aggression > 0) { // Handle music box winding when held if (musicBoxHeld && musicBoxLevel < 100) { musicBoxLevel += musicBoxWindingRate; if (musicBoxLevel > 100) { musicBoxLevel = 100; } // Animate handle rotation while winding if (LK.ticks % 10 === 0) { // Every 10 ticks for smooth animation tween(musicBoxHandle, { rotation: musicBoxHandle.rotation + Math.PI / 4 }, { duration: 200, easing: tween.easeOut }); } } // Calculate dynamic decay rate based on music box level (1-10 scale) - slowed down var levelScale = Math.max(1, Math.min(10, Math.floor(musicBoxLevel / 10) + 1)); var dynamicDecayRate = 0.2 - (levelScale - 1) * 0.015; // Much slower: 0.2 at level 1, 0.065 at level 10 // Decay music box level if (!musicBoxHeld) { musicBoxLevel -= dynamicDecayRate; } if (musicBoxLevel < 0) { musicBoxLevel = 0; } musicBoxLevelText.setText(Math.floor(musicBoxLevel).toString()); // Update music box slider visual indicator if (game.musicBoxSliderFill) { var fillScale = musicBoxLevel / 100 * 2.0; // Scale height based on music box level game.musicBoxSliderFill.scaleY = fillScale; // Change color based on music box level var sliderColor = 0x00FF00; // Green if (musicBoxLevel <= 50) sliderColor = 0xFFFF00; // Yellow if (musicBoxLevel <= 25) sliderColor = 0xFF6600; // Orange if (musicBoxLevel <= 10) sliderColor = 0xFF0000; // Red tween(game.musicBoxSliderFill, { tint: sliderColor }, { duration: 300 }); } // Trigger Puppet jumpscare when music box reaches 0 if (musicBoxLevel <= 0 && !jumpscareActive) { triggerJumpscare(puppetIndex); return; } } // Difficulty scaling - animatronics get more aggressive as night progresses (faster with 1-minute hours) var difficultyMultiplier = 1 + gameHours * 0.3; // Animatronic AI for (var i = 0; i < animatronics.length; i++) { var a = animatronics[i]; // Apply difficulty scaling if (a.aggression > 0) { var originalInterval = a.moveInterval; a.moveInterval = Math.max(20, originalInterval / difficultyMultiplier); } a.tryMove(); // Restore original interval if (a.aggression > 0) { a.moveInterval = originalInterval; } } // Ambient sound management if (!ambientSoundPlaying && !camOpen && Math.random() < 0.001) { LK.getSound('ambient_hum').play(); ambientSoundPlaying = true; LK.setTimeout(function () { ambientSoundPlaying = false; }, 3000); } // Pennywise special balloon mechanic var pennywiseIndex = -1; for (var i = 0; i < animatronics.length; i++) { if (animatronics[i].name === 'Pennywise') { pennywiseIndex = i; break; } } if (pennywiseIndex !== -1 && animatronics[pennywiseIndex].aggression > 0) { // Check if Pennywise is at door and no balloon is active if (animatronics[pennywiseIndex].isAtDoor() && !pennywiseBalloon && !jumpscareActive) { // Spawn red balloon in office pennywiseBalloon = LK.getAsset('red_balloon', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 1000 }); game.addChild(pennywiseBalloon); balloonSpawnTick = LK.ticks; balloonClickDeadline = LK.ticks + 600; // 10 seconds at 60 FPS balloonClicked = false; // Animate balloon floating slightly tween(pennywiseBalloon, { y: 950 }, { duration: 2000, easing: tween.easeInOut }); // Add click handler to balloon pennywiseBalloon.down = function (x, y, obj) { if (pennywiseBalloon) { balloonClicked = true; // Animate balloon popping/shrinking tween(pennywiseBalloon, { scaleX: 0, scaleY: 0, alpha: 0 }, { duration: 300, onFinish: function onFinish() { if (pennywiseBalloon) { pennywiseBalloon.destroy(); pennywiseBalloon = null; } } }); // Reset Pennywise to start position animatronics[pennywiseIndex].position = 0; animatronics[pennywiseIndex].waitingAtDoor = false; animatronics[pennywiseIndex].returningToStart = true; animatronics[pennywiseIndex].returnedToStartTick = LK.ticks; } }; } // Check if balloon deadline passed without clicking if (pennywiseBalloon && LK.ticks >= balloonClickDeadline && !balloonClicked) { // Trigger Pennywise jumpscare if (pennywiseBalloon) { pennywiseBalloon.destroy(); pennywiseBalloon = null; } triggerJumpscare(pennywiseIndex); return; } } // Office animatronic heads (show if at door and light/door open) for (var i = 0; i < 32; i++) { var a = animatronics[i]; var head = officeAnimatronicHeads[i]; if (!head) { continue; } if (a.isAtDoor()) { if ((a.name === 'Bonnie' || a.name === 'Foxy' || a.name === 'Mangle' || a.name === 'Puppet' || a.name === 'Baldi' || a.name === 'Herobrine' || a.name === 'Jeff The Killer' || a.name === 'Chucky' || a.name === 'KY kız' || a.name === 'Among Us Red' || a.name === 'Stickman' || a.name === 'Phone Guy' || a.name === 'Testere' || a.name === 'SCP 173' || a.name === 'Siren Head') && leftLightOn && !leftDoorClosed) { // Left side characters (including new ones) head.x = 180; head.y = 900; head.visible = true; } else if ((a.name === 'Freddy' || a.name === 'Chica' || a.name === 'Balloon Boy' || a.name === 'Golden Freddy' || a.name === 'McDonalds Clown' || a.name === 'Chuck E Cheese' || a.name === 'Freddy Krueger' || a.name === 'Testo Taylan' || a.name === 'Smile Dog' || a.name === 'Pennywise' || a.name === 'Momo' || a.name === 'Cartoon Cat' || a.name === 'Baby Doll' || a.name === 'Purple Guy' || a.name === 'Çığlık' || a.name === 'SCP 096' || a.name === 'SpongeBob') && rightLightOn && !rightDoorClosed) { // Right side characters (including new ones) head.x = 2048 - 180; head.y = 900; head.visible = true; } else { head.visible = false; } } else { head.visible = false; } } // Tension building - subtle screen effects when animatronics are nearby var nearbyThreat = false; for (var i = 0; i < animatronics.length; i++) { var a = animatronics[i]; if (a.aggression > 0 && a.position >= 1) { nearbyThreat = true; break; } } // Apply subtle visual effects based on threat level if (nearbyThreat && !camOpen && Math.random() < 0.002) { // Slight office shake for tension var shakeAmount = Math.random() * 5 - 2.5; tween(officeBg, { x: shakeAmount }, { duration: 100, onFinish: function onFinish() { tween(officeBg, { x: 0 }, { duration: 100 }); } }); } // Jumpscare check if (!jumpscareActive) { for (var i = 0; i < animatronics.length; i++) { var a = animatronics[i]; // Skip Pennywise from immediate jumpscare (he uses balloon mechanic) if (a.name === 'Pennywise') { continue; } // Skip Phone Guy from immediate jumpscare (he only calls to distract) if (a.name === 'Phone Guy') { continue; } if (a.isAtDoor() && !a.waitingAtDoor) { // Pre-jumpscare warning sound if (Math.random() < 0.1) { LK.getSound('breathing').play(); } if ((a.name === 'Bonnie' || a.name === 'Foxy' || a.name === 'Mangle' || a.name === 'Puppet' || a.name === 'Baldi' || a.name === 'Herobrine' || a.name === 'Jeff The Killer' || a.name === 'Chucky' || a.name === 'KY kız' || a.name === 'Among Us Red' || a.name === 'Stickman' || a.name === 'Phone Guy' || a.name === 'Testere' || a.name === 'SCP 173' || a.name === 'Siren Head') && !leftDoorClosed) { // Left side characters (including new ones) triggerJumpscare(i); return; } else if ((a.name === 'Freddy' || a.name === 'Chica' || a.name === 'Balloon Boy' || a.name === 'Golden Freddy' || a.name === 'McDonalds Clown' || a.name === 'Chuck E Cheese' || a.name === 'Freddy Krueger' || a.name === 'Testo Taylan' || a.name === 'Smile Dog' || a.name === 'Pennywise' || a.name === 'Momo' || a.name === 'Cartoon Cat' || a.name === 'Baby Doll' || a.name === 'Purple Guy' || a.name === 'Çığlık' || a.name === 'SCP 096' || a.name === 'SpongeBob') && !rightDoorClosed) { // Right side characters (including new ones) triggerJumpscare(i); return; } } } } // Phone Guy call mechanics var phoneGuyIndex = -1; for (var i = 0; i < animatronics.length; i++) { if (animatronics[i].name === 'Phone Guy') { phoneGuyIndex = i; break; } } if (phoneGuyIndex !== -1 && animatronics[phoneGuyIndex].aggression > 0) { // Check if it's time for Phone Guy to call and no call is currently active if (!phoneGuyCallActive && LK.ticks - phoneGuyLastCallTick >= phoneGuyCallInterval && !LK.getSound('phone_sound').playing) { phoneGuyCallActive = true; phoneGuyLastCallTick = LK.ticks; // Play phone sound LK.getSound('phone_sound').play(); // Create skip button only if camera is not open if (!camOpen) { phoneGuySkipBtn = LK.getAsset('skip_btn', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 200 }); game.addChild(phoneGuySkipBtn); // Add pulsing animation to skip button tween(phoneGuySkipBtn, { scaleX: 1.1, scaleY: 1.1 }, { duration: 500, easing: tween.easeInOut, onFinish: function onFinish() { tween(phoneGuySkipBtn, { scaleX: 1, scaleY: 1 }, { duration: 500, easing: tween.easeInOut }); } }); phoneGuySkipTxt = new Text2('SKIP CALL', { size: 40, fill: "#fff" }); phoneGuySkipTxt.anchor.set(0.5, 0.5); phoneGuySkipTxt.x = 2048 / 2; phoneGuySkipTxt.y = 200; game.addChild(phoneGuySkipTxt); // Add click handlers for skip button phoneGuySkipBtn.down = function (x, y, obj) { if (phoneGuyCallActive) { // Stop the phone sound LK.getSound('phone_sound').stop(); phoneGuyCallActive = false; // Calculate next call interval based on aggression (shorter after skip) var aggression = animatronics[phoneGuyIndex].aggression; phoneGuyCallInterval = Math.max(300, 1800 - aggression * 150); // 30 seconds at 0, 5 seconds at 10 phoneGuyLastCallTick = LK.ticks; // Remove skip button if (phoneGuySkipBtn) { phoneGuySkipBtn.destroy(); phoneGuySkipBtn = null; } if (phoneGuySkipTxt) { phoneGuySkipTxt.destroy(); phoneGuySkipTxt = null; } } }; phoneGuySkipTxt.down = phoneGuySkipBtn.down; } } // Check if phone sound finished naturally if (phoneGuyCallActive && !LK.getSound('phone_sound').playing) { phoneGuyCallActive = false; // Calculate next call interval based on aggression var aggression = animatronics[phoneGuyIndex].aggression; phoneGuyCallInterval = Math.max(600, 3600 - aggression * 300); // 1 minute at 0, 10 seconds at 10 phoneGuyLastCallTick = LK.ticks; // Remove skip button if still exists if (phoneGuySkipBtn) { phoneGuySkipBtn.destroy(); phoneGuySkipBtn = null; } if (phoneGuySkipTxt) { phoneGuySkipTxt.destroy(); phoneGuySkipTxt = null; } } } // Camera view update - animate animatronic movement on map if (camOpen) { for (var i = 0; i < mapAnimatronicHeads.length; i++) { var mapEntry = mapAnimatronicHeads[i]; if (mapEntry && mapEntry.animatronic && mapEntry.animatronic.name !== 'Phone Guy') { var currentRoom = mapEntry.animatronic.getRoom(); var roomPos = roomPositions[currentRoom]; if (roomPos) { // Count animatronics in current room for positioning var animatronicsInRoom = []; for (var j = 0; j < 32; j++) { if (animatronics[j].aggression > 0 && animatronics[j].name !== 'Phone Guy' && animatronics[j].getRoom() === currentRoom) { animatronicsInRoom.push(j); } } var indexInRoom = animatronicsInRoom.indexOf(mapEntry.index); var offsetX = (indexInRoom - (animatronicsInRoom.length - 1) / 2) * 80; var targetX = roomPos.x + offsetX; var targetY = roomPos.y + 20; // Animate movement to new position if different if (Math.abs(mapEntry.head.x - targetX) > 5 || Math.abs(mapEntry.head.y - targetY) > 5) { tween(mapEntry.head, { x: targetX, y: targetY }, { duration: 500, easing: tween.easeOut }); } } } } } }; // --- TOUCH HANDLING --- game.move = function (x, y, obj) { // No slider move handling needed }; game.down = function (x, y, obj) { // No slider down handling needed }; game.up = function (x, y, obj) { // No slider up handling needed }; // --- INIT --- setupCustomNightMenu();
===================================================================
--- original.js
+++ change.js
@@ -779,13 +779,13 @@
musicBoxLevelText.anchor.set(0.5, 0.5);
musicBoxLevelText.x = 2048 / 2;
musicBoxLevelText.y = 350;
game.addChild(musicBoxLevelText);
- // Add vertical slider bar to the right of music box
+ // Add vertical slider bar to the left of music box
var musicBoxSliderBg = LK.getAsset('slider_bar', {
anchorX: 0.5,
anchorY: 1,
- x: 2048 / 2 + 150,
+ x: 2048 / 2 - 150,
y: 480,
scaleX: 0.4,
scaleY: 2.0,
rotation: Math.PI / 2
@@ -793,9 +793,9 @@
game.addChild(musicBoxSliderBg);
var musicBoxSliderFill = LK.getAsset('slider_bar', {
anchorX: 0.5,
anchorY: 1,
- x: 2048 / 2 + 150,
+ x: 2048 / 2 - 150,
y: 480,
scaleX: 0.4,
scaleY: 2.0,
rotation: Math.PI / 2,
Bonnie head. In-Game asset. 2d. High contrast. No shadows
scary chica head. In-Game asset. 2d. High contrast. No shadows
foxy head. In-Game asset. 2d. High contrast. No shadows
freddy head. In-Game asset. 2d. High contrast. No shadows
balloon boy head. In-Game asset. 2d. High contrast. No shadows
golden freddy head. In-Game asset. 2d. High contrast. No shadows
mangle head. In-Game asset. 2d. High contrast. No shadows
puppet FNAF head. In-Game asset. 2d. High contrast. No shadows
chuck e cheese head. In-Game asset. 2d. High contrast. No shadows
herobrine_head. In-Game asset. 2d. High contrast. No shadows
scary baldi face. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
mcdonalds clown scary head. In-Game asset. 2d. High contrast. No shadows
freddy krueger scary head. In-Game asset. 2d. High contrast. No shadows
jeff the killer scary head. In-Game asset. 2d. High contrast. No shadows
The image displays a highly disturbing and unsettling close-up of what appears to be a dog's head, heavily distorted and manipulated to create a horrific effect. The most striking feature is the dog's mouth, stretched into an impossibly wide and menacing grin that reveals numerous sharp, human-like teeth. Its eyes are wide open, round, and blank white or glowing, contributing to an overall vacant and soulless stare. The fur around its face and head is colored in aggressive shades of red and dark brown, giving it a bloodied or demonic appearance. The overall impression is that of a creature from a horror story, designed to evoke fear and discomfort. The background is completely black, isolating the terrifying subject and intensifying its impact.. In-Game asset. 2d. High contrast. No shadows
The image depicts a strange, humanoid creature with an unusual and unsettling appearance. It has a small, elongated head with a pointed nose and large, dark eyes that seem to bulge slightly. The creature has sparse, dark hair on its head, which appears messy and uneven. Its body is thin and frail, covered with patchy, coarse hair across its back and sides. The creature is crouched on all fours, with long, thin arms and legs that bend awkwardly. Its skin looks pale and wrinkled, and it has a hunched posture, as if it is crawling or moving slowly.. In-Game asset. 2d. High contrast. No shadows
momo head. In-Game asset. 2d. High contrast. No shadows
chucky head. In-Game asset. 2d. High contrast. No shadows
pennywise head. In-Game asset. 2d. High contrast. No shadows
Red Balloon. In-Game asset. 2d. High contrast. No shadows
It has a purple ribbon and ribbons on a blue gift box. In-Game asset. 2d. High contrast. No shadows
The red color in the game Among us creates the character in an extremely scary way, the glass of the astronaut suit is broken, his eyes are white, his mouth is so long that it touches his ears when he smiles, and he has a bloody knife in his hand.. In-Game asset. 2d. High contrast. No shadows
one scary porcelain doll. It is clear from the whiteness of his skin that he has been standing there for years, one eye is completely closed and one eye is open but he has no eyes (jet black). She has suffered blows for years, fractures and burns on her head, and her beautiful dress is covered with cobwebs.. In-Game asset. 2d. High contrast. No shadows
the scary cartoon cat. In-Game asset. 2d. High contrast. No shadows
scary stickman. In-Game asset. 2d. High contrast. No shadows
scream (horror movie) face. In-Game asset. 2d. High contrast. No shadows
old phone. In-Game asset. 2d. High contrast. No shadows
a madman wearing a purple security suit. He looks frightening, you can tell he's crazy by the glazed look in his eyes. he's just smiling with a knife in his hand, but in the glazed look in his eyes there's a little cry for help. In-Game asset. 2d. High contrast. No shadows
saw( movie charakter). In-Game asset. 2d. High contrast. No shadows
scp 096 head. In-Game asset. 2d. High contrast. No shadows
scp 173 head. In-Game asset. 2d. High contrast. No shadows
siren head. In-Game asset. 2d. High contrast. No shadows
scary sponge bob. In-Game asset. 2d. High contrast. No shadows
jumpscare
Sound effect
foxy_move
Sound effect
testo_taylan_music
Sound effect
freddy_nose_honk
Sound effect
music_box
Sound effect
door_sound
Sound effect
light_sound
Sound effect
light_character_sound
Sound effect
camera_sound
Sound effect
phone_sound
Sound effect
ambient_hum
Sound effect
power_down
Sound effect
footstep
Sound effect
night_ambience
Music
breathing
Sound effect
golden_freddy_jumpscare
Sound effect