Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Chrono Cipher Chamber</title>
- <style>
- * {
- margin: 0;
- padding: 0;
- box-sizing: border-box;
- }
- body {
- font-family: 'Courier New', monospace;
- background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 100%);
- display: flex;
- justify-content: center;
- align-items: center;
- min-height: 100vh;
- overflow: hidden;
- color: #fff;
- }
- #gameContainer {
- position: relative;
- width: 900px;
- max-width: 95vw;
- background: rgba(20, 20, 40, 0.9);
- border: 3px solid #00ffff;
- border-radius: 20px;
- padding: 30px;
- box-shadow: 0 0 40px rgba(0, 255, 255, 0.5),
- inset 0 0 30px rgba(0, 100, 255, 0.2);
- }
- #title {
- text-align: center;
- font-size: 2.5em;
- color: #00ffff;
- text-shadow: 0 0 20px rgba(0, 255, 255, 0.8);
- margin-bottom: 20px;
- letter-spacing: 3px;
- }
- #hud {
- display: flex;
- justify-content: space-between;
- margin-bottom: 20px;
- font-size: 1.2em;
- padding: 15px;
- background: rgba(0, 0, 0, 0.5);
- border-radius: 10px;
- border: 2px solid #00aaff;
- }
- .hud-item {
- display: flex;
- flex-direction: column;
- align-items: center;
- }
- .hud-label {
- color: #00aaff;
- font-size: 0.8em;
- margin-bottom: 5px;
- }
- .hud-value {
- color: #00ffff;
- font-size: 1.3em;
- font-weight: bold;
- text-shadow: 0 0 10px rgba(0, 255, 255, 0.6);
- }
- #canvas {
- display: block;
- width: 100%;
- height: 500px;
- background: rgba(0, 0, 0, 0.7);
- border: 2px solid #00aaff;
- border-radius: 10px;
- cursor: pointer;
- box-shadow: inset 0 0 30px rgba(0, 150, 255, 0.3);
- }
- #instructions {
- margin-top: 20px;
- text-align: center;
- color: #00aaff;
- font-size: 0.9em;
- line-height: 1.6;
- padding: 15px;
- background: rgba(0, 0, 0, 0.4);
- border-radius: 10px;
- border: 1px solid #004488;
- }
- .pulse {
- animation: pulse 2s ease-in-out infinite;
- }
- @keyframes pulse {
- 0%, 100% { opacity: 0.6; transform: scale(1); }
- 50% { opacity: 1; transform: scale(1.05); }
- }
- .glow {
- animation: glow 1.5s ease-in-out infinite alternate;
- }
- @keyframes glow {
- from { text-shadow: 0 0 10px rgba(0, 255, 255, 0.5); }
- to { text-shadow: 0 0 20px rgba(0, 255, 255, 1), 0 0 30px rgba(0, 255, 255, 0.8); }
- }
- #modal {
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- background: rgba(10, 10, 30, 0.98);
- border: 3px solid #00ffff;
- border-radius: 15px;
- padding: 40px;
- text-align: center;
- box-shadow: 0 0 50px rgba(0, 255, 255, 0.8);
- z-index: 100;
- min-width: 400px;
- }
- #modal h2 {
- color: #00ffff;
- font-size: 2em;
- margin-bottom: 20px;
- text-shadow: 0 0 15px rgba(0, 255, 255, 0.8);
- }
- #modal p {
- color: #00aaff;
- font-size: 1.2em;
- margin-bottom: 15px;
- }
- #modal button {
- background: linear-gradient(135deg, #00aaff 0%, #0088ff 100%);
- color: white;
- border: none;
- padding: 15px 40px;
- font-size: 1.2em;
- border-radius: 10px;
- cursor: pointer;
- margin: 10px;
- font-family: 'Courier New', monospace;
- font-weight: bold;
- box-shadow: 0 0 20px rgba(0, 150, 255, 0.6);
- transition: all 0.3s;
- }
- #modal button:hover {
- background: linear-gradient(135deg, #00ccff 0%, #00aaff 100%);
- box-shadow: 0 0 30px rgba(0, 200, 255, 0.9);
- transform: scale(1.05);
- }
- .hidden {
- display: none;
- }
- #timeWarning {
- position: absolute;
- top: 10px;
- left: 50%;
- transform: translateX(-50%);
- background: rgba(255, 0, 0, 0.8);
- color: white;
- padding: 10px 30px;
- border-radius: 10px;
- font-size: 1.2em;
- font-weight: bold;
- display: none;
- animation: shake 0.5s ease-in-out infinite;
- z-index: 50;
- }
- @keyframes shake {
- 0%, 100% { transform: translateX(-50%) translateY(0); }
- 25% { transform: translateX(-50%) translateY(-5px); }
- 75% { transform: translateX(-50%) translateY(5px); }
- }
- </style>
- </head>
- <body>
- <div id="gameContainer">
- <h1 id="title" class="glow">CHRONO CIPHER CHAMBER</h1>
- <div id="hud">
- <div class="hud-item">
- <span class="hud-label">CHAMBER</span>
- <span class="hud-value" id="level">1</span>
- </div>
- <div class="hud-item">
- <span class="hud-label">TIME WINDOW</span>
- <span class="hud-value" id="timer">30.0</span>
- </div>
- <div class="hud-item">
- <span class="hud-label">SCORE</span>
- <span class="hud-value" id="score">0</span>
- </div>
- <div class="hud-item">
- <span class="hud-label">STREAK</span>
- <span class="hud-value" id="streak">0</span>
- </div>
- </div>
- <div id="timeWarning">TIME WINDOW CLOSING!</div>
- <canvas id="canvas"></canvas>
- <div id="instructions">
- <strong>TEMPORAL PROTOCOL:</strong> Match the glyphs on the left to the shifting cipher pattern on the right.
- Click glyphs to rotate them through their temporal states.
- Patterns shift with the flow of time - solve before the window closes!
- </div>
- <div id="modal" class="hidden">
- <h2 id="modalTitle">CHAMBER SEALED</h2>
- <p id="modalMessage"></p>
- <button id="modalButton">CONTINUE</button>
- </div>
- </div>
- <script>
- const canvas = document.getElementById('canvas');
- const ctx = canvas.getContext('2d');
- // Set canvas size
- canvas.width = canvas.offsetWidth;
- canvas.height = canvas.offsetHeight;
- // Game state
- const game = {
- level: 1,
- score: 0,
- streak: 0,
- timeLimit: 30,
- timeRemaining: 30,
- running: false,
- glyphs: ['◇', '△', '□', '○', '☆', '◈', '◊', '▽'],
- playerGlyphs: [],
- targetGlyphs: [],
- glyphSize: 60,
- selectedGlyph: -1,
- timeSpeed: 1,
- rotationStates: {},
- particleEffects: [],
- lastTime: 0
- };
- // Initialize game
- function init() {
- generateLevel();
- game.running = true;
- game.lastTime = Date.now();
- gameLoop();
- }
- // Generate new level
- function generateLevel() {
- const glyphCount = Math.min(3 + game.level, 6);
- game.playerGlyphs = [];
- game.targetGlyphs = [];
- game.rotationStates = {};
- // Create target pattern
- for (let i = 0; i < glyphCount; i++) {
- const glyph = game.glyphs[Math.floor(Math.random() * game.glyphs.length)];
- game.targetGlyphs.push(glyph);
- }
- // Create shuffled player glyphs
- for (let i = 0; i < glyphCount; i++) {
- const randomGlyph = game.glyphs[Math.floor(Math.random() * game.glyphs.length)];
- game.playerGlyphs.push(randomGlyph);
- game.rotationStates[i] = 0;
- }
- game.timeRemaining = game.timeLimit;
- game.timeSpeed = 1 + (game.level - 1) * 0.1;
- }
- // Draw glyph with effects
- function drawGlyph(x, y, glyph, rotation, scale, color, glowIntensity) {
- ctx.save();
- ctx.translate(x, y);
- ctx.rotate(rotation);
- ctx.scale(scale, scale);
- // Glow effect
- if (glowIntensity > 0) {
- ctx.shadowColor = color;
- ctx.shadowBlur = 20 * glowIntensity;
- }
- // Background circle
- ctx.fillStyle = 'rgba(0, 50, 100, 0.5)';
- ctx.beginPath();
- ctx.arc(0, 0, game.glyphSize / 2, 0, Math.PI * 2);
- ctx.fill();
- // Border
- ctx.strokeStyle = color;
- ctx.lineWidth = 3;
- ctx.stroke();
- // Glyph symbol
- ctx.fillStyle = color;
- ctx.font = `bold ${game.glyphSize * 0.6}px Arial`;
- ctx.textAlign = 'center';
- ctx.textBaseline = 'middle';
- ctx.fillText(glyph, 0, 0);
- ctx.restore();
- }
- // Draw game
- function draw() {
- // Clear canvas
- ctx.fillStyle = 'rgba(0, 0, 0, 0.1)';
- ctx.fillRect(0, 0, canvas.width, canvas.height);
- // Draw grid effect
- ctx.strokeStyle = 'rgba(0, 100, 150, 0.1)';
- ctx.lineWidth = 1;
- for (let i = 0; i < canvas.width; i += 20) {
- ctx.beginPath();
- ctx.moveTo(i, 0);
- ctx.lineTo(i, canvas.height);
- ctx.stroke();
- }
- for (let i = 0; i < canvas.height; i += 20) {
- ctx.beginPath();
- ctx.moveTo(0, i);
- ctx.lineTo(canvas.width, i);
- ctx.stroke();
- }
- const now = Date.now();
- const timeProgress = (game.timeLimit - game.timeRemaining) / game.timeLimit;
- // Draw player glyphs (left side)
- const leftX = canvas.width * 0.25;
- const startY = canvas.height / 2 - (game.playerGlyphs.length * 80) / 2;
- ctx.fillStyle = '#00aaff';
- ctx.font = 'bold 20px Courier New';
- ctx.textAlign = 'center';
- ctx.fillText('YOUR SEQUENCE', leftX, 30);
- game.playerGlyphs.forEach((glyph, i) => {
- const y = startY + i * 80;
- const rotation = (game.rotationStates[i] * Math.PI / 4) + (now * 0.001);
- const isSelected = game.selectedGlyph === i;
- const scale = isSelected ? 1.1 : 1;
- const color = isSelected ? '#00ffff' : '#00aaff';
- const glow = isSelected ? 1 : 0.3;
- drawGlyph(leftX, y, glyph, rotation, scale, color, glow);
- // Draw index
- ctx.fillStyle = '#00aaff';
- ctx.font = '14px Courier New';
- ctx.fillText(`[${i + 1}]`, leftX, y + 50);
- });
- // Draw target glyphs (right side) with time-based shifting
- const rightX = canvas.width * 0.75;
- ctx.fillStyle = '#00ffaa';
- ctx.font = 'bold 20px Courier New';
- ctx.textAlign = 'center';
- ctx.fillText('TARGET CIPHER', rightX, 30);
- game.targetGlyphs.forEach((glyph, i) => {
- const y = startY + i * 80;
- const timeShift = Math.sin(now * 0.003 + i) * 0.3;
- const rotation = now * 0.002 * (1 + timeShift);
- const scale = 1 + Math.sin(now * 0.005 + i) * 0.1;
- const pulseIntensity = 0.5 + Math.sin(now * 0.004 + i) * 0.3;
- drawGlyph(rightX + timeShift * 20, y, glyph, rotation, scale, '#00ffaa', pulseIntensity);
- });
- // Draw connecting lines showing matches
- ctx.strokeStyle = 'rgba(0, 255, 255, 0.2)';
- ctx.lineWidth = 2;
- game.playerGlyphs.forEach((glyph, i) => {
- const y = startY + i * 80;
- const isMatch = glyph === game.targetGlyphs[i];
- if (isMatch) {
- ctx.strokeStyle = 'rgba(0, 255, 170, 0.6)';
- ctx.lineWidth = 3;
- } else {
- ctx.strokeStyle = 'rgba(255, 100, 100, 0.3)';
- ctx.lineWidth = 2;
- }
- ctx.beginPath();
- ctx.moveTo(leftX + 40, y);
- ctx.lineTo(rightX - 40, y);
- ctx.stroke();
- });
- // Draw particle effects
- game.particleEffects = game.particleEffects.filter(p => {
- p.life -= 0.02;
- p.y -= p.vy;
- p.x += p.vx;
- if (p.life > 0) {
- ctx.fillStyle = `rgba(0, 255, 255, ${p.life})`;
- ctx.fillRect(p.x, p.y, 3, 3);
- return true;
- }
- return false;
- });
- // Draw time indicator
- const timeBarWidth = canvas.width * 0.8;
- const timeBarX = (canvas.width - timeBarWidth) / 2;
- const timeBarY = canvas.height - 40;
- const progress = game.timeRemaining / game.timeLimit;
- ctx.fillStyle = 'rgba(0, 50, 100, 0.5)';
- ctx.fillRect(timeBarX, timeBarY, timeBarWidth, 20);
- const gradient = ctx.createLinearGradient(timeBarX, 0, timeBarX + timeBarWidth * progress, 0);
- gradient.addColorStop(0, '#00ffff');
- gradient.addColorStop(0.5, '#00aaff');
- gradient.addColorStop(1, progress < 0.3 ? '#ff0000' : '#0088ff');
- ctx.fillStyle = gradient;
- ctx.fillRect(timeBarX, timeBarY, timeBarWidth * progress, 20);
- ctx.strokeStyle = '#00aaff';
- ctx.lineWidth = 2;
- ctx.strokeRect(timeBarX, timeBarY, timeBarWidth, 20);
- }
- // Handle click
- canvas.addEventListener('click', (e) => {
- if (!game.running) return;
- const rect = canvas.getBoundingClientRect();
- const x = e.clientX - rect.left;
- const y = e.clientY - rect.top;
- const leftX = canvas.width * 0.25;
- const startY = canvas.height / 2 - (game.playerGlyphs.length * 80) / 2;
- game.playerGlyphs.forEach((_, i) => {
- const glyphY = startY + i * 80;
- const dist = Math.sqrt((x - leftX) ** 2 + (y - glyphY) ** 2);
- if (dist < game.glyphSize / 2) {
- rotateGlyph(i);
- }
- });
- });
- // Rotate glyph
- function rotateGlyph(index) {
- const currentIndex = game.glyphs.indexOf(game.playerGlyphs[index]);
- const nextIndex = (currentIndex + 1) % game.glyphs.length;
- game.playerGlyphs[index] = game.glyphs[nextIndex];
- game.rotationStates[index] = (game.rotationStates[index] + 1) % 8;
- // Create particle effect
- const leftX = canvas.width * 0.25;
- const startY = canvas.height / 2 - (game.playerGlyphs.length * 80) / 2;
- const y = startY + index * 80;
- for (let i = 0; i < 10; i++) {
- game.particleEffects.push({
- x: leftX,
- y: y,
- vx: (Math.random() - 0.5) * 4,
- vy: Math.random() * 3,
- life: 1
- });
- }
- checkWin();
- }
- // Check win condition
- function checkWin() {
- const isMatch = game.playerGlyphs.every((glyph, i) => glyph === game.targetGlyphs[i]);
- if (isMatch) {
- game.running = false;
- const timeBonus = Math.floor(game.timeRemaining * 10);
- const levelBonus = game.level * 100;
- const streakBonus = game.streak * 50;
- const totalPoints = timeBonus + levelBonus + streakBonus;
- game.score += totalPoints;
- game.streak++;
- game.level++;
- showModal(
- 'CHAMBER UNLOCKED!',
- `Time Bonus: +${timeBonus}<br>Level Bonus: +${levelBonus}<br>Streak Bonus: +${streakBonus}<br><br>Total: +${totalPoints} points`,
- 'NEXT CHAMBER'
- );
- }
- }
- // Update game
- function update(deltaTime) {
- if (!game.running) return;
- game.timeRemaining -= deltaTime * game.timeSpeed;
- if (game.timeRemaining <= 0) {
- game.timeRemaining = 0;
- game.running = false;
- game.streak = 0;
- showModal(
- 'TIME EXPIRED',
- `The temporal window has closed.<br>Chamber ${game.level} remains sealed.<br><br>Final Score: ${game.score}`,
- 'TRY AGAIN'
- );
- }
- // Update HUD
- document.getElementById('timer').textContent = game.timeRemaining.toFixed(1);
- document.getElementById('level').textContent = game.level;
- document.getElementById('score').textContent = game.score;
- document.getElementById('streak').textContent = game.streak;
- // Show time warning
- const warning = document.getElementById('timeWarning');
- if (game.timeRemaining < 10 && game.running) {
- warning.style.display = 'block';
- } else {
- warning.style.display = 'none';
- }
- }
- // Show modal
- function showModal(title, message, buttonText) {
- document.getElementById('modalTitle').textContent = title;
- document.getElementById('modalMessage').innerHTML = message;
- document.getElementById('modalButton').textContent = buttonText;
- document.getElementById('modal').classList.remove('hidden');
- }
- // Modal button handler
- document.getElementById('modalButton').addEventListener('click', () => {
- document.getElementById('modal').classList.add('hidden');
- if (game.timeRemaining <= 0 && game.level === 1) {
- // Game over, restart
- game.level = 1;
- game.score = 0;
- game.streak = 0;
- }
- generateLevel();
- game.running = true;
- });
- // Game loop
- function gameLoop() {
- const now = Date.now();
- const deltaTime = (now - game.lastTime) / 1000;
- game.lastTime = now;
- update(deltaTime);
- draw();
- requestAnimationFrame(gameLoop);
- }
- // Start game
- init();
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment