Spaces:
Running

sus / index.html
annyable's picture
Add 3 files
8d8dab5 verified
Raw History Blame Contribute Delete
24.2 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Mortal Kombat Replica</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>
@import url('https://fonts.googleapis.com/css2?family=Metal+Mania&display=swap');
.mk-font {
font-family: 'Metal Mania', cursive;
}
.blood-drip {
position: relative;
}
.blood-drip::after {
content: '';
position: absolute;
bottom: -10px;
left: 0;
width: 100%;
height: 15px;
background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 20"><path d="M0,10 C20,25 30,5 50,10 C70,15 80,0 100,10 L100,20 L0,20 Z" fill="%23d10000"/></svg>') repeat-x;
background-size: 100px 15px;
}
.character-select {
transition: all 0.3s ease;
}
.character-select:hover {
transform: scale(1.05);
filter: drop-shadow(0 0 10px rgba(255, 0, 0, 0.7));
}
.selected-character {
transform: scale(1.1);
filter: drop-shadow(0 0 15px rgba(255, 0, 0, 0.9));
}
.health-bar {
height: 30px;
transition: width 0.3s ease;
}
.fatality-effect {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: radial-gradient(circle, rgba(255,0,0,0.8) 0%, rgba(0,0,0,0.9) 70%);
z-index: 100;
display: none;
justify-content: center;
align-items: center;
animation: pulse 0.5s infinite alternate;
}
@keyframes pulse {
from { opacity: 0.8; }
to { opacity: 1; }
}
.combo-display {
position: absolute;
font-size: 2rem;
color: #ffcc00;
text-shadow: 0 0 10px #ff0000;
opacity: 0;
transition: all 0.3s ease;
}
</style>
</head>
<body class="bg-gray-900 text-white">
<div class="fatality-effect" id="fatalityEffect">
<h1 class="text-6xl mk-font text-red-600">FATALITY!</h1>
</div>
<div class="container mx-auto px-4 py-8">
<!-- Header -->
<header class="text-center mb-12">
<h1 class="text-6xl md:text-8xl mk-font blood-drip text-red-600 mb-4">MORTAL KOMBAT</h1>
<p class="text-xl text-yellow-400">CHOOSE YOUR DESTINY</p>
</header>
<!-- Character Selection -->
<div class="grid grid-cols-2 md:grid-cols-4 gap-6 mb-12" id="characterSelection">
<div class="character-select cursor-pointer text-center" data-character="scorpion">
<div class="bg-gray-800 rounded-lg overflow-hidden border-2 border-red-700 p-4">
<img src="https://i.imgur.com/JjQY9zX.png" alt="Scorpion" class="w-full h-48 object-contain">
<h3 class="text-xl mt-2 text-red-500 mk-font">SCORPION</h3>
</div>
</div>
<div class="character-select cursor-pointer text-center" data-character="subzero">
<div class="bg-gray-800 rounded-lg overflow-hidden border-2 border-blue-700 p-4">
<img src="https://i.imgur.com/5vQz6Wq.png" alt="Sub-Zero" class="w-full h-48 object-contain">
<h3 class="text-xl mt-2 text-blue-400 mk-font">SUB-ZERO</h3>
</div>
</div>
<div class="character-select cursor-pointer text-center" data-character="liukang">
<div class="bg-gray-800 rounded-lg overflow-hidden border-2 border-yellow-600 p-4">
<img src="https://i.imgur.com/8mZ9vWg.png" alt="Liu Kang" class="w-full h-48 object-contain">
<h3 class="text-xl mt-2 text-yellow-400 mk-font">LIU KANG</h3>
</div>
</div>
<div class="character-select cursor-pointer text-center" data-character="raiden">
<div class="bg-gray-800 rounded-lg overflow-hidden border-2 border-blue-400 p-4">
<img src="https://i.imgur.com/3XQ3v9W.png" alt="Raiden" class="w-full h-48 object-contain">
<h3 class="text-xl mt-2 text-blue-300 mk-font">RAIDEN</h3>
</div>
</div>
</div>
<!-- Fight Area -->
<div class="bg-gray-800 rounded-lg border-4 border-red-900 p-6 mb-8 hidden" id="fightArea">
<div class="flex justify-between items-center mb-6">
<div class="w-1/3">
<div class="flex items-center">
<img src="https://i.imgur.com/JjQY9zX.png" alt="Player 1" class="w-16 h-16 rounded-full border-2 border-red-600 mr-4" id="player1Avatar">
<div>
<h3 class="text-xl text-red-500 mk-font" id="player1Name">PLAYER 1</h3>
<div class="health-bar bg-red-600 rounded-full" id="player1Health" style="width: 100%"></div>
</div>
</div>
</div>
<div class="text-4xl mk-font text-yellow-400">VS</div>
<div class="w-1/3">
<div class="flex items-center justify-end">
<div class="text-right mr-4">
<h3 class="text-xl text-blue-400 mk-font" id="player2Name">PLAYER 2</h3>
<div class="health-bar bg-blue-600 rounded-full" id="player2Health" style="width: 100%"></div>
</div>
<img src="https://i.imgur.com/5vQz6Wq.png" alt="Player 2" class="w-16 h-16 rounded-full border-2 border-blue-600" id="player2Avatar">
</div>
</div>
</div>
<div class="bg-gray-700 rounded-lg p-6 relative h-64 overflow-hidden" id="arena">
<div class="absolute inset-0 bg-gradient-to-r from-gray-800 to-gray-900 opacity-50"></div>
<div class="relative z-10 flex justify-center items-center h-full">
<div class="text-center">
<p class="text-xl mb-4">Press any key to attack!</p>
<div class="flex justify-center space-x-4">
<button class="bg-red-600 hover:bg-red-700 text-white px-6 py-2 rounded-lg mk-font" id="punchButton">PUNCH</button>
<button class="bg-blue-600 hover:bg-blue-700 text-white px-6 py-2 rounded-lg mk-font" id="kickButton">KICK</button>
<button class="bg-yellow-600 hover:bg-yellow-700 text-black px-6 py-2 rounded-lg mk-font" id="specialButton">SPECIAL</button>
</div>
</div>
</div>
<div class="absolute top-0 left-0 w-full h-full flex justify-center items-center pointer-events-none">
<div class="combo-display" id="comboDisplay"></div>
</div>
</div>
<div class="mt-6 flex justify-between">
<div class="text-red-400">
<p>Player 1 Health: <span id="player1HealthValue">100</span>%</p>
</div>
<div class="text-blue-400">
<p>Player 2 Health: <span id="player2HealthValue">100</span>%</p>
</div>
</div>
</div>
<!-- Controls -->
<div class="bg-gray-800 rounded-lg border-2 border-gray-700 p-6 mt-8">
<h2 class="text-2xl mk-font text-yellow-400 mb-4">CONTROLS</h2>
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
<div class="bg-gray-700 p-4 rounded-lg">
<h3 class="text-lg text-red-400 mb-2">Basic Attacks</h3>
<ul class="space-y-2">
<li><span class="text-yellow-400">Punch:</span> Quick jab (5 damage)</li>
<li><span class="text-yellow-400">Kick:</span> Strong kick (10 damage)</li>
</ul>
</div>
<div class="bg-gray-700 p-4 rounded-lg">
<h3 class="text-lg text-red-400 mb-2">Special Moves</h3>
<ul class="space-y-2">
<li><span class="text-yellow-400">Special:</span> Character-specific (15-25 damage)</li>
<li><span class="text-yellow-400">Combo:</span> Chain attacks for bonus damage</li>
</ul>
</div>
<div class="bg-gray-700 p-4 rounded-lg">
<h3 class="text-lg text-red-400 mb-2">Fatality</h3>
<ul class="space-y-2">
<li>Reduce opponent health to 0</li>
<li>Press <span class="text-yellow-400">F</span> for Fatality!</li>
</ul>
</div>
</div>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
// Game state
const gameState = {
player1: {
name: '',
health: 100,
character: null,
avatar: '',
specialMove: ''
},
player2: {
name: 'COMPUTER',
health: 100,
character: null,
avatar: '',
specialMove: ''
},
currentPlayer: 1,
comboCount: 0,
lastAttackTime: 0,
gameActive: false
};
// Character data
const characters = {
scorpion: {
name: 'SCORPION',
avatar: 'https://i.imgur.com/JjQY9zX.png',
specialMove: 'SPEAR THROW',
specialDamage: 25,
color: 'red'
},
subzero: {
name: 'SUB-ZERO',
avatar: 'https://i.imgur.com/5vQz6Wq.png',
specialMove: 'ICE BLAST',
specialDamage: 20,
color: 'blue'
},
liukang: {
name: 'LIU KANG',
avatar: 'https://i.imgur.com/8mZ9vWg.png',
specialMove: 'FLYING KICK',
specialDamage: 22,
color: 'yellow'
},
raiden: {
name: 'RAIDEN',
avatar: 'https://i.imgur.com/3XQ3v9W.png',
specialMove: 'LIGHTNING STRIKE',
specialDamage: 18,
color: 'blue'
}
};
// DOM elements
const characterSelection = document.getElementById('characterSelection');
const fightArea = document.getElementById('fightArea');
const player1Name = document.getElementById('player1Name');
const player1Avatar = document.getElementById('player1Avatar');
const player1Health = document.getElementById('player1Health');
const player1HealthValue = document.getElementById('player1HealthValue');
const player2Name = document.getElementById('player2Name');
const player2Avatar = document.getElementById('player2Avatar');
const player2Health = document.getElementById('player2Health');
const player2HealthValue = document.getElementById('player2HealthValue');
const punchButton = document.getElementById('punchButton');
const kickButton = document.getElementById('kickButton');
const specialButton = document.getElementById('specialButton');
const arena = document.getElementById('arena');
const fatalityEffect = document.getElementById('fatalityEffect');
const comboDisplay = document.getElementById('comboDisplay');
// Character selection
const characterSelects = document.querySelectorAll('.character-select');
characterSelects.forEach(select => {
select.addEventListener('click', function() {
const character = this.getAttribute('data-character');
// Reset all selections
characterSelects.forEach(s => {
s.querySelector('div').classList.remove('selected-character', 'border-red-600', 'border-blue-600', 'border-yellow-600', 'border-blue-400');
});
// Set selected character
this.querySelector('div').classList.add('selected-character');
// Set player 1 character
gameState.player1.character = character;
gameState.player1.name = characters[character].name;
gameState.player1.avatar = characters[character].avatar;
gameState.player1.specialMove = characters[character].specialMove;
// Randomly select computer character
const computerCharacters = Object.keys(characters).filter(c => c !== character);
const randomCharacter = computerCharacters[Math.floor(Math.random() * computerCharacters.length)];
gameState.player2.character = randomCharacter;
gameState.player2.name = characters[randomCharacter].name;
gameState.player2.avatar = characters[randomCharacter].avatar;
gameState.player2.specialMove = characters[randomCharacter].specialMove;
// Update UI
player1Name.textContent = gameState.player1.name;
player1Avatar.src = gameState.player1.avatar;
player2Name.textContent = gameState.player2.name;
player2Avatar.src = gameState.player2.avatar;
// Show fight area
fightArea.classList.remove('hidden');
gameState.gameActive = true;
// Scroll to fight area
fightArea.scrollIntoView({ behavior: 'smooth' });
});
});
// Attack functions
function punch() {
if (!gameState.gameActive) return;
const damage = 5 + Math.floor(Math.random() * 3);
attack(damage, 'PUNCH');
}
function kick() {
if (!gameState.gameActive) return;
const damage = 8 + Math.floor(Math.random() * 5);
attack(damage, 'KICK');
}
function special() {
if (!gameState.gameActive) return;
const character = gameState.player1.character;
const damage = characters[character].specialDamage;
attack(damage, gameState.player1.specialMove);
}
function attack(damage, move) {
// Check for combo
const now = Date.now();
if (now - gameState.lastAttackTime < 1000) {
gameState.comboCount++;
showCombo(gameState.comboCount);
// Bonus damage for combos
damage += Math.floor(gameState.comboCount * 1.5);
} else {
gameState.comboCount = 0;
}
gameState.lastAttackTime = now;
// Apply damage to opponent
gameState.player2.health = Math.max(0, gameState.player2.health - damage);
// Update UI
updateHealthBars();
// Show attack effect
showAttackEffect(move, damage);
// Check for fatality
if (gameState.player2.health <= 0) {
fatality();
return;
}
// Computer counter attack
setTimeout(computerAttack, 800);
}
function computerAttack() {
if (!gameState.gameActive || gameState.player2.health <= 0) return;
const attacks = ['punch', 'kick', 'special'];
const randomAttack = attacks[Math.floor(Math.random() * attacks.length)];
let damage = 0;
let move = '';
switch(randomAttack) {
case 'punch':
damage = 4 + Math.floor(Math.random() * 3);
move = 'PUNCH';
break;
case 'kick':
damage = 7 + Math.floor(Math.random() * 4);
move = 'KICK';
break;
case 'special':
damage = characters[gameState.player2.character].specialDamage - 3 + Math.floor(Math.random() * 6);
move = gameState.player2.specialMove;
break;
}
// Apply damage to player
gameState.player1.health = Math.max(0, gameState.player1.health - damage);
// Update UI
updateHealthBars();
// Show attack effect
showAttackEffect(move, damage, true);
// Check for fatality
if (gameState.player1.health <= 0) {
fatality();
}
}
function updateHealthBars() {
player1Health.style.width = `${gameState.player1.health}%`;
player2Health.style.width = `${gameState.player2.health}%`;
player1HealthValue.textContent = gameState.player1.health;
player2HealthValue.textContent = gameState.player2.health;
// Change color based on health
if (gameState.player1.health < 30) {
player1Health.classList.remove('bg-red-600');
player1Health.classList.add('bg-red-800');
} else {
player1Health.classList.remove('bg-red-800');
player1Health.classList.add('bg-red-600');
}
if (gameState.player2.health < 30) {
player2Health.classList.remove('bg-blue-600');
player2Health.classList.add('bg-blue-800');
} else {
player2Health.classList.remove('bg-blue-800');
player2Health.classList.add('bg-blue-600');
}
}
function showAttackEffect(move, damage, isComputer = false) {
const effect = document.createElement('div');
effect.className = 'absolute text-xl font-bold';
if (isComputer) {
effect.className += ' text-blue-400 right-4 top-4';
effect.textContent = `${move} -${damage}`;
} else {
effect.className += ' text-red-500 left-4 top-4';
effect.textContent = `${move} -${damage}`;
}
arena.appendChild(effect);
// Animate
setTimeout(() => {
effect.style.opacity = '0';
effect.style.transform = isComputer ? 'translateX(20px)' : 'translateX(-20px)';
}, 100);
// Remove after animation
setTimeout(() => {
effect.remove();
}, 1000);
}
function showCombo(count) {
if (count < 2) return;
comboDisplay.textContent = `COMBO x${count}`;
comboDisplay.style.opacity = '1';
comboDisplay.style.transform = 'scale(1.5)';
setTimeout(() => {
comboDisplay.style.opacity = '0';
comboDisplay.style.transform = 'scale(1)';
}, 1000);
}
function fatality() {
gameState.gameActive = false;
fatalityEffect.style.display = 'flex';
// Play sound (would be added if we had audio)
// new Audio('fatality.mp3').play();
setTimeout(() => {
fatalityEffect.style.display = 'none';
// Reset game after fatality
setTimeout(resetGame, 2000);
}, 3000);
}
function resetGame() {
gameState.player1.health = 100;
gameState.player2.health = 100;
gameState.comboCount = 0;
gameState.lastAttackTime = 0;
updateHealthBars();
// Reset character selection
characterSelects.forEach(select => {
select.querySelector('div').classList.remove('selected-character');
});
fightArea.classList.add('hidden');
gameState.gameActive = false;
}
// Event listeners
punchButton.addEventListener('click', punch);
kickButton.addEventListener('click', kick);
specialButton.addEventListener('click', special);
// Keyboard controls
document.addEventListener('keydown', function(e) {
if (!gameState.gameActive) return;
switch(e.key.toLowerCase()) {
case 'p':
punch();
break;
case 'k':
kick();
break;
case 's':
special();
break;
case 'f':
if (gameState.player2.health <= 0) {
fatality();
}
break;
}
});
});
</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=annyable/sus" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>