si-gma / index.html
AHMIT12's picture
I have to survive from 0 to 6 o'clock during the night by closing the door to the animatronics and walking around shining the light on the animatronics with a flashlight. - Initial Deployment
72ea37e verified
Raw History Blame Contribute Delete
27.6 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Five Nights Survival</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
@keyframes flicker {
0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% {
opacity: 1;
}
20%, 22%, 24%, 55% {
opacity: 0.3;
}
}
.flicker {
animation: flicker 3s infinite;
}
.camera-static {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAABhSURBVGhD7cExAQAwDMCg+zfdQzCQkKz8cZKZ2d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3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d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3极简的静态效果 */
background-size: 100% 100%;
background-repeat: no-repeat;
}
.jumpscare {
animation: shake 0.5s linear infinite;
}
@keyframes shake {
0%, 100% { transform: translateX(0); }
10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
20%, 40%, 60%, 80% { transform: translateX(10px); }
}
.power-bar {
transition: width 0.5s ease;
}
</style>
</head>
<body class="bg-black text-white font-mono overflow-hidden h-screen flex flex-col">
<!-- Main Game Container -->
<div class="flex flex-col h-full">
<!-- Header with Time and Power -->
<div class="flex justify-between items-center p-4 bg-gray-900 border-b border-red-900">
<div class="text-xl">
<span id="current-time">12:00 AM</span>
</div>
<div class="flex items-center space-x-4">
<div class="flex items-center">
<i class="fas fa-bolt text-yellow-400 mr-2"></i>
<div class="w-32 h-6 bg-gray-800 rounded-full overflow-hidden">
<div id="power-level" class="h-full bg-blue-500 power-bar" style="width: 100%"></div>
</div>
<span id="power-percent" class="ml-2">100%</span>
</div>
<button id="flashlight-btn" class="bg-gray-700 hover:bg-gray-600 px-4 py-2 rounded flex items-center">
<i class="fas fa-lightbulb mr-2"></i> Flashlight
</button>
</div>
</div>
<!-- Main Game Area -->
<div class="flex flex-1 relative overflow-hidden">
<!-- Left Side - Camera Monitor -->
<div id="camera-view" class="w-3/4 bg-black border-r border-gray-800 relative flex items-center justify-center">
<div id="camera-feed" class="w-full h-full flex items-center justify-center camera-static">
<div id="animatronic-alert" class="hidden absolute inset-0 flex items-center justify-center">
<img id="animatronic-img" src="" alt="Animatronic" class="max-h-full max-w-full">
</div>
</div>
<div id="camera-controls" class="absolute bottom-4 left-0 right-0 flex justify-center space-x-4">
<button class="camera-btn bg-gray-800 hover:bg-gray-700 w-12 h-12 rounded-full flex items-center justify-center" data-camera="1">
<i class="fas fa-door-closed"></i>
</button>
<button class="camera-btn bg-gray-800 hover:bg-gray-700 w-12 h-12 rounded-full flex items-center justify-center" data-camera="2">
<i class="fas fa-utensils"></i>
</button>
<button class="camera-btn bg-gray-800 hover:bg-gray-700 w-12 h-12 rounded-full flex items-center justify-center" data-camera="3">
<i class="fas fa-mask"></i>
</button>
<button class="camera-btn bg-gray-800 hover:bg-gray-700 w-12 h-12 rounded-full flex items-center justify-center" data-camera="4">
<i class="fas fa-theater-masks"></i>
</button>
</div>
</div>
<!-- Right Side - Controls -->
<div class="w-1/4 bg-gray-900 flex flex-col">
<!-- Door Controls -->
<div class="p-4 border-b border-gray-800">
<h2 class="text-lg font-bold mb-2 text-red-400">Door Controls</h2>
<div class="flex justify-between">
<button id="left-door-btn" class="door-btn bg-red-900 hover:bg-red-800 px-4 py-2 rounded flex items-center">
<i class="fas fa-door-closed mr-2"></i> Left Door
</button>
<button id="right-door-btn" class="door-btn bg-red-900 hover:bg-red-800 px-4 py-2 rounded flex items-center">
<i class="fas fa-door-closed mr-2"></i> Right Door
</button>
</div>
</div>
<!-- Animatronic Status -->
<div class="p-4 border-b border-gray-800">
<h2 class="text-lg font-bold mb-2 text-yellow-400">Animatronic Status</h2>
<div class="space-y-2">
<div class="flex justify-between items-center">
<span>Freddy</span>
<span id="freddy-status" class="text-green-400">Safe</span>
</div>
<div class="flex justify-between items-center">
<span>Bonnie</span>
<span id="bonnie-status" class="text-green-400">Safe</span>
</div>
<div class="flex justify-between items-center">
<span>Chica</span>
<span id="chica-status" class="text-green-400">Safe</span>
</div>
<div class="flex justify-between items-center">
<span>Foxy</span>
<span id="foxy-status" class="text-green-400">Safe</span>
</div>
</div>
</div>
<!-- Audio Controls -->
<div class="p-4">
<h2 class="text-lg font-bold mb-2 text-blue-400">Audio</h2>
<div class="flex justify-between">
<button id="audio-btn" class="bg-gray-800 hover:bg-gray-700 px-4 py-2 rounded flex items-center">
<i class="fas fa-volume-up mr-2"></i> Toggle
</button>
<button id="distraction-btn" class="bg-gray-800 hover:bg-gray-700 px-4 py-2 rounded flex items-center">
<i class="fas fa-bell mr-2"></i> Distraction
</button>
</div>
</div>
</div>
</div>
</div>
<!-- Game Over Modal -->
<div id="game-over-modal" class="hidden fixed inset-0 bg-black bg-opacity-90 flex items-center justify-center z-50">
<div class="bg-gray-900 p-8 rounded-lg max-w-md text-center border border-red-700">
<h2 class="text-3xl font-bold text-red-500 mb-4">GAME OVER</h2>
<p id="death-message" class="text-xl mb-6">You didn't survive the night...</p>
<div class="flex justify-center space-x-4">
<button id="restart-btn" class="bg-red-700 hover:bg-red-600 px-6 py-2 rounded">
Try Again
</button>
</div>
</div>
</div>
<script>
// Game State
const gameState = {
time: 0, // 0-6 represents hours
power: 100,
leftDoorClosed: false,
rightDoorClosed: false,
flashlightOn: false,
cameraActive: false,
currentCamera: null,
animatronics: {
freddy: { position: 'stage', aggression: 0 },
bonnie: { position: 'stage', aggression: 0 },
chica: { position: 'stage', aggression: 0 },
foxy: { position: 'pirate cove', aggression: 0 }
},
gameActive: true,
audioPlaying: false
};
// DOM Elements
const timeElement = document.getElementById('current-time');
const powerLevelElement = document.getElementById('power-level');
const powerPercentElement = document.getElementById('power-percent');
const flashlightBtn = document.getElementById('flashlight-btn');
const leftDoorBtn = document.getElementById('left-door-btn');
const rightDoorBtn = document.getElementById('right-door-btn');
const cameraView = document.getElementById('camera-view');
const cameraFeed = document.getElementById('camera-feed');
const animatronicAlert = document.getElementById('animatronic-alert');
const animatronicImg = document.getElementById('animatronic-img');
const cameraControls = document.getElementById('camera-controls');
const cameraBtns = document.querySelectorAll('.camera-btn');
const audioBtn = document.getElementById('audio-btn');
const distractionBtn = document.getElementById('distraction-btn');
const gameOverModal = document.getElementById('game-over-modal');
const deathMessage = document.getElementById('death-message');
const restartBtn = document.getElementById('restart-btn');
const statusElements = {
freddy: document.getElementById('freddy-status'),
bonnie: document.getElementById('bonnie-status'),
chica: document.getElementById('chica-status'),
foxy: document.getElementById('foxy-status')
};
// Time formatting
function formatTime(hour) {
const period = hour < 6 ? 'AM' : 'PM';
const displayHour = hour === 0 ? 12 : (hour > 12 ? hour - 12 : hour);
return `${displayHour}:00 ${period}`;
}
// Update UI based on game state
function updateUI() {
timeElement.textContent = formatTime(gameState.time);
powerLevelElement.style.width = `${gameState.power}%`;
powerPercentElement.textContent = `${Math.floor(gameState.power)}%`;
// Update door buttons
leftDoorBtn.innerHTML = `<i class="fas fa-door-${gameState.leftDoorClosed ? 'closed' : 'open'} mr-2"></i> Left Door`;
leftDoorBtn.className = `door-btn ${gameState.leftDoorClosed ? 'bg-red-700' : 'bg-red-900'} hover:bg-red-800 px-4 py-2 rounded flex items-center`;
rightDoorBtn.innerHTML = `<i class="fas fa-door-${gameState.rightDoorClosed ? 'closed' : 'open'} mr-2"></i> Right Door`;
rightDoorBtn.className = `door-btn ${gameState.rightDoorClosed ? 'bg-red-700' : 'bg-red-900'} hover:bg-red-800 px-4 py-2 rounded flex items-center`;
// Update flashlight button
flashlightBtn.innerHTML = `<i class="fas fa-lightbulb mr-2 ${gameState.flashlightOn ? 'text-yellow-400' : ''}"></i> Flashlight`;
// Update animatronic statuses
for (const [name, animatronic] of Object.entries(gameState.animatronics)) {
let statusText = '';
let statusClass = '';
if (animatronic.position === 'office') {
statusText = 'IN OFFICE!';
statusClass = 'text-red-500 font-bold';
} else if (animatronic.position === 'door') {
statusText = 'At Door';
statusClass = 'text-orange-400';
} else {
statusText = animatronic.position.charAt(0).toUpperCase() + animatronic.position.slice(1);
statusClass = 'text-green-400';
}
statusElements[name].textContent = statusText;
statusElements[name].className = statusClass;
}
}
// Power consumption
function consumePower() {
if (!gameState.gameActive) return;
let consumption = 0.5; // Base consumption
if (gameState.leftDoorClosed) consumption += 1;
if (gameState.rightDoorClosed) consumption += 1;
if (gameState.flashlightOn) consumption += 0.75;
if (gameState.cameraActive) consumption += 0.5;
gameState.power = Math.max(0, gameState.power - consumption);
if (gameState.power <= 0) {
gameState.power = 0;
gameOver("You ran out of power!");
}
updateUI();
}
// Animatronic movement
function moveAnimatronics() {
if (!gameState.gameActive) return;
for (const [name, animatronic] of Object.entries(gameState.animatronics)) {
// Increase aggression based on time
animatronic.aggression += Math.random() * (0.1 + (gameState.time / 20));
// Movement logic
const moveChance = Math.random() * 100;
if (moveChance < animatronic.aggression) {
// Special movement for Foxy
if (name === 'foxy') {
if (animatronic.position === 'pirate cove') {
animatronic.position = 'hallway';
} else if (animatronic.position === 'hallway') {
// Check if right door is closed
if (!gameState.rightDoorClosed) {
animatronic.position = 'office';
jumpscare(name);
} else {
animatronic.position = 'pirate cove';
}
}
}
// Movement for other animatronics
else {
const positions = ['stage', 'dining', 'hallway', 'door'];
const currentIndex = positions.indexOf(animatronic.position);
if (currentIndex < positions.length - 1) {
animatronic.position = positions[currentIndex + 1];
// Check if at door and door is closed
if (animatronic.position === 'door') {
const doorClosed = name === 'bonnie' ? gameState.leftDoorClosed : gameState.rightDoorClosed;
if (!doorClosed) {
animatronic.position = 'office';
jumpscare(name);
}
}
}
}
}
// Reset aggression if at stage
if (animatronic.position === 'stage' || animatronic.position === 'pirate cove') {
animatronic.aggression = 0;
}
}
updateUI();
}
// Jumpscare
function jumpscare(animatronic) {
gameState.gameActive = false;
// Show jumpscare image
animatronicAlert.classList.remove('hidden');
animatronicImg.src = `https://via.placeholder.com/400x300/ff0000/000000?text=${animatronic.toUpperCase()}+JUMPSCARE`;
animatronicAlert.classList.add('jumpscare');
// Play sound (would be implemented with actual audio files)
// audio.src = `sounds/${animatronic}_jumpscare.mp3`;
// audio.play();
// Show game over
setTimeout(() => {
deathMessage.textContent = `${animatronic.charAt(0).toUpperCase() + animatronic.slice(1)} got you!`;
gameOverModal.classList.remove('hidden');
}, 1500);
}
// Game over
function gameOver(message) {
gameState.gameActive = false;
deathMessage.textContent = message;
gameOverModal.classList.remove('hidden');
}
// Time progression
function advanceTime() {
if (!gameState.gameActive) return;
gameState.time += 1;
if (gameState.time >= 6) {
gameOver("Congratulations! You survived the night!");
return;
}
updateUI();
}
// Event Listeners
flashlightBtn.addEventListener('click', () => {
if (!gameState.gameActive) return;
gameState.flashlightOn = !gameState.flashlightOn;
updateUI();
});
leftDoorBtn.addEventListener('click', () => {
if (!gameState.gameActive) return;
gameState.leftDoorClosed = !gameState.leftDoorClosed;
updateUI();
});
rightDoorBtn.addEventListener('click', () => {
if (!gameState.gameActive) return;
gameState.rightDoorClosed = !gameState.rightDoorClosed;
updateUI();
});
cameraBtns.forEach(btn => {
btn.addEventListener('click', () => {
if (!gameState.gameActive) return;
const camera = btn.dataset.camera;
gameState.cameraActive = true;
gameState.currentCamera = camera;
// Change camera view (in a real game, this would show different camera feeds)
cameraFeed.className = 'w-full h-full flex items-center justify-center camera-static flicker';
// After a delay, return to normal view
setTimeout(() => {
gameState.cameraActive = false;
cameraFeed.className = 'w-full h-full flex items-center justify-center camera-static';
}, 2000);
});
});
audioBtn.addEventListener('click', () => {
gameState.audioPlaying = !gameState.audioPlaying;
audioBtn.innerHTML = `<i class="fas fa-volume-${gameState.audioPlaying ? 'up' : 'mute'} mr-2"></i> Toggle`;
});
distractionBtn.addEventListener('click', () => {
if (!gameState.gameActive) return;
// Distraction can lure animatronics away (simple implementation)
for (const animatronic of Object.values(gameState.animatronics)) {
if (animatronic.position !== 'office' && animatronic.position !== 'door') {
animatronic.aggression = Math.max(0, animatronic.aggression - 10);
}
}
// Consume extra power for distraction
gameState.power = Math.max(0, gameState.power - 5);
updateUI();
});
restartBtn.addEventListener('click', () => {
// Reset game state
gameState.time = 0;
gameState.power = 100;
gameState.leftDoorClosed = false;
gameState.rightDoorClosed = false;
gameState.flashlightOn = false;
gameState.cameraActive = false;
gameState.currentCamera = null;
gameState.gameActive = true;
for (const animatronic of Object.values(gameState.animatronics)) {
animatronic.position = animatronic === gameState.animatronics.foxy ? 'pirate cove' : 'stage';
animatronic.aggression = 0;
}
// Hide jumpscare and game over
animatronicAlert.classList.add('hidden');
animatronicAlert.classList.remove('jumpscare');
gameOverModal.classList.add('hidden');
updateUI();
});
// Game loop
setInterval(consumePower, 1000);
setInterval(moveAnimatronics, 3000);
setInterval(advanceTime, 60000); // 1 minute per hour (for demo purposes)
// Initialize
updateUI();
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=AHMIT12/si-gma" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>