Advertisement
Novohp

Zombie

Nov 30th, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.24 KB | None | 0 0
  1.  
  2. --[[Sobrevivente]]--
  3. local Sobrevivente = {}
  4.  
  5. function Sobrevivente.novo(nome)
  6.     return {
  7.         Vida = 200,
  8.         nome = nome
  9.     }
  10. end
  11. Sobrevivente.novo()
  12. --[[Inimigo]]--
  13. local Inimigo = {}
  14. function Inimigo.novo(forca,categoria)
  15.     return {
  16.         forca = forca,
  17.         categoria = categoria
  18.     }
  19. end
  20. Inimigo.novo()
  21. --[[Dano Z]]--
  22. local Zombie = {}
  23. function Zombie()
  24.     Zombie = Inimigo.novo(50,"Zumbi")
  25.     --Zombie_ataque = true
  26.     return Zombie
  27. end
  28. Zombie()
  29. ---
  30. --[[Zombie Ataca]]--
  31. local Zombie_ataque = {}
  32. function Zombie_ataque(Zombie,Sobrevivente_instancia)
  33.     print("Zombie atacou"..Sobrevivente_instancia.nome.."!")
  34.     Sobrevivente_instancia.Vida = Sobrevivente_instancia.Vida - Zombie.forca
  35.     if Sobrevivente_instancia.Vida <= 0 then
  36.         print(""..Sobrevivente_instancia.name.. "morreu")
  37.     end
  38. end
  39. Zombie_ataque()
  40. -----
  41. local  Sobrevivente1 = Sobrevivente.novo("Lucas")
  42. local  Sobrevivente2 = Sobrevivente.novo("Andre")
  43. local  Sobrevivente3 = Sobrevivente.novo("Jackson")
  44. ---
  45. local Zombie1 = Zombie.novo()
  46. local Zombie2 = Zombie.novo()
  47. local Zombie3 = Zombie.novo()
  48. ---
  49. Zombie_ataque(Zombie1,Sobrevivente1)
  50. Zombie_ataque(Zombie2,Sobrevivente2)
  51. Zombie_ataque(Zombie3,Sobrevivente3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement