sem-titulo

Pasted Nov 20, 2026, 11:35 PM1 file592 lines

Scan to open on your phone

Point a camera at the QR code - it opens this exact paste, no app needed.

https://codepastes.com/zzgs0ge7fkxw7598
sem-titulo
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Granny: The Demon Assassin</title>
<style>
  * { box-sizing: border-box; user-select: none; -webkit-user-select: none; margin: 0; padding: 0; }
  body {
    background: #070709;
    color: #e5e5e5;
    font-family: 'Courier New', Courier, monospace;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
  }
  #menu-screen, #gameover-screen, #win-screen {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, #1c0505 0%, #050505 90%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 20;
    padding: 20px;
    text-align: center;
  }
  h1 {
    font-size: 2.1rem;
    color: #cc1111;
    text-shadow: 0 0 12px #ff0000, 2px 2px 0 #000;
    letter-spacing: 2px;
    margin-bottom: 10px;
  }
  .subtitle {
    color: #999;
    font-size: 0.9rem;
    margin-bottom: 30px;
  }
  .btn {
    background: #1a0808;
    border: 2px solid #8a1111;
    color: #fff;
    padding: 14px 36px;
    font-size: 1.1rem;
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
    margin: 8px;
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(200, 0, 0, 0.3);
  }
  .btn:active { background: #8a1111; }

  #hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #0d0d10;
    border-bottom: 1px solid #331111;
    font-size: 0.85rem;
    z-index: 5;
  }
  .danger-text { color: #ff2a2a; font-weight: bold; }
  #game-container {
    position: relative;
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #000;
  }
  canvas {
    background: #111;
    max-width: 100%;
    max-height: 100%;
    border: 1px solid #2b0d0d;
  }
  #message-box {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 5, 5, 0.92);
    border: 1px solid #a11;
    padding: 10px 16px;
    border-radius: 4px;
    font-size: 0.85rem;
    max-width: 90%;
    text-align: center;
    display: none;
    z-index: 10;
    color: #f2dede;
  }
  #controls {
    height: 175px;
    background: #0b0b0e;
    border-top: 1px solid #2a1010;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    z-index: 5;
  }
  .dpad {
    display: grid;
    grid-template-columns: repeat(3, 50px);
    grid-template-rows: repeat(3, 50px);
    gap: 4px;
  }
  .ctrl-btn {
    background: #1c1c22;
    border: 1px solid #444;
    color: #fff;
    font-size: 1.2rem;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    touch-action: manipulation;
  }
  .ctrl-btn:active { background: #661111; border-color: #f33; }
  .actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .action-btn {
    padding: 12px 18px;
    background: #2b0b0b;
    border: 1px solid #a22;
    color: #fff;
    font-family: inherit;
    font-weight: bold;
    border-radius: 6px;
    font-size: 0.9rem;
  }
  .action-btn:active { background: #911; }
  .hidden { display: none !important; }
</style>
</head>
<body>

  <!-- TELA INICIAL -->
  <div id="menu-screen">
    <h1>GRANNY:<br>THE DEMON ASSASSIN</h1>
    <div class="subtitle">MODIFICAÇÃO OFICIAL • A MESMA CASA, NOVOS HORRORES</div>
    <button class="btn" onclick="startGame()">JOGAR (DIA 1)</button>
    <p style="margin-top:20px; font-size:0.75rem; color:#777; max-width:320px;">
      Explore a casa, leia o bilhete na mesa do quarto e encontre os itens modificados para destrancar a porta principal antes que a Demon Assassin pegue você.
    </p>
  </div>

  <!-- GAME OVER -->
  <div id="gameover-screen" class="hidden">
    <h1 id="go-title">VOCÊ FOI PEGO!</h1>
    <p id="go-desc" style="margin-bottom: 20px; color: #ccc;">A Demon Assassin usou o bastão com espinhos.</p>
    <button class="btn" onclick="nextDay()">CONTINUAR</button>
  </div>

  <!-- VITÓRIA -->
  <div id="win-screen" class="hidden">
    <h1 style="color:#2ecc71; text-shadow: 0 0 10px #27ae60;">VOCÊ ESCAPOU!</h1>
    <p style="margin-bottom: 20px; color: #ccc;">Você sobreviveu à casa modificada de Granny: The Demon Assassin.</p>
    <button class="btn" onclick="location.reload()">JOGAR NOVAMENTE</button>
  </div>

  <!-- HUD -->
  <div id="hud">
    <div>DIA <span id="day-num">1</span>/5</div>
    <div id="status-text">Status: Silencioso</div>
    <div>Item: <span id="inv-item" style="color:#ffae42;">Nenhum</span></div>
  </div>

  <!-- ÁREA DO JOGO -->
  <div id="game-container">
    <div id="message-box"></div>
    <canvas id="gameCanvas" width="400" height="400"></canvas>
  </div>

  <!-- CONTROLES TOUCH -->
  <div id="controls">
    <div class="dpad">
      <div></div>
      <button class="ctrl-btn" ontouchstart="movePlayer(0,-1)" onclick="movePlayer(0,-1)">▲</button>
      <div></div>
      <button class="ctrl-btn" ontouchstart="movePlayer(-1,0)" onclick="movePlayer(-1,0)">◀</button>
      <button class="ctrl-btn" ontouchstart="toggleCrouch()" onclick="toggleCrouch()" style="font-size:0.75rem;">AGACHAR</button>
      <button class="ctrl-btn" ontouchstart="movePlayer(1,0)" onclick="movePlayer(1,0)">▶</button>
      <div></div>
      <button class="ctrl-btn" ontouchstart="movePlayer(0,1)" onclick="movePlayer(0,1)">▼</button>
      <div></div>
    </div>
    <div class="actions">
      <button class="action-btn" onclick="interact()">INTERAGIR / PEGAR</button>
      <button class="action-btn" onclick="hideInWardrobe()" style="background:#161b29; border-color:#3b5998;">ESCONDER (ARMÁRIO)</button>
    </div>
  </div>

<script>
const canvas = document.getElementById('gameCanvas');
const ctx = canvas.getContext('2d');
const TILE = 20; // 20x20 grid = 400x400

// Mapa da Casa (0 = chão, 1 = parede, 2 = porta normal, 3 = saída principal trancada, 4 = armário)
// Layout inspirado na casa: Quarto do jogador (topo esq), Corredor central, Cozinha (dir), Porão/Sala (baixo)
const baseMap = [
  [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
  [1,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,4,1],
  [1,0,0,0,0,0,2,0,0,0,0,0,0,2,0,0,0,0,0,1],
  [1,0,0,0,0,0,1,0,0,1,1,0,0,1,0,0,0,0,0,1],
  [1,4,0,0,0,0,1,0,0,1,1,0,0,1,0,0,0,0,0,1],
  [1,1,1,2,1,1,1,0,0,0,0,0,0,1,1,2,1,1,1,1],
  [1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],
  [1,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,1],
  [1,0,0,1,1,2,1,0,1,4,0,1,0,1,2,1,1,0,0,1],
  [1,0,0,1,0,0,1,0,0,0,0,0,0,1,0,0,1,0,0,1],
  [1,0,0,1,0,0,1,0,0,0,0,0,0,1,0,0,1,0,0,1],
  [1,0,0,1,1,1,1,0,0,1,1,0,0,1,1,1,1,0,0,1],
  [1,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,1],
  [1,1,2,1,1,1,0,0,0,0,0,0,0,0,1,1,2,1,1,1],
  [1,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,1],
  [1,0,0,0,0,2,0,0,1,3,3,1,0,0,2,0,0,0,0,1],
  [1,0,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,1],
  [1,4,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,4,1],
  [1,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,1],
  [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
];

let map = [];
let day = 1;
let gameRunning = false;
let msgTimeout = null;

// Jogador começa no Quarto do Jogador (canto superior esquerdo)
let player = { x: 2, y: 2, crouching: false, hidden: false, item: null };

// Demon Assassin Granny
let granny = { x: 16, y: 16, chase: false, stunTimer: 0, moveTick: 0 };

// Objetos e alterações do mod na casa
let objects = [];
let exitLocks = { padlock: true, demonSeal: true, wireCut: true };

function resetObjects() {
  exitLocks = { padlock: true, demonSeal: true, wireCut: true };
  objects = [
    // Bilhete em cima da mesa no quarto do jogador
    {
      x: 4, y: 2, type: 'note', name: 'Bilhete na Mesa', color: '#f5e6ab',
      text: 'BILHETE NA MESA: "esse mod aqui é uma modificação terão coisas diferentes na casa"'
    },
    // Itens diferentes espalhados pela casa
    { x: 17, y: 2, type: 'item', id: 'chave_demoniaca', name: 'Chave Demoníaca', color: '#ff1e1e' },
    { x: 4, y: 10, type: 'item', id: 'alicate', name: 'Alicate Enferrujado', color: '#3498db' },
    { x: 15, y: 10, type: 'item', id: 'chave_mestra', name: 'Chave Mestra', color: '#f1c40f' },
    { x: 2, y: 18, type: 'item', id: 'crucifixo', name: 'Relíquia (Atordoa Granny)', color: '#9b59b6' },
    // Evento diferente na casa: altar sombrio no corredor
    {
      x: 10, y: 6, type: 'lore', name: 'Marca na Parede', color: '#800000',
      text: 'ALTERAÇÃO DO MOD: As paredes têm marcas demoníacas. A Granny está mais rápida e usa um bastão com espinhos!'
    }
  ];
}

function showMsg(txt, duration = 4000) {
  const box = document.getElementById('message-box');
  box.innerText = txt;
  box.style.display = 'block';
  clearTimeout(msgTimeout);
  msgTimeout = setTimeout(() => { box.style.display = 'none'; }, duration);
}

function startGame() {
  day = 1;
  document.getElementById('menu-screen').classList.add('hidden');
  setupDay();
}

function setupDay() {
  map = baseMap.map(row => [...row]);
  player = { x: 2, y: 2, crouching: false, hidden: false, item: null };
  granny = { x: 16, y: 16, chase: false, stunTimer: 0, moveTick: 0 };
  if (day === 1) resetObjects();
  document.getElementById('day-num').innerText = day;
  document.getElementById('inv-item').innerText = player.item ? player.item.name : 'Nenhum';
  document.getElementById('gameover-screen').classList.add('hidden');
  gameRunning = true;
  showMsg('Dia ' + day + ': Você acordou no quarto. Há um bilhete em cima da mesa perto de você.', 4500);
}

function nextDay() {
  day++;
  if (day > 5) {
    document.getElementById('go-title').innerText = 'FIM DE JOGO';
    document.getElementById('go-desc').innerText = 'Os 5 dias acabaram. A Demon Assassin venceu.';
    setTimeout(() => location.reload(), 2500);
    return;
  }
  setupDay();
}

function toggleCrouch() {
  if (!gameRunning || player.hidden) return;
  player.crouching = !player.crouching;
  document.getElementById('status-text').innerText = player.crouching ? 'Status: Agachado (Furtivo)' : 'Status: Em pé';
}

function hideInWardrobe() {
  if (!gameRunning) return;
  if (player.hidden) {
    player.hidden = false;
    showMsg('Você saiu do armário.');
    return;
  }
  // Verifica se está ao lado ou em cima de um armário (tile 4)
  const dirs = [[0,0],[1,0],[-1,0],[0,1],[0,-1]];
  for (let [dx, dy] of dirs) {
    let nx = player.x + dx, ny = player.y + dy;
    if (map[ny] && map[ny][nx] === 4) {
      player.hidden = true;
      granny.chase = false;
      showMsg('Você se escondeu no armário! Fique quieto.');
      return;
    }
  }
  showMsg('Nenhum armário azul por perto para se esconder.');
}

function movePlayer(dx, dy) {
  if (!gameRunning || player.hidden) return;
  const nx = player.x + dx;
  const ny = player.y + dy;
  if (!map[ny] || map[ny][nx] === undefined) return;

  const tile = map[ny][nx];
  if (tile === 1) return; // Parede
  if (tile === 3) {
    tryExit();
    return;
  }
  if (tile === 2) {
    // Abre porta e faz barulho se não estiver agachado
    map[ny][nx] = 0;
    if (!player.crouching) {
      alertGranny(nx, ny, 'A porta rangeu alto! A Demon Assassin ouviu!');
    } else {
      showMsg('Você abriu a porta devagar sem fazer barulho.');
    }
    return;
  }

  player.x = nx;
  player.y = ny;

  // Barulho de passos se correr em pé perto da Granny
  const dist = Math.hypot(player.x - granny.x, player.y - granny.y);
  if (!player.crouching && dist < 7) {
    granny.chase = true;
  }
}

function alertGranny(tx, ty, warning) {
  showMsg(warning, 3000);
  granny.chase = true;
}

function interact() {
  if (!gameRunning || player.hidden) return;

  // Verifica objetos no mesmo tile ou adjacentes
  for (let i = 0; i < objects.length; i++) {
    const obj = objects[i];
    if (Math.abs(obj.x - player.x) <= 1 && Math.abs(obj.y - player.y) <= 1) {
      if (obj.type === 'note' || obj.type === 'lore') {
        showMsg(obj.text, 6000);
        return;
      }
      if (obj.type === 'item') {
        // Troca item atual pelo do chão
        const oldItem = player.item;
        player.item = obj;
        objects.splice(i, 1);
        if (oldItem) {
          oldItem.x = player.x;
          oldItem.y = player.y;
          objects.push(oldItem);
          if (!player.crouching) alertGranny(player.x, player.y, 'Você derrubou um item no chão! A Granny ouviu!');
        }
        document.getElementById('inv-item').innerText = player.item.name;
        showMsg('Você pegou: ' + player.item.name);
        return;
      }
    }
  }

  // Usar relíquia se estiver com ela e Granny perto
  if (player.item && player.item.id === 'crucifixo') {
    const dist = Math.hypot(player.x - granny.x, player.y - granny.y);
    if (dist <= 4) {
      granny.stunTimer = 25; // Atordoa por alguns segundos
      granny.chase = false;
      player.item = null;
      document.getElementById('inv-item').innerText = 'Nenhum';
      showMsg('Você usou a Relíquia! A Demon Assassin ficou atordoada temporariamente!', 4000);
      return;
    }
  }

  // Checar saída principal
  if (Math.abs(player.y - 15) <= 1 && (player.x === 9 || player.x === 10)) {
    tryExit();
    return;
  }

  showMsg('Nada para interagir aqui.');
}

function tryExit() {
  if (!player.item) {
    showMsg('Porta Principal trancada! Precisa: Chave Mestra, Chave Demoníaca e Alicate.');
    return;
  }
  if (player.item.id === 'chave_mestra' && exitLocks.padlock) {
    exitLocks.padlock = false;
    player.item = null;
    document.getElementById('inv-item').innerText = 'Nenhum';
    showMsg('Cadeado principal aberto com a Chave Mestra!');
  } else if (player.item.id === 'chave_demoniaca' && exitLocks.demonSeal) {
    exitLocks.demonSeal = false;
    player.item = null;
    document.getElementById('inv-item').innerText = 'Nenhum';
    showMsg('Selo vermelho quebrado com a Chave Demoníaca!');
  } else if (player.item.id === 'alicate' && exitLocks.wireCut) {
    exitLocks.wireCut = false;
    player.item = null;
    document.getElementById('inv-item').innerText = 'Nenhum';
    showMsg('Fios da trava cortados com o Alicate!');
  } else {
    showMsg('Esse item não serve na porta ou essa trava já foi aberta.');
  }

  if (!exitLocks.padlock && !exitLocks.demonSeal && !exitLocks.wireCut) {
    gameRunning = false;
    document.getElementById('win-screen').classList.remove('hidden');
  }
}

// Loop de IA da Demon Assassin Granny
setInterval(() => {
  if (!gameRunning) return;

  if (granny.stunTimer > 0) {
    granny.stunTimer--;
    return;
  }

  const dist = Math.hypot(player.x - granny.x, player.y - granny.y);

  // Linha de visão simples
  if (!player.hidden && dist < 6) {
    granny.chase = true;
  } else if (dist > 11) {
    granny.chase = false;
  }

  const hudStatus = document.getElementById('status-text');
  if (granny.chase && !player.hidden) {
    hudStatus.innerHTML = '<span class="danger-text">PERSEGUINDO VOCÊ!</span>';
  } else {
    hudStatus.innerText = player.hidden ? 'Status: Escondido' : (player.crouching ? 'Status: Agachado' : 'Status: Em pé');
  }

  // Movimento da Granny
  let targetX, targetY;
  if (granny.chase && !player.hidden) {
    targetX = player.x;
    targetY = player.y;
  } else {
    // Patrulha aleatória pela casa
    const dirs = [[1,0],[-1,0],[0,1],[0,-1]];
    const pick = dirs[Math.floor(Math.random() * dirs.length)];
    targetX = granny.x + pick[0];
    targetY = granny.y + pick[1];
  }

  // Passo em direção ao alvo
  let stepX = 0, stepY = 0;
  if (targetX > granny.x) stepX = 1;
  else if (targetX < granny.x) stepX = -1;
  else if (targetY > granny.y) stepY = 1;
  else if (targetY < granny.y) stepY = -1;

  // Tenta mover no eixo X ou Y sem atravessar paredes
  if (stepX !== 0 && map[granny.y][granny.x + stepX] !== 1 && map[granny.y][granny.x + stepX] !== 3) {
    if (map[granny.y][granny.x + stepX] === 2) map[granny.y][granny.x + stepX] = 0; // Granny abre portas
    granny.x += stepX;
  } else if (stepY !== 0 && map[granny.y + stepY][granny.x] !== 1 && map[granny.y + stepY][granny.x] !== 3) {
    if (map[granny.y + stepY][granny.x] === 2) map[granny.y + stepY][granny.x] = 0;
    granny.y += stepY;
  }

  // Checa captura
  if (!player.hidden && granny.x === player.x && granny.y === player.y) {
    gameRunning = false;
    document.getElementById('go-title').innerText = 'DIA ' + day + ' ACABOU!';
    document.getElementById('go-desc').innerText = 'A Demon Assassin acertou você com o bastão de espinhos.';
    document.getElementById('gameover-screen').classList.remove('hidden');
  }
}, 420);

// Renderização com campo de visão escuro (lanterna)
function draw() {
  ctx.fillStyle = '#050507';
  ctx.fillRect(0, 0, canvas.width, canvas.height);

  for (let y = 0; y < 20; y++) {
    for (let x = 0; x < 20; x++) {
      const dist = Math.hypot(x - player.x, y - player.y);
      if (dist > 6.5) continue; // Escuridão da casa

      const tile = map[y][x];
      if (tile === 1) ctx.fillStyle = '#2b2320'; // Parede velha
      else if (tile === 2) ctx.fillStyle = '#6e472b'; // Porta de madeira
      else if (tile === 3) ctx.fillStyle = '#991111'; // Saída principal
      else if (tile === 4) ctx.fillStyle = '#1f3a52'; // Armário para esconder
      else ctx.fillStyle = '#141212'; // Chão

      ctx.fillRect(x * TILE, y * TILE, TILE - 1, TILE - 1);
    }
  }

  // Desenha mesa no quarto do jogador (x:4, y:2)
  if (Math.hypot(4 - player.x, 2 - player.y) <= 6.5) {
    ctx.fillStyle = '#4a2e1b';
    ctx.fillRect(4 * TILE + 2, 2 * TILE + 2, TILE - 4, TILE - 4);
  }

  // Desenha objetos (bilhete, chaves, alicate, relíquia)
  for (let obj of objects) {
    const dist = Math.hypot(obj.x - player.x, obj.y - player.y);
    if (dist <= 6.5) {
      ctx.fillStyle = obj.color;
      ctx.beginPath();
      ctx.arc(obj.x * TILE + TILE / 2, obj.y * TILE + TILE / 2, 5, 0, Math.PI * 2);
      ctx.fill();
    }
  }

  // Desenha Jogador
  if (!player.hidden) {
    ctx.fillStyle = player.crouching ? '#5dade2' : '#2ecc71';
    ctx.beginPath();
    ctx.arc(player.x * TILE + TILE / 2, player.y * TILE + TILE / 2, player.crouching ? 5 : 7, 0, Math.PI * 2);
    ctx.fill();
  }

  // Desenha Demon Assassin Granny (se estiver perto)
  const gDist = Math.hypot(granny.x - player.x, granny.y - player.y);
  if (gDist <= 7) {
    ctx.fillStyle = granny.stunTimer > 0 ? '#7f8c8d' : '#ff0000';
    ctx.beginPath();
    ctx.arc(granny.x * TILE + TILE / 2, granny.y * TILE + TILE / 2, 8, 0, Math.PI * 2);
    ctx.fill();
    // Olhos brilhantes
    ctx.fillStyle = '#fff';
    ctx.fillRect(granny.x * TILE + 6, granny.y * TILE + 7, 2, 2);
    ctx.fillRect(granny.x * TILE + 12, granny.y * TILE + 7, 2, 2);
  }

  requestAnimationFrame(draw);
}

// Suporte a teclado caso teste no PC também
window.addEventListener('keydown', (e) => {
  if (e.key === 'ArrowUp' || e.key === 'w') movePlayer(0, -1);
  if (e.key === 'ArrowDown' || e.key === 's') movePlayer(0, 1);
  if (e.key === 'ArrowLeft' || e.key === 'a') movePlayer(-1, 0);
  if (e.key === 'ArrowRight' || e.key === 'd') movePlayer(1, 0);
  if (e.key === 'e' || e.key === ' ') interact();
  if (e.key === 'c') toggleCrouch();
});

draw();
</script>
</body>
</html>

19,215 chars · codepastes.com