User prompt
slow it down a little bit
User prompt
also power drains so fast when cameras are open slow it down a little bit
User prompt
chica: moves to bathroom in 1:30 AM, then comes to party room in 2 AM, then she comes to right corridor in 2:45 AM. foxy: doesnt come to office, just waits ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
animatronics come to office like this; freddy: doesnt come to office, just waits in stage bonnie: Moves to basement in 1 AM, then comes to party room after 30 seconds in basement, then he moves to left corridor in 2 AM, after 20 seconds it repeats ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
when they reach left or right corridor, they wait for 10 seconds, if you dont close the door in 10 seconds they jumpscare you and you lose ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
put camera buttons to the up left corner
User prompt
still no other camera positions. add; basement(also add foxy in there), bathroom; left corridor and right corridor
User prompt
add buttons to change camera position. add freddy to stage area. and power drains so fast
User prompt
add close cemaras button, add animatronics to the areas like, freddy, bonnie, chica to stage and foxy to basement. add more areas like, bathroom, basement, party room, left corridor, right corridor also add button to change cameras. animatronics move in areas closely coming to offices
User prompt
I die so fast add some time for animatronics to come like bonnie, 1AM and show full screen of camera when I open it. and put buttons to change areas on camera.
User prompt
add some areas to cameras for watching animatronics like, stage, bathroom, party area, left corridor, right corridor, basement. and make the power drain slower
Code edit (1 edits merged)
Please save this source code
User prompt
Five Nights at Freddy's: Security Watch
Initial prompt
The player takes on the role of a night security guard working at Freddy Fazbear’s Pizza, a children's restaurant similar to Chuck E. Cheese’s. The main gameplay involves monitoring security cameras from a small office to track the movements of animatronic characters that become active and hostile during the night. Each night in the game lasts from midnight 12 PM to 6 AM, and the player must survive without being caught by the animatronics. The office has limited power, which is consumed when using lights, cameras, or closing doors. If the power runs out before 6 AM, the lights go out, the doors stop working, and the animatronics can enter the office and cause a jumpscare, ending the game. The main animatronic characters in the original game are Freddy Fazbear (a bear), Bonnie (a rabbit), Chica (a chicken), and Foxy (a fox). Each has different patterns of behavior and routes they take to reach the office. The player must use strategy, observation, and timing to prevent them from getting in. Core Objective Survive five (later seven) nights as a night guard at Freddy Fazbear’s Pizza, from 12:00 AM to 6:00 AM, without getting caught by the animatronics. Gameplay Interface You are stationary inside a small security office, facing forward. You interact with the environment using point-and-click controls: Security Cameras: You can view a layout of the building and switch between camera feeds to track the animatronics’ movements. Door Controls: On either side of the office are doors and lights. Lights: Let you check if an animatronic is right outside the door. Doors: Can be shut to prevent animatronics from entering, but they consume power. Power Management You have a limited power supply each night. Using lights, cameras, and door controls all consume power. If power runs out, everything shuts down — doors open, lights and cameras go dark, and Freddy attacks. This creates a tension between monitoring the animatronics and conserving energy. Animatronic Behavior Each animatronic behaves differently: Bonnie (left side): Moves quickly and unpredictably. Frequently checks your left hallway. Chica (right side): Comes down the right hallway. Appears less often than Bonnie. Foxy (left side - Pirate Cove): Only moves if not watched often enough. Will sprint to the office if provoked. Freddy (center): Moves slowly but silently. Becomes more aggressive later in the week. Only visible briefly on certain cameras. They each have different AI patterns that become more aggressive with each passing night. Jumpscares & Game Over If an animatronic enters your office, you are greeted with a loud jumpscare, ending the night. You must then retry that night. Night Progression Each night (Night 1 to Night 5, plus Night 6 and a customizable Night 7) gets progressively harder: Animatronics become faster and more unpredictable. Player must optimize camera use and timing for doors/lights.
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var Animatronic = Container.expand(function (type, startX, startY) {
var self = Container.call(this);
var graphics = self.attachAsset(type, {
anchorX: 0.5,
anchorY: 0.5
});
self.type = type;
self.currentRoom = 0; // 0 = stage, 1-10 = various rooms
self.moveTimer = 0;
self.aggressionLevel = 1;
self.isMoving = false;
// Different movement patterns for each animatronic
self.movementPattern = {
freddy: [0, 1, 2, 3, 4, 5],
// Stage to office path
bonnie: [0, 6, 7, 8, 5],
// Left side path
chica: [0, 9, 10, 11, 5],
// Right side path
foxy: [12, 13, 14, 5] // Pirate cove to office
};
self.update = function () {
self.moveTimer++;
// Movement chance based on aggression and time
var moveChance = self.aggressionLevel * 0.002;
if (Math.random() < moveChance && !self.isMoving) {
self.attemptMove();
}
};
self.attemptMove = function () {
var pattern = self.movementPattern[self.type];
var currentIndex = pattern.indexOf(self.currentRoom);
if (currentIndex < pattern.length - 1) {
self.isMoving = true;
self.currentRoom = pattern[currentIndex + 1];
// Play movement sound
LK.getSound('footsteps').play();
// Reset after movement
LK.setTimeout(function () {
self.isMoving = false;
}, 1000);
}
};
self.setAggression = function (level) {
self.aggressionLevel = level;
};
return self;
});
var SecurityCamera = Container.expand(function (roomId) {
var self = Container.call(this);
var cameraView = self.attachAsset('cameraView', {
anchorX: 0.5,
anchorY: 0.5
});
self.roomId = roomId;
self.isActive = false;
self.activate = function () {
self.isActive = true;
self.alpha = 1;
powerDrain += 1;
};
self.deactivate = function () {
self.isActive = false;
self.alpha = 0.3;
powerDrain -= 1;
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000
});
/****
* Game Code
****/
// Sounds
// UI elements
// Animatronics
// Doors
// Door controls
// Office view
// Game state variables
var gameHour = 0; // 0-5 (12AM to 6AM)
var gameMinutes = 0;
var nightNumber = 1;
var powerLevel = 100;
var powerDrain = 1; // Base power drain per second
var gameRunning = true;
var cameraMode = false;
// Door states
var leftDoorClosed = false;
var rightDoorClosed = false;
var leftLightOn = false;
var rightLightOn = false;
// Animatronics
var animatronics = [];
var freddy = new Animatronic('freddy', 1024, 1366);
var bonnie = new Animatronic('bonnie', 1024, 1366);
var chica = new Animatronic('chica', 1024, 1366);
var foxy = new Animatronic('foxy', 1024, 1366);
animatronics.push(freddy, bonnie, chica, foxy);
// Set initial aggression based on night
freddy.setAggression(nightNumber);
bonnie.setAggression(nightNumber);
chica.setAggression(nightNumber);
foxy.setAggression(nightNumber);
// Office setup
var office = game.addChild(LK.getAsset('office', {
x: 224,
y: 766,
anchorX: 0.5,
anchorY: 0.5
}));
var desk = game.addChild(LK.getAsset('desk', {
x: 1024,
y: 2582,
anchorX: 0.5,
anchorY: 1
}));
var monitor = game.addChild(LK.getAsset('monitor', {
x: 1024,
y: 2432,
anchorX: 0.5,
anchorY: 1
}));
var monitorScreen = game.addChild(LK.getAsset('monitorScreen', {
x: 1024,
y: 2432,
anchorX: 0.5,
anchorY: 1
}));
// Door controls
var leftDoorButton = game.addChild(LK.getAsset('leftDoorButton', {
x: 200,
y: 2300,
anchorX: 0.5,
anchorY: 0.5
}));
var rightDoorButton = game.addChild(LK.getAsset('rightDoorButton', {
x: 1848,
y: 2300,
anchorX: 0.5,
anchorY: 0.5
}));
var leftLightButton = game.addChild(LK.getAsset('leftLightButton', {
x: 200,
y: 2150,
anchorX: 0.5,
anchorY: 0.5
}));
var rightLightButton = game.addChild(LK.getAsset('rightLightButton', {
x: 1848,
y: 2150,
anchorX: 0.5,
anchorY: 0.5
}));
// Doors
var leftDoor = game.addChild(LK.getAsset('leftDoor', {
x: 0,
y: 1366,
anchorX: 0,
anchorY: 0.5
}));
var rightDoor = game.addChild(LK.getAsset('rightDoor', {
x: 2048,
y: 1366,
anchorX: 1,
anchorY: 0.5
}));
// Initially hide doors
leftDoor.x = -200;
rightDoor.x = 2248;
// UI Elements
var timeText = new Text2('12:00 AM', {
size: 60,
fill: 0xFFFFFF
});
timeText.anchor.set(1, 0);
LK.gui.topRight.addChild(timeText);
var nightText = new Text2('Night ' + nightNumber, {
size: 50,
fill: 0xFFFFFF
});
nightText.anchor.set(0, 0);
LK.gui.topLeft.addChild(nightText);
nightText.x = 120; // Avoid platform menu
var powerBarBg = LK.gui.bottomLeft.addChild(LK.getAsset('powerBarBg', {
x: 20,
y: -60,
anchorX: 0,
anchorY: 0
}));
var powerBar = LK.gui.bottomLeft.addChild(LK.getAsset('powerBar', {
x: 20,
y: -60,
anchorX: 0,
anchorY: 0
}));
var powerText = new Text2('Power: 100%', {
size: 30,
fill: 0xFFFFFF
});
powerText.anchor.set(0, 0);
powerText.x = 20;
powerText.y = -100;
LK.gui.bottomLeft.addChild(powerText);
var cameraText = new Text2('Camera: OFF', {
size: 40,
fill: 0xFFFFFF
});
cameraText.anchor.set(0.5, 0);
cameraText.x = 0;
cameraText.y = 50;
LK.gui.center.addChild(cameraText);
// Event handlers
leftDoorButton.down = function (x, y, obj) {
toggleLeftDoor();
};
rightDoorButton.down = function (x, y, obj) {
toggleRightDoor();
};
leftLightButton.down = function (x, y, obj) {
toggleLeftLight();
};
rightLightButton.down = function (x, y, obj) {
toggleRightLight();
};
monitor.down = function (x, y, obj) {
toggleCamera();
};
// Game functions
function toggleLeftDoor() {
if (powerLevel <= 0) return;
leftDoorClosed = !leftDoorClosed;
LK.getSound('doorSlam').play();
if (leftDoorClosed) {
tween(leftDoor, {
x: 0
}, {
duration: 500
});
leftDoorButton.tint = 0x00ff00;
powerDrain += 1;
} else {
tween(leftDoor, {
x: -200
}, {
duration: 500
});
leftDoorButton.tint = 0xffffff;
powerDrain -= 1;
}
}
function toggleRightDoor() {
if (powerLevel <= 0) return;
rightDoorClosed = !rightDoorClosed;
LK.getSound('doorSlam').play();
if (rightDoorClosed) {
tween(rightDoor, {
x: 1848
}, {
duration: 500
});
rightDoorButton.tint = 0x00ff00;
powerDrain += 1;
} else {
tween(rightDoor, {
x: 2248
}, {
duration: 500
});
rightDoorButton.tint = 0xffffff;
powerDrain -= 1;
}
}
function toggleLeftLight() {
if (powerLevel <= 0) return;
leftLightOn = !leftLightOn;
if (leftLightOn) {
leftLightButton.tint = 0xffff00;
powerDrain += 1;
checkHallway('left');
} else {
leftLightButton.tint = 0xffffff;
powerDrain -= 1;
}
}
function toggleRightLight() {
if (powerLevel <= 0) return;
rightLightOn = !rightLightOn;
if (rightLightOn) {
rightLightButton.tint = 0xffff00;
powerDrain += 1;
checkHallway('right');
} else {
rightLightButton.tint = 0xffffff;
powerDrain -= 1;
}
}
function toggleCamera() {
if (powerLevel <= 0) return;
cameraMode = !cameraMode;
if (cameraMode) {
cameraText.setText('Camera: ON');
monitorScreen.tint = 0x0000ff;
powerDrain += 1;
} else {
cameraText.setText('Camera: OFF');
monitorScreen.tint = 0xffffff;
powerDrain -= 1;
}
}
function checkHallway(side) {
// Check if animatronics are in the hallway
var animatronicPresent = false;
for (var i = 0; i < animatronics.length; i++) {
var animatronic = animatronics[i];
if (side === 'left' && (animatronic.type === 'bonnie' || animatronic.type === 'foxy') && animatronic.currentRoom === 5 || side === 'right' && animatronic.type === 'chica' && animatronic.currentRoom === 5) {
animatronicPresent = true;
break;
}
}
if (animatronicPresent) {
LK.effects.flashScreen(0xff0000, 200);
}
}
function checkForJumpscares() {
for (var i = 0; i < animatronics.length; i++) {
var animatronic = animatronics[i];
// Check if animatronic reached office
if (animatronic.currentRoom === 5) {
// Bonnie/Foxy check left door
if ((animatronic.type === 'bonnie' || animatronic.type === 'foxy') && !leftDoorClosed) {
jumpscare(animatronic.type);
return;
}
// Chica checks right door
if (animatronic.type === 'chica' && !rightDoorClosed) {
jumpscare(animatronic.type);
return;
}
// Freddy can attack from either side
if (animatronic.type === 'freddy' && (!leftDoorClosed || !rightDoorClosed)) {
jumpscare(animatronic.type);
return;
}
}
}
}
function jumpscare(animatronicType) {
gameRunning = false;
LK.getSound('jumpscare').play();
LK.effects.flashScreen(0xff0000, 1000);
LK.setTimeout(function () {
LK.showGameOver();
}, 1000);
}
function updateTime() {
gameMinutes += 1;
if (gameMinutes >= 60) {
gameMinutes = 0;
gameHour += 1;
if (gameHour >= 6) {
// Night completed
nightCompleted();
return;
}
}
var displayHour = gameHour === 0 ? 12 : gameHour;
var displayMinutes = gameMinutes.toString().padStart(2, '0');
var ampm = gameHour < 6 ? 'AM' : 'AM';
timeText.setText(displayHour + ':' + displayMinutes + ' ' + ampm);
}
function nightCompleted() {
gameRunning = false;
if (nightNumber >= 5) {
LK.showYouWin();
} else {
nightNumber++;
// Reset for next night
resetNight();
}
}
function resetNight() {
gameHour = 0;
gameMinutes = 0;
powerLevel = 100;
powerDrain = 1;
gameRunning = true;
// Reset animatronics
for (var i = 0; i < animatronics.length; i++) {
animatronics[i].currentRoom = 0;
animatronics[i].setAggression(nightNumber);
}
// Reset doors and lights
leftDoorClosed = false;
rightDoorClosed = false;
leftLightOn = false;
rightLightOn = false;
cameraMode = false;
// Reset UI
nightText.setText('Night ' + nightNumber);
leftDoorButton.tint = 0xffffff;
rightDoorButton.tint = 0xffffff;
leftLightButton.tint = 0xffffff;
rightLightButton.tint = 0xffffff;
monitorScreen.tint = 0xffffff;
cameraText.setText('Camera: OFF');
// Reset door positions
leftDoor.x = -200;
rightDoor.x = 2248;
}
// Game timers
var timeTimer = LK.setInterval(function () {
if (gameRunning) {
updateTime();
}
}, 1000); // 1 second = 1 minute in game
var powerTimer = LK.setInterval(function () {
if (gameRunning && powerLevel > 0) {
powerLevel -= powerDrain * 0.1;
if (powerLevel < 0) powerLevel = 0;
// Update power bar
var powerPercent = powerLevel / 100;
powerBar.width = 300 * powerPercent;
powerText.setText('Power: ' + Math.ceil(powerLevel) + '%');
if (powerLevel <= 0) {
powerOut();
}
}
}, 100);
function powerOut() {
LK.getSound('powerDown').play();
// Turn off all systems
leftDoorClosed = false;
rightDoorClosed = false;
leftLightOn = false;
rightLightOn = false;
cameraMode = false;
powerDrain = 0;
// Reset visual states
leftDoorButton.tint = 0x333333;
rightDoorButton.tint = 0x333333;
leftLightButton.tint = 0x333333;
rightLightButton.tint = 0x333333;
monitorScreen.tint = 0x333333;
// Hide doors
tween(leftDoor, {
x: -200
}, {
duration: 1000
});
tween(rightDoor, {
x: 2248
}, {
duration: 1000
});
// Freddy will attack after power runs out
LK.setTimeout(function () {
if (gameRunning) {
jumpscare('freddy');
}
}, 3000);
}
game.update = function () {
if (!gameRunning) return;
// Update animatronics
for (var i = 0; i < animatronics.length; i++) {
animatronics[i].update();
}
// Check for jumpscares
checkForJumpscares();
// Update power drain visualization
if (powerDrain > 1) {
powerBar.tint = 0xff0000;
} else {
powerBar.tint = 0x00ff00;
}
}; ===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,491 @@
-/****
+/****
+* Plugins
+****/
+var tween = LK.import("@upit/tween.v1");
+
+/****
+* Classes
+****/
+var Animatronic = Container.expand(function (type, startX, startY) {
+ var self = Container.call(this);
+ var graphics = self.attachAsset(type, {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.type = type;
+ self.currentRoom = 0; // 0 = stage, 1-10 = various rooms
+ self.moveTimer = 0;
+ self.aggressionLevel = 1;
+ self.isMoving = false;
+ // Different movement patterns for each animatronic
+ self.movementPattern = {
+ freddy: [0, 1, 2, 3, 4, 5],
+ // Stage to office path
+ bonnie: [0, 6, 7, 8, 5],
+ // Left side path
+ chica: [0, 9, 10, 11, 5],
+ // Right side path
+ foxy: [12, 13, 14, 5] // Pirate cove to office
+ };
+ self.update = function () {
+ self.moveTimer++;
+ // Movement chance based on aggression and time
+ var moveChance = self.aggressionLevel * 0.002;
+ if (Math.random() < moveChance && !self.isMoving) {
+ self.attemptMove();
+ }
+ };
+ self.attemptMove = function () {
+ var pattern = self.movementPattern[self.type];
+ var currentIndex = pattern.indexOf(self.currentRoom);
+ if (currentIndex < pattern.length - 1) {
+ self.isMoving = true;
+ self.currentRoom = pattern[currentIndex + 1];
+ // Play movement sound
+ LK.getSound('footsteps').play();
+ // Reset after movement
+ LK.setTimeout(function () {
+ self.isMoving = false;
+ }, 1000);
+ }
+ };
+ self.setAggression = function (level) {
+ self.aggressionLevel = level;
+ };
+ return self;
+});
+var SecurityCamera = Container.expand(function (roomId) {
+ var self = Container.call(this);
+ var cameraView = self.attachAsset('cameraView', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.roomId = roomId;
+ self.isActive = false;
+ self.activate = function () {
+ self.isActive = true;
+ self.alpha = 1;
+ powerDrain += 1;
+ };
+ self.deactivate = function () {
+ self.isActive = false;
+ self.alpha = 0.3;
+ powerDrain -= 1;
+ };
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
backgroundColor: 0x000000
-});
\ No newline at end of file
+});
+
+/****
+* Game Code
+****/
+// Sounds
+// UI elements
+// Animatronics
+// Doors
+// Door controls
+// Office view
+// Game state variables
+var gameHour = 0; // 0-5 (12AM to 6AM)
+var gameMinutes = 0;
+var nightNumber = 1;
+var powerLevel = 100;
+var powerDrain = 1; // Base power drain per second
+var gameRunning = true;
+var cameraMode = false;
+// Door states
+var leftDoorClosed = false;
+var rightDoorClosed = false;
+var leftLightOn = false;
+var rightLightOn = false;
+// Animatronics
+var animatronics = [];
+var freddy = new Animatronic('freddy', 1024, 1366);
+var bonnie = new Animatronic('bonnie', 1024, 1366);
+var chica = new Animatronic('chica', 1024, 1366);
+var foxy = new Animatronic('foxy', 1024, 1366);
+animatronics.push(freddy, bonnie, chica, foxy);
+// Set initial aggression based on night
+freddy.setAggression(nightNumber);
+bonnie.setAggression(nightNumber);
+chica.setAggression(nightNumber);
+foxy.setAggression(nightNumber);
+// Office setup
+var office = game.addChild(LK.getAsset('office', {
+ x: 224,
+ y: 766,
+ anchorX: 0.5,
+ anchorY: 0.5
+}));
+var desk = game.addChild(LK.getAsset('desk', {
+ x: 1024,
+ y: 2582,
+ anchorX: 0.5,
+ anchorY: 1
+}));
+var monitor = game.addChild(LK.getAsset('monitor', {
+ x: 1024,
+ y: 2432,
+ anchorX: 0.5,
+ anchorY: 1
+}));
+var monitorScreen = game.addChild(LK.getAsset('monitorScreen', {
+ x: 1024,
+ y: 2432,
+ anchorX: 0.5,
+ anchorY: 1
+}));
+// Door controls
+var leftDoorButton = game.addChild(LK.getAsset('leftDoorButton', {
+ x: 200,
+ y: 2300,
+ anchorX: 0.5,
+ anchorY: 0.5
+}));
+var rightDoorButton = game.addChild(LK.getAsset('rightDoorButton', {
+ x: 1848,
+ y: 2300,
+ anchorX: 0.5,
+ anchorY: 0.5
+}));
+var leftLightButton = game.addChild(LK.getAsset('leftLightButton', {
+ x: 200,
+ y: 2150,
+ anchorX: 0.5,
+ anchorY: 0.5
+}));
+var rightLightButton = game.addChild(LK.getAsset('rightLightButton', {
+ x: 1848,
+ y: 2150,
+ anchorX: 0.5,
+ anchorY: 0.5
+}));
+// Doors
+var leftDoor = game.addChild(LK.getAsset('leftDoor', {
+ x: 0,
+ y: 1366,
+ anchorX: 0,
+ anchorY: 0.5
+}));
+var rightDoor = game.addChild(LK.getAsset('rightDoor', {
+ x: 2048,
+ y: 1366,
+ anchorX: 1,
+ anchorY: 0.5
+}));
+// Initially hide doors
+leftDoor.x = -200;
+rightDoor.x = 2248;
+// UI Elements
+var timeText = new Text2('12:00 AM', {
+ size: 60,
+ fill: 0xFFFFFF
+});
+timeText.anchor.set(1, 0);
+LK.gui.topRight.addChild(timeText);
+var nightText = new Text2('Night ' + nightNumber, {
+ size: 50,
+ fill: 0xFFFFFF
+});
+nightText.anchor.set(0, 0);
+LK.gui.topLeft.addChild(nightText);
+nightText.x = 120; // Avoid platform menu
+var powerBarBg = LK.gui.bottomLeft.addChild(LK.getAsset('powerBarBg', {
+ x: 20,
+ y: -60,
+ anchorX: 0,
+ anchorY: 0
+}));
+var powerBar = LK.gui.bottomLeft.addChild(LK.getAsset('powerBar', {
+ x: 20,
+ y: -60,
+ anchorX: 0,
+ anchorY: 0
+}));
+var powerText = new Text2('Power: 100%', {
+ size: 30,
+ fill: 0xFFFFFF
+});
+powerText.anchor.set(0, 0);
+powerText.x = 20;
+powerText.y = -100;
+LK.gui.bottomLeft.addChild(powerText);
+var cameraText = new Text2('Camera: OFF', {
+ size: 40,
+ fill: 0xFFFFFF
+});
+cameraText.anchor.set(0.5, 0);
+cameraText.x = 0;
+cameraText.y = 50;
+LK.gui.center.addChild(cameraText);
+// Event handlers
+leftDoorButton.down = function (x, y, obj) {
+ toggleLeftDoor();
+};
+rightDoorButton.down = function (x, y, obj) {
+ toggleRightDoor();
+};
+leftLightButton.down = function (x, y, obj) {
+ toggleLeftLight();
+};
+rightLightButton.down = function (x, y, obj) {
+ toggleRightLight();
+};
+monitor.down = function (x, y, obj) {
+ toggleCamera();
+};
+// Game functions
+function toggleLeftDoor() {
+ if (powerLevel <= 0) return;
+ leftDoorClosed = !leftDoorClosed;
+ LK.getSound('doorSlam').play();
+ if (leftDoorClosed) {
+ tween(leftDoor, {
+ x: 0
+ }, {
+ duration: 500
+ });
+ leftDoorButton.tint = 0x00ff00;
+ powerDrain += 1;
+ } else {
+ tween(leftDoor, {
+ x: -200
+ }, {
+ duration: 500
+ });
+ leftDoorButton.tint = 0xffffff;
+ powerDrain -= 1;
+ }
+}
+function toggleRightDoor() {
+ if (powerLevel <= 0) return;
+ rightDoorClosed = !rightDoorClosed;
+ LK.getSound('doorSlam').play();
+ if (rightDoorClosed) {
+ tween(rightDoor, {
+ x: 1848
+ }, {
+ duration: 500
+ });
+ rightDoorButton.tint = 0x00ff00;
+ powerDrain += 1;
+ } else {
+ tween(rightDoor, {
+ x: 2248
+ }, {
+ duration: 500
+ });
+ rightDoorButton.tint = 0xffffff;
+ powerDrain -= 1;
+ }
+}
+function toggleLeftLight() {
+ if (powerLevel <= 0) return;
+ leftLightOn = !leftLightOn;
+ if (leftLightOn) {
+ leftLightButton.tint = 0xffff00;
+ powerDrain += 1;
+ checkHallway('left');
+ } else {
+ leftLightButton.tint = 0xffffff;
+ powerDrain -= 1;
+ }
+}
+function toggleRightLight() {
+ if (powerLevel <= 0) return;
+ rightLightOn = !rightLightOn;
+ if (rightLightOn) {
+ rightLightButton.tint = 0xffff00;
+ powerDrain += 1;
+ checkHallway('right');
+ } else {
+ rightLightButton.tint = 0xffffff;
+ powerDrain -= 1;
+ }
+}
+function toggleCamera() {
+ if (powerLevel <= 0) return;
+ cameraMode = !cameraMode;
+ if (cameraMode) {
+ cameraText.setText('Camera: ON');
+ monitorScreen.tint = 0x0000ff;
+ powerDrain += 1;
+ } else {
+ cameraText.setText('Camera: OFF');
+ monitorScreen.tint = 0xffffff;
+ powerDrain -= 1;
+ }
+}
+function checkHallway(side) {
+ // Check if animatronics are in the hallway
+ var animatronicPresent = false;
+ for (var i = 0; i < animatronics.length; i++) {
+ var animatronic = animatronics[i];
+ if (side === 'left' && (animatronic.type === 'bonnie' || animatronic.type === 'foxy') && animatronic.currentRoom === 5 || side === 'right' && animatronic.type === 'chica' && animatronic.currentRoom === 5) {
+ animatronicPresent = true;
+ break;
+ }
+ }
+ if (animatronicPresent) {
+ LK.effects.flashScreen(0xff0000, 200);
+ }
+}
+function checkForJumpscares() {
+ for (var i = 0; i < animatronics.length; i++) {
+ var animatronic = animatronics[i];
+ // Check if animatronic reached office
+ if (animatronic.currentRoom === 5) {
+ // Bonnie/Foxy check left door
+ if ((animatronic.type === 'bonnie' || animatronic.type === 'foxy') && !leftDoorClosed) {
+ jumpscare(animatronic.type);
+ return;
+ }
+ // Chica checks right door
+ if (animatronic.type === 'chica' && !rightDoorClosed) {
+ jumpscare(animatronic.type);
+ return;
+ }
+ // Freddy can attack from either side
+ if (animatronic.type === 'freddy' && (!leftDoorClosed || !rightDoorClosed)) {
+ jumpscare(animatronic.type);
+ return;
+ }
+ }
+ }
+}
+function jumpscare(animatronicType) {
+ gameRunning = false;
+ LK.getSound('jumpscare').play();
+ LK.effects.flashScreen(0xff0000, 1000);
+ LK.setTimeout(function () {
+ LK.showGameOver();
+ }, 1000);
+}
+function updateTime() {
+ gameMinutes += 1;
+ if (gameMinutes >= 60) {
+ gameMinutes = 0;
+ gameHour += 1;
+ if (gameHour >= 6) {
+ // Night completed
+ nightCompleted();
+ return;
+ }
+ }
+ var displayHour = gameHour === 0 ? 12 : gameHour;
+ var displayMinutes = gameMinutes.toString().padStart(2, '0');
+ var ampm = gameHour < 6 ? 'AM' : 'AM';
+ timeText.setText(displayHour + ':' + displayMinutes + ' ' + ampm);
+}
+function nightCompleted() {
+ gameRunning = false;
+ if (nightNumber >= 5) {
+ LK.showYouWin();
+ } else {
+ nightNumber++;
+ // Reset for next night
+ resetNight();
+ }
+}
+function resetNight() {
+ gameHour = 0;
+ gameMinutes = 0;
+ powerLevel = 100;
+ powerDrain = 1;
+ gameRunning = true;
+ // Reset animatronics
+ for (var i = 0; i < animatronics.length; i++) {
+ animatronics[i].currentRoom = 0;
+ animatronics[i].setAggression(nightNumber);
+ }
+ // Reset doors and lights
+ leftDoorClosed = false;
+ rightDoorClosed = false;
+ leftLightOn = false;
+ rightLightOn = false;
+ cameraMode = false;
+ // Reset UI
+ nightText.setText('Night ' + nightNumber);
+ leftDoorButton.tint = 0xffffff;
+ rightDoorButton.tint = 0xffffff;
+ leftLightButton.tint = 0xffffff;
+ rightLightButton.tint = 0xffffff;
+ monitorScreen.tint = 0xffffff;
+ cameraText.setText('Camera: OFF');
+ // Reset door positions
+ leftDoor.x = -200;
+ rightDoor.x = 2248;
+}
+// Game timers
+var timeTimer = LK.setInterval(function () {
+ if (gameRunning) {
+ updateTime();
+ }
+}, 1000); // 1 second = 1 minute in game
+var powerTimer = LK.setInterval(function () {
+ if (gameRunning && powerLevel > 0) {
+ powerLevel -= powerDrain * 0.1;
+ if (powerLevel < 0) powerLevel = 0;
+ // Update power bar
+ var powerPercent = powerLevel / 100;
+ powerBar.width = 300 * powerPercent;
+ powerText.setText('Power: ' + Math.ceil(powerLevel) + '%');
+ if (powerLevel <= 0) {
+ powerOut();
+ }
+ }
+}, 100);
+function powerOut() {
+ LK.getSound('powerDown').play();
+ // Turn off all systems
+ leftDoorClosed = false;
+ rightDoorClosed = false;
+ leftLightOn = false;
+ rightLightOn = false;
+ cameraMode = false;
+ powerDrain = 0;
+ // Reset visual states
+ leftDoorButton.tint = 0x333333;
+ rightDoorButton.tint = 0x333333;
+ leftLightButton.tint = 0x333333;
+ rightLightButton.tint = 0x333333;
+ monitorScreen.tint = 0x333333;
+ // Hide doors
+ tween(leftDoor, {
+ x: -200
+ }, {
+ duration: 1000
+ });
+ tween(rightDoor, {
+ x: 2248
+ }, {
+ duration: 1000
+ });
+ // Freddy will attack after power runs out
+ LK.setTimeout(function () {
+ if (gameRunning) {
+ jumpscare('freddy');
+ }
+ }, 3000);
+}
+game.update = function () {
+ if (!gameRunning) return;
+ // Update animatronics
+ for (var i = 0; i < animatronics.length; i++) {
+ animatronics[i].update();
+ }
+ // Check for jumpscares
+ checkForJumpscares();
+ // Update power drain visualization
+ if (powerDrain > 1) {
+ powerBar.tint = 0xff0000;
+ } else {
+ powerBar.tint = 0x00ff00;
+ }
+};
\ No newline at end of file
footsteps
Sound effect
menuMusic
Music
doorSlam
Sound effect
cameraSwitch
Sound effect
scream
Sound effect
officeAmbiance
Sound effect
cameraAmbiance
Sound effect
cameraToggle
Sound effect
completion
Sound effect
powerDown
Sound effect
cutsceneMusic
Sound effect
freddyCorridorSound
Sound effect
customNightEndSound
Sound effect