Advertisement
MasterCheats

Tank de Batlha 3

Feb 7th, 2025
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 27.88 KB | Gaming | 0 0
  1. -- CONFIGURAÇÕES INICIAIS
  2. largura = 17
  3. altura = 17
  4. nivel = 1
  5. pontuacao = 0
  6. vidas = 100
  7. gameOver = false
  8.  
  9. -- VARIÁVEIS DE PERSONALIZAÇÃO (padrão)
  10. playerTankIcon = "🟩"   -- Cor do tanque do jogador (pode ser alterada)
  11. baseWallIcon = "🧱"     -- Ícone das paredes da base (fixo)
  12. baseCenterIcon = "🌟"   -- Ícone central da base (pode ser alterado)
  13. dificuldade = 3         -- Dificuldade ( 3 tanques inimigos base)
  14.  
  15. -- Posição da bandeira para avanço de nível (no centro da parte superior)
  16. flagPos = { x = math.ceil(largura/2), y = 2 }
  17.  
  18. -- TABELAS GLOBAIS: obstáculos (paredes fixas) e base
  19. obstacles = {}    -- paredes fixas
  20.  
  21. -- Gera o mapa fixo conforme o modelo (exemplo: linhas 6, 7, 11 e 12)
  22. function gerarMapaFixo()
  23.     obstacles = {}
  24.     for x = 1, largura do
  25.         table.insert(obstacles, {x = x, y = 6})
  26.     end
  27.     for x = 1, largura do
  28.         table.insert(obstacles, {x = x, y = 7})
  29.     end
  30.     for x = 1, largura do
  31.         table.insert(obstacles, {x = x, y = 8})
  32.     end
  33.     for x = 1, largura do
  34.         table.insert(obstacles, {x = x, y = 9})
  35.     end
  36.     for x = 1, largura do
  37.         table.insert(obstacles, {x = x, y = 10})
  38.     end
  39.     for x = 1, largura do
  40.         table.insert(obstacles, {x = x, y = 11})
  41.     end
  42.     for x = 1, largura do
  43.         table.insert(obstacles, {x = x, y = 12})
  44.     end
  45. end
  46. gerarMapaFixo()
  47.  
  48. -- DEFINIÇÃO DA BASE PROTETORA
  49. -- A base é uma matriz 3x3; as células laterais (paredes) usam baseWallIcon
  50. -- e a célula central (item) usa baseCenterIcon.
  51. baseCenter = { x = math.floor(largura/2) + 1, y = math.floor(altura/2) + 1 }
  52. baseCells = {
  53.     {x = baseCenter.x - 1, y = baseCenter.y - 1},
  54.     {x = baseCenter.x,     y = baseCenter.y - 1},
  55.     {x = baseCenter.x + 1, y = baseCenter.y - 1},
  56.     {x = baseCenter.x - 1, y = baseCenter.y    },
  57.     {x = baseCenter.x,     y = baseCenter.y    },
  58.     {x = baseCenter.x + 1, y = baseCenter.y    },
  59.     {x = baseCenter.x - 1, y = baseCenter.y + 1},
  60.     {x = baseCenter.x,     y = baseCenter.y + 1},
  61.     {x = baseCenter.x + 1, y = baseCenter.y + 1}
  62. }
  63.  
  64. -- FUNÇÕES AUXILIARES DE VALIDAÇÃO
  65. function posLivre(x, y)
  66.     if x < 1 or x > largura or y < 1 or y > altura then return false end
  67.     for _, obs in ipairs(obstacles) do
  68.          if obs.x == x and obs.y == y then return false end
  69.     end
  70.     for _, cell in ipairs(baseCells) do
  71.          if cell.x == x and cell.y == y then return false end
  72.     end
  73.     return true
  74. end
  75.  
  76. function baseContains(x, y)
  77.     for _, cell in ipairs(baseCells) do
  78.          if cell.x == x and cell.y == y then return true end
  79.     end
  80.     return false
  81. end
  82.  
  83. function tankPosLivre(x, y, currentTank)
  84.     if currentTank ~= tanque then
  85.         for _, parte in ipairs(tanque.partes) do
  86.             if parte.x == x and parte.y == y then return false end
  87.         end
  88.     end
  89.     for _, inimigo in ipairs(tanqueinimigos) do
  90.         if inimigo ~= currentTank then
  91.             for _, parte in ipairs(inimigo.partes) do
  92.                 if parte.x == x and parte.y == y then return false end
  93.             end
  94.         end
  95.     end
  96.     return true
  97. end
  98.  
  99. -- DEFINIÇÃO DAS FORMAS DO TANQUE (6 quadrados)
  100. -- O quadrado de índice 2 é o canhão.
  101. formas = {
  102.   Cima = {
  103.     {dx = -1, dy =  0},
  104.     {dx =  0, dy = -1},
  105.     {dx =  1, dy =  0},
  106.     {dx = -1, dy =  1},
  107.     {dx =  0, dy =  0},
  108.     {dx =  1, dy =  1}
  109.   },
  110.   Baixo = {
  111.     {dx =  1, dy =  0},
  112.     {dx =  0, dy =  1},
  113.     {dx = -1, dy =  0},
  114.     {dx =  1, dy = -1},
  115.     {dx =  0, dy =  0},
  116.     {dx = -1, dy = -1}
  117.   },
  118.   Direita = {
  119.     {dx =  0, dy = -1},
  120.     {dx =  1, dy =  0},
  121.     {dx =  0, dy =  1},
  122.     {dx = -1, dy = -1},
  123.     {dx =  0, dy =  0},
  124.     {dx = -1, dy =  1}
  125.   },
  126.   Esquerda = {
  127.     {dx =  0, dy =  1},
  128.     {dx = -1, dy =  0},
  129.     {dx =  0, dy = -1},
  130.     {dx =  1, dy =  1},
  131.     {dx =  0, dy =  0},
  132.     {dx =  1, dy = -1}
  133.   }
  134. }
  135.  
  136. -- TANQUE DO JOGADOR
  137. -- Posicionado inicialmente nas linhas inferiores.
  138. tanque = {
  139.     pos = {x = math.floor(largura/2)+1, y = altura - 1},
  140.     direcao = "Cima",
  141.     partes = {}
  142. }
  143.  
  144. function atualizarTanque(obj)
  145.   local t = obj or tanque
  146.   t.partes = {}
  147.   local offsets = formas[t.direcao]
  148.   for i, off in ipairs(offsets) do
  149.       table.insert(t.partes, {x = t.pos.x + off.dx, y = t.pos.y + off.dy})
  150.   end
  151. end
  152. atualizarTanque()
  153.  
  154. tanqueinimigos = {}
  155.  
  156. function spawnInimigos(qtd, nivel)
  157.     tanqueinimigos = {}
  158.     local attempts = 0
  159.     while #tanqueinimigos < qtd and attempts < 1000 do
  160.         attempts = attempts + 1
  161.         local ex = math.random(2, largura-1)
  162.         local ey = math.random(1, 1)  -- área superior
  163.         if posLivre(ex, ey) and tankPosLivre(ex, ey, nil) then
  164.             local novo = criarTanqueInimigo(ex, ey, nivel)  -- Usa o nível atual para definir a vida
  165.             local valid = true
  166.             for _, parte in ipairs(novo.partes) do
  167.                 if not posLivre(parte.x, parte.y) then
  168.                     valid = false
  169.                     break
  170.                 end
  171.             end
  172.             if valid then
  173.                 table.insert(tanqueinimigos, novo)
  174.             end
  175.         end
  176.     end
  177. end
  178.  
  179. -- TANQUES INIMIGOS
  180. function criarTanqueInimigo(x, y, nivel)
  181.     nivel = nivel or 1  
  182.     return {
  183.         pos = {x = x, y = y},  -- Adiciona a posição corretamente
  184.         vida = nivel + 1,      -- Aumenta a vida conforme o nível
  185.         partes = {
  186.             {x = x, y = y},
  187.             {x = x+1, y = y},
  188.             {x = x, y = y+1},
  189.             {x = x+1, y = y+1}
  190.         }
  191.     }
  192. end
  193.  
  194. function aplicarDanoInimigo(tanqueIndex)
  195.     if tanqueinimigos[tanqueIndex] then
  196.         tanqueinimigos[tanqueIndex].vida = tanqueinimigos[tanqueIndex].vida - 1
  197.         if tanqueinimigos[tanqueIndex].vida <= 0 then
  198.             table.remove(tanqueinimigos, tanqueIndex) -- Remove o inimigo se a vida chegar a 0
  199.         end
  200.     end
  201. end
  202.  
  203. ----------------------------------------------------------------
  204. -- DESENHO DO TABULEIRO
  205. -- Exibe o cabeçalho (vidas, pontuação e nível) acima do tabuleiro.
  206. -- Na área da base, as células laterais usam baseWallIcon e o centro usa baseCenterIcon.
  207. -- Se não houver inimigos, exibe a bandeira (🏁) na posição flagPos.
  208. function desenharTabuleiro()
  209.     local header = "🛡️Escudo: " .. tostring(vidas) .. "  | ✨Pontuação: " .. tostring(pontuacao) .. " |  📶Level: " .. tostring(nivel) .. "\n\n"
  210.     local board = ""
  211.     for y = 1, altura do
  212.         for x = 1, largura do
  213.             local celula = "⬛"  -- fundo padrão
  214.             if #tanqueinimigos == 0 and x == flagPos.x and y == flagPos.y then
  215.                 celula = "🏁"
  216.             else
  217.                 local isBase = false
  218.                 for _, cell in ipairs(baseCells) do
  219.                     if cell.x == x and cell.y == y then
  220.                         if cell.x == baseCenter.x and cell.y == baseCenter.y then
  221.                             celula = baseCenterIcon
  222.                         else
  223.                             celula = baseWallIcon
  224.                         end
  225.                         isBase = true
  226.                         break
  227.                     end
  228.                 end
  229.                 if not isBase then
  230.                     for _, obs in ipairs(obstacles) do
  231.                         if obs.x == x and obs.y == y then
  232.                             celula = "🧱"
  233.                             break
  234.                         end
  235.                     end
  236.                 end
  237.                 for _, inimigo in ipairs(tanqueinimigos) do
  238.                     for _, parte in ipairs(inimigo.partes) do
  239.                         if parte.x == x and parte.y == y then
  240.                             celula = "🟥"
  241.                             break
  242.                         end
  243.                     end
  244.                 end
  245.                 for _, parte in ipairs(tanque.partes) do
  246.                     if parte.x == x and parte.y == y then
  247.                         celula = playerTankIcon
  248.                         break
  249.                     end
  250.                 end
  251.             end
  252.             board = board .. celula
  253.         end
  254.         board = board .. "\n"
  255.     end
  256.     return header .. board
  257. end
  258.  
  259. -- FUNÇÃO scanShot: varredura do tiro
  260. function scanShot(sx, sy, dx, dy, shooterType)
  261.     local x = sx
  262.     local y = sy
  263.     while x >= 1 and x <= largura and y >= 1 and y <= altura do
  264.          for i, obs in ipairs(obstacles) do
  265.              if obs.x == x and obs.y == y then
  266.                  return "obstacle", i
  267.              end
  268.          end
  269.          local isBaseCell = false
  270.          local baseIndex = nil
  271.          for j, cell in ipairs(baseCells) do
  272.              if cell.x == x and cell.y == y then
  273.                  isBaseCell = true
  274.                  baseIndex = j
  275.                  break
  276.              end
  277.          end
  278.          if isBaseCell then
  279.              local protecaoRestante = false
  280.              for j, cell in ipairs(baseCells) do
  281.                  if not (cell.x == baseCenter.x and cell.y == baseCenter.y) then
  282.                      protecaoRestante = true
  283.                      break
  284.                  end
  285.              end
  286.              if protecaoRestante then
  287.                  return "base_protect", nil
  288.              else
  289.                  return "base", baseIndex
  290.              end
  291.          end
  292.          if shooterType == "player" then
  293.              for i, inimigo in ipairs(tanqueinimigos) do
  294.                  for j, parte in ipairs(inimigo.partes) do
  295.                      if parte.x == x and parte.y == y then
  296.                          return "enemy", i
  297.                      end
  298.                  end
  299.              end
  300.          elseif shooterType == "enemy" then
  301.              for j, parte in ipairs(tanque.partes) do
  302.                  if parte.x == x and parte.y == y then
  303.                      return "player", nil
  304.                  end
  305.              end
  306.          end
  307.          x = x + dx
  308.          y = y + dy
  309.     end
  310.     return "none", nil
  311. end
  312.  
  313. -- DISPARO DO JOGADOR
  314. function dispararJogador()
  315.     local canhao = tanque.partes[2]
  316.     local dx, dy = 0, 0
  317.     if tanque.direcao == "Cima" then dx, dy = 0, -1
  318.     elseif tanque.direcao == "Baixo" then dx, dy = 0, 1
  319.     elseif tanque.direcao == "Direita" then dx, dy = 1, 0
  320.     elseif tanque.direcao == "Esquerda" then dx, dy = -1, 0
  321.     end
  322.     local target, index = scanShot(canhao.x, canhao.y, dx, dy, "player")
  323.     if target == "obstacle" then
  324.          table.remove(obstacles, index)
  325.          pontuacao = pontuacao + 50
  326.     elseif target == "enemy" then
  327.      pontuacao = pontuacao + 500
  328.      aplicarDanoInimigo(index)
  329.     elseif target == "base_protect" then
  330.          if index then
  331.              table.remove(baseCells, index)
  332.          else
  333.              for j, cell in ipairs(baseCells) do
  334.                  if not (cell.x == baseCenter.x and cell.y == baseCenter.y) then
  335.                      table.remove(baseCells, j)
  336.                      break
  337.                  end
  338.              end
  339.          end
  340.          pontuacao = pontuacao + 50
  341.     elseif target == "base" then
  342.         while true do
  343.             local opcao = gg.alert("Você destruiu a base! Game Over.\nPontuação: " .. tostring(pontuacao),"OK")
  344.          if opcao == 1 then
  345.                 resetarJogo()
  346.                 menuPrincipal()
  347.                 iniciarJogo()
  348.             end
  349.         end
  350.     end
  351. end
  352.  
  353. -- DISPARO DOS INIMIGOS
  354. function dispararInimigos()
  355.     for _, inimigo in ipairs(tanqueinimigos) do
  356.         local canhaoI = inimigo.partes[2]
  357.         local dx, dy = 0, 0
  358.         if inimigo.direcao == "Cima" then dx, dy = 0, -1
  359.         elseif inimigo.direcao == "Baixo" then dx, dy = 0, 1
  360.         elseif inimigo.direcao == "Direita" then dx, dy = 1, 0
  361.         elseif inimigo.direcao == "Esquerda" then dx, dy = -1, 0
  362.         end
  363.         local target, index = scanShot(canhaoI.x, canhaoI.y, dx, dy, "enemy")
  364.         if target == "obstacle" then
  365.             table.remove(obstacles, index)
  366.         elseif target == "base_protect" then
  367.             if index then
  368.                 table.remove(baseCells, index)
  369.             else
  370.                 for j, cell in ipairs(baseCells) do
  371.                     if not (cell.x == baseCenter.x and cell.y == baseCenter.y) then
  372.                         table.remove(baseCells, j)
  373.                         break
  374.                     end
  375.                 end
  376.             end
  377.         elseif target == "base" then
  378.             while true do
  379.     local opcao = gg.alert("A base protetora foi destruída! Game Over.\nPontuação: " .. tostring(pontuacao), "OK")
  380.     if opcao == 1 then
  381.      resetarJogo()
  382.      menuPrincipal()
  383.      iniciarJogo()
  384.     end
  385. end
  386.         elseif target == "player" then
  387.             vidas = vidas - 1
  388.             if vidas <= 0 then
  389.                 while true do
  390.     local opcao = gg.alert("Você perdeu todas as vidas! Game Over.\nPontuação: " .. tostring(pontuacao), "OK")
  391.     if opcao == 1 then
  392.         resetarJogo()
  393.         menuPrincipal()
  394.         iniciarJogo()
  395.           end
  396.         end
  397.       end
  398.     end
  399.   end
  400. end
  401.  
  402. -- MOVIMENTAÇÃO DO JOGADOR
  403. function moverJogador(dx, dy)
  404.     local newPos = { x = tanque.pos.x + dx, y = tanque.pos.y + dy }
  405.     local offsets = formas[tanque.direcao]
  406.     local newParts = {}
  407.     for _, off in ipairs(offsets) do
  408.       local nx = newPos.x + off.dx
  409.       local ny = newPos.y + off.dy
  410.       if nx < 1 or nx > largura or ny < 1 or ny > altura or (not posLivre(nx, ny)) or (not tankPosLivre(nx, ny, tanque)) then
  411.          return
  412.       end
  413.       table.insert(newParts, {x = nx, y = ny})
  414.     end
  415.     tanque.pos = newPos
  416.     atualizarTanque()
  417. end
  418.  
  419. -- MOVIMENTAÇÃO DOS INIMIGOS
  420. function moverInimigos()
  421.     local opcoes = {"Cima", "Baixo", "Direita", "Esquerda"}
  422.     for _, inimigo in ipairs(tanqueinimigos) do
  423.        local dir = opcoes[math.random(1, #opcoes)]
  424.        inimigo.direcao = dir
  425.        local dx, dy = 0, 0
  426.        if dir == "Cima" then dy = -1
  427.        elseif dir == "Baixo" then dy = 1
  428.        elseif dir == "Direita" then dx = 1
  429.        elseif dir == "Esquerda" then dx = -1
  430.        end
  431.        local newPos = { x = inimigo.pos.x + dx, y = inimigo.pos.y + dy }
  432.        local canMove = true
  433.        local newParts = {}
  434.        for _, off in ipairs(formas[inimigo.direcao]) do
  435.             local nx = newPos.x + off.dx
  436.             local ny = newPos.y + off.dy
  437.             if nx < 1 or nx > largura or ny < 1 or ny > altura or (not posLivre(nx, ny)) or (not tankPosLivre(nx, ny, inimigo)) then
  438.                 canMove = false
  439.                 break
  440.             end
  441.             table.insert(newParts, {x = nx, y = ny})
  442.        end
  443.        if canMove then
  444.            inimigo.pos = newPos
  445.            atualizarTanque(inimigo)
  446.        end
  447.     end
  448. end
  449.  
  450. -- CHECA COLISÃO: Se alguma parte do jogador colide com um inimigo
  451. function checarColisoes()
  452.     for _, parteJ in ipairs(tanque.partes) do
  453.         for _, inimigo in ipairs(tanqueinimigos) do
  454.             for _, parteI in ipairs(inimigo.partes) do
  455.                 if parteJ.x == parteI.x and parteJ.y == parteI.y then
  456.                     return true
  457.                 end
  458.             end
  459.         end
  460.     end
  461.     return false
  462. end
  463.  
  464. -- MENU DE AÇÕES DURANTE O JOGO
  465. function menuAcoes()
  466.     local opcoes = {
  467.         string.rep(" ", 30).."⬆️ Cima",
  468.         string.rep(" ", 10).."⬅️ Esquerda",
  469.         string.rep(" ", 50).."➡️ Direita",
  470.         string.rep(" ", 30).."⬇️ Baixo",
  471.         string.rep(" ", 60).."💥 Dispare",
  472.         "️↩️Menu Principa️l🛠️",
  473.         "❌ Desistir!😪"
  474.     }
  475.     local texto = desenharTabuleiro() .. "\n🔰Proteja sua Base ".. baseCenterIcon .." Elimine Tanks inimigos 🚨"
  476.     local escolha = gg.choice(opcoes, nil, texto)
  477.     if escolha == nil then
  478.         gg.setVisible(false)
  479.         return nil
  480.     end
  481.     return escolha
  482. end
  483.  
  484. -- MENU PRINCIPAL E PERSONALIZAÇÃO
  485. function selecionarCorTanque()
  486.     local cores = {"🟨", "🟩", "🟪", "🟧", "🟦", "🟫", "⬜", "🔳"}
  487.     local escolha = gg.choice(cores, nil, "Selecione a cor do Tanque:")
  488.     if escolha then
  489.         playerTankIcon = cores[escolha]
  490.     end
  491. end
  492.  
  493. function selecionarTipoBase()
  494.     local bases = {"🪙", "🔮", "🎁", "🏮", "💠", "🆘", "🔆"}
  495.     local escolha = gg.choice(bases, nil, "Selecione o ícone central da Base:")
  496.     if escolha then
  497.         baseCenterIcon = bases[escolha]
  498.     end
  499. end
  500.  
  501. function selecionarDificuldade()
  502.     local niveis = {
  503.     "1 - Recruta 🚜",
  504.     "2 - Soldado 🪖",
  505.     "3 - Cabo 🔰",
  506.     "4 - Sargento 🎖️",
  507.     "5 - Comandante 🏅",
  508.     "6 - Estratégico 🧭",
  509.     "7 - Tático ⚔️",
  510.     "8 - Elite 🔥",
  511.     "9 - Imbatível 💀",
  512.     "10 - General Supremo ⭐",
  513.     "11 - Mestre da Guerra 🛡️",
  514.     "12 - Legado de Aço 🏰",
  515.     "13 - Resistência Brutal ⚒️",
  516.     "14 - Inferno de Aço 🔥⚙️",
  517.     "15 - Inimigos Sombrios ☠️",
  518.     "16 - Tempestade de Fogo 🌩️",
  519.     "17 - Campo Minado 💣",
  520.     "18 - Cerco Final 🏰⚔️",
  521.     "19 - O Último Desafio 🚀",
  522.     "20 - Lenda dos Tanques 👑"
  523. }
  524.  
  525. local escolha = gg.choice(niveis, nil, "🔱 Selecione a dificuldade (tanques inimigos base):")
  526.  
  527.     if escolha then
  528.         -- Extrai o número da dificuldade a partir do texto selecionado
  529.         dificuldade = tonumber(niveis[escolha]:match("^(%d+)"))
  530.     end
  531.     -- Aqui você pode definir o número fixo de inimigos
  532.    
  533. vida = dificuldade
  534. nivel = dificuldade
  535. dificuldade = 3
  536. end
  537.  
  538. function sobreOJogo()
  539.     local texto = "🚀 Jogo de Tanques - Versão Game Guardian 🚀\n\n" ..
  540. "🎯 Missão: Você é o comandante de um poderoso tanque de batalha! Sua missão é proteger sua base 🏰 a todo custo e eliminar todos os tanques inimigos 🚨 que tentam invadi-la. Apenas ao derrotá-los e capturar a bandeira 🏁 no topo do mapa, você poderá avançar para o próximo nível!\n\n" ..
  541. "🕹️ Controles: Utilize as opções do menu para movimentar seu tanque, disparar e evitar colisões. Planeje cada ação com cuidado, pois os inimigos não terão piedade!\n\n" ..
  542. "🛡️ Proteção: Fique atento ao seu escudo ⚡! Se ele acabar, seu tanque ficará vulnerável e poderá ser destruído. Use táticas defensivas para proteger sua base e a si mesmo!\n\n" ..
  543. "🎨 Personalização: Torne seu tanque único! Escolha a cor, o motorista e o ícone da base para criar uma experiência de jogo personalizada.\n\n" ..
  544. "🔥 Desafio: São 20 níveis de batalhas cada vez mais difíceis! A cada fase, os inimigos ficam mais agressivos e resistentes, exigindo mais estratégia e precisão para derrotá-los.\n\n" ..
  545. "💡 Dicas: Use os obstáculos como escudo, ataque no momento certo e fique sempre de olho no seu escudo e na sua base! Proteger sua base é essencial para garantir a vitória!\n\n" ..
  546. "🏆 Mostre que você é um verdadeiro comandante de elite! Supere todos os desafios, proteja sua base e conquiste a glória no campo de batalha!"
  547.     gg.alert(texto)
  548. end
  549.  
  550. function contato()
  551.     gg.alert([[
  552. 🔔 **Script made for the Channel**
  553.     📽 **Master Cheats⚜** - Created by: **Edrwuan👑**
  554.    
  555.     ➡️ **Subscribe to the Channel** for more Cheats and Game News 🎮
  556.    
  557.     🔗 **Telegram Contact**: [Click here to join](https://t.me/joinchat/IarWN9hjkgcunWEN)
  558.     📧 **Email**: edrwuan@live.com
  559.    
  560.     📱 **Official Telegram**: @MastercheatsAnonymous
  561.    
  562. 🔔 **Script produzido para o Canal**
  563.     📽 **Master Cheats⚜** - Criado por: **Edrwuan👑**
  564.    
  565.     ➡️ **Inscreva-se no Canal** para mais Cheats e Novidades sobre Jogos 🎮
  566.    
  567.     🔗 **Contato Telegram**: [Clique aqui para entrar](https://t.me/joinchat/IarWN9hjkgcunWEN)
  568.     📧 **E-mail**: edrwuan@live.com
  569.    
  570.     📱 **Telegram Oficial**: @MastercheatsAnonymous
  571.     ]])
  572.     return
  573. end
  574.  
  575. function menuPrincipal()
  576.     while true do
  577.         local opcoes = {
  578.             "🕹️ Iniciar Jogo",
  579.             "🎨 Selecionar Cor do Tanque",
  580.             "🏰 Selecionar Ícone Central da Base",
  581.             "💥 Alterar Dificuldade",
  582.             "📖 Sobre o Jogo e Dicas",
  583.         "🌐 Contate-Me",
  584.         "❌ Desistir!😪"
  585.         }
  586.         local escolha = gg.choice(opcoes, nil, "🕹️Mini Tanque de Batalha Clássico: Desafio Blindado\n"..string.rep(" ", 30).."Made for Edrwuan \n"..string.rep(" ", 10).."🎞️YouTube 👑Master Cheats Channel🎥\n\n"..string.rep(" ", 25).."🗂️ Menu Principal ️️🛠️\n\n" ..
  587.             "🎨 ️Cor Tanque Selecionado: " .. playerTankIcon .. "\n" ..
  588.             "🏰 Base Icone Selecionada: " .. baseCenterIcon .. "\n" ..
  589.             "🚨 Dificuldade Selecionada: " .. nivel .. "\n")
  590.         if escolha == 1 then
  591.             break  -- Inicia o jogo
  592.         elseif escolha == 2 then
  593.             selecionarCorTanque()
  594.         elseif escolha == 3 then
  595.             selecionarTipoBase()
  596.         elseif escolha == 4 then
  597.             selecionarDificuldade()
  598.         elseif escolha == 5 then
  599.             sobreOJogo()
  600.         elseif escolha == 6 then
  601.             contato()
  602.         elseif escolha == 7 then
  603.             gg.alert("⚠️ Missão Abortada! ⚠️\n\n" ..
  604. "Você optou por abandonar a batalha... 🏳️\n\n" ..
  605. "Seu progresso será perdido e sua jornada como comandante de tanques chega ao fim por agora.\n\n" ..
  606. "🔥 Pontuação Final: " .. tostring(pontuacao) .. " 🔥\n\n" ..
  607. "Obrigado por jogar! Volte sempre para mais desafios! 🚀")
  608.             os.exit()
  609.         end
  610.     end
  611. end
  612.  
  613. -- LOOP PRINCIPAL DO JOGO
  614. function iniciarJogo()
  615.     nivel = nivel or 1  -- Garante que o nível tenha um valor válido
  616.    
  617.     -- Se não houver inimigos (no início do jogo), gera os inimigos do nível 1.
  618.     if #tanqueinimigos == 0 then
  619.         spawnInimigos(dificuldade, nivel)
  620.     end
  621.     while not gameOver do
  622.         -- Se não houver inimigos, verifica se o jogador tocou a bandeira para avançar de nível.
  623.         if #tanqueinimigos == 0 then
  624.             for _, parte in ipairs(tanque.partes) do
  625.                 if parte.x == flagPos.x and parte.y == flagPos.y then
  626.                    
  627.                     while true do
  628.                         local opcao = gg.alert("🏁 Bandeira Conquistada! 🏁\n\n" ..
  629. "Parabéns, comandante! 🎖️ Você dominou o campo de batalha e avançou para o próximo nível! 🚀\n\n" ..
  630. "⚠️ Prepare-se! A guerra fica mais intensa! Os inimigos estão mais resistentes e ágeis. Use estratégia e proteja sua base " .. baseCenterIcon .. " a todo custo! 🏰\n\n" ..
  631. "Boa sorte na próxima missão! 💥", "OK")
  632.                         if opcao == 1 then break end
  633.                     end
  634.                     nivel = nivel + 1
  635.                    
  636.                     if nivel > 20 then
  637.                         while true do
  638.                             local opcao = gg.alert("🎉✨ UAU, VOCÊ COMPLETOU TODOS OS 20 NÍVEIS! ✨🎉\n\nSua pontuação final foi: " .. tostring(pontuacao) .. "\n\nVocê é um verdadeiro mestre dos tanques!\nContinue arrasando no campo de batalha e conquistando vitórias épicas! 🚀🔥", "OK")
  639.                            
  640.                             if opcao == 1 then
  641.                                 resetarJogo()
  642.                                 menuPrincipal()
  643.                                 iniciarJogo()
  644.                             end
  645.                         end
  646.                     end
  647.                    
  648.                     -- Limpa os inimigos antes de gerar novos
  649.                     tanqueinimigos = {}
  650.                     spawnInimigos(dificuldade, nivel)
  651.                    
  652.                     gerarMapaFixo()
  653.                
  654.                     -- Restaura a base completa
  655.                     baseCells = {
  656.                         {x = baseCenter.x - 1, y = baseCenter.y - 1},
  657.                         {x = baseCenter.x,     y = baseCenter.y - 1},
  658.                         {x = baseCenter.x + 1, y = baseCenter.y - 1},
  659.                         {x = baseCenter.x - 1, y = baseCenter.y},
  660.                         {x = baseCenter.x,     y = baseCenter.y},
  661.                         {x = baseCenter.x + 1, y = baseCenter.y},
  662.                         {x = baseCenter.x - 1, y = baseCenter.y + 1},
  663.                         {x = baseCenter.x,     y = baseCenter.y + 1},
  664.                         {x = baseCenter.x + 1, y = baseCenter.y + 1}
  665.                     }
  666.                     tanque.pos = { x = math.floor(largura/2), y = altura - 1 }
  667.                     atualizarTanque()
  668.                     break
  669.                 end
  670.             end
  671.         end
  672.        
  673.         local acao = menuAcoes()
  674.         if acao == nil then break end
  675.         if acao == 1 then
  676.             tanque.direcao = "Cima"
  677.             moverJogador(0, -1)
  678.         elseif acao == 2 then
  679.             tanque.direcao = "Esquerda"
  680.             moverJogador(-1, 0)
  681.         elseif acao == 3 then
  682.             tanque.direcao = "Direita"
  683.             moverJogador(1, 0)
  684.         elseif acao == 4 then
  685.             tanque.direcao = "Baixo"
  686.             moverJogador(0, 1)
  687.         elseif acao == 5 then
  688.             dispararJogador()
  689.         elseif acao == 6 then
  690.             voltar()
  691.         elseif acao == 7 then
  692.             while true do
  693.                 local opcao = gg.alert("⚠️ Missão Abortada! ⚠️\n\n" ..
  694. "Você optou por abandonar a batalha... 🏳️\n\n" ..
  695. "Seu progresso será perdido e sua jornada como comandante de tanques chega ao fim por agora.\n\n" ..
  696. "🔥 Pontuação Final: " .. tostring(pontuacao) .. " 🔥\n\n" ..
  697. "Obrigado por jogar! Volte sempre para mais desafios! 🚀", "OK")
  698.  
  699.                 if opcao == 1 then
  700.                     os.exit()
  701.                 end
  702.             end
  703.         end
  704.         moverInimigos()
  705.         dispararInimigos()
  706.        
  707.         if checarColisoes() then
  708.             while true do
  709.                 local opcao = gg.alert("🚨💥 Oh não! Você foi atingido e sua armadura não resistiu à colisão!\n\nGame Over!\nPontuação Final: " .. tostring(pontuacao) .. "\n\n😔 Lembre-se: cada derrota é um aprendizado. Levante-se, ajuste sua estratégia e volte à batalha mais forte!", "OK")
  710.                
  711.                 if opcao == 1 then
  712.                     resetarJogo()
  713.                     menuPrincipal()
  714.                     iniciarJogo()
  715.                 end
  716.             end
  717.         end
  718.         gg.sleep(1)
  719.     end
  720. end
  721.  
  722. function voltar()
  723. local opcao = gg.alert("⚠️ Atenção, Comandante! ⚠️\n\n" ..
  724. "Se você voltar ao menu principal agora, TODO o seu progresso nesta batalha será perdido! 🏳️\n\n" ..
  725. "🚀 Sua missão será reiniciada, e você terá que começar desde o início, enfrentando os inimigos novamente desde o nível 1.\n\n" ..
  726. "Tem certeza de que deseja abandonar esta campanha e retornar ao menu principal? 🤔\n\n", "❌ Cancelar", "🔄 Voltar ao Menu")
  727. if opcao == 1 then
  728.     return
  729. else
  730.     -- Código para voltar ao menu principal
  731. resetarJogo()
  732. menuPrincipal()
  733. iniciarJogo()
  734.   end
  735. end
  736.  
  737. function resetarJogo()
  738.     -- Resetando variáveis principais
  739.     nivel = 1
  740.     pontuacao = 0
  741.     vidas = 100
  742.     gameOver = false
  743.    
  744.     -- Resetando o tanque do jogador
  745.     tanque.pos = {x = math.floor(largura/2)+1, y = altura - 1}
  746.     tanque.direcao = "Cima"
  747.     atualizarTanque()
  748.    
  749.     -- Resetando os inimigos
  750.     tanqueinimigos = {}
  751.    
  752.     -- Gerando o mapa fixo novamente
  753.     gerarMapaFixo()
  754.    
  755.     -- Resetando a base
  756.     baseCells = {
  757.         {x = baseCenter.x - 1, y = baseCenter.y - 1},
  758.         {x = baseCenter.x,     y = baseCenter.y - 1},
  759.         {x = baseCenter.x + 1, y = baseCenter.y - 1},
  760.         {x = baseCenter.x - 1, y = baseCenter.y    },
  761.         {x = baseCenter.x,     y = baseCenter.y    },
  762.         {x = baseCenter.x + 1, y = baseCenter.y    },
  763.         {x = baseCenter.x - 1, y = baseCenter.y + 1},
  764.         {x = baseCenter.x,     y = baseCenter.y + 1},
  765.         {x = baseCenter.x + 1, y = baseCenter.y + 1}
  766.     }
  767.    
  768.     -- Exibindo uma mensagem de reinício
  769.     gg.toast("Jogo reiniciado!\nPrepare-se para mais desafios.")
  770. end
  771.  
  772. -- INÍCIO DO SCRIPT: MENU PRINCIPAL E EXECUÇÃO DO JOGO
  773. menuPrincipal()
  774. iniciarJogo()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement