maxderopnl

Lol

Oct 11th, 2014
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.90 KB | None | 0 0
  1. term.clear()
  2. map = paintutils.loadImage("files/map")
  3. paintutils.drawImage(map, 1, 1)
  4. term.setCursorPos(28, 10)
  5. print("@")
  6. local X = 28
  7. local Y = 10
  8. local score = 0
  9. local hp = 1647
  10. local coina = 1
  11. local coina_X = 2
  12. local coina_Y = 2
  13. local coinb = 1
  14. local coinb_X = 8
  15. local coinb_Y = 15
  16. local coinc = 1
  17. local coinc_X = 9
  18. local coinc_Y = 4
  19. local coind = 1
  20. local coind_X = 30
  21. local coind_Y = 2
  22. local coine = 1
  23. local coine_X = 15
  24. local coine_Y = 8
  25. local moba = 1
  26. local moba_X = 10
  27. local moba_Y = 14
  28.  
  29.  
  30.  
  31. function player()
  32. local event, move = os.pullEvent ("char")
  33. if move == "a" then
  34. X=X-1
  35. term.clear()
  36. paintutils.drawImage(map, 1, 1)
  37. term.setCursorPos(X, Y)
  38. print("<")
  39. else if move == "d" then
  40. X=X+1
  41. term.clear()
  42. paintutils.drawImage(map, 1, 1)
  43. term.setCursorPos(X, Y)
  44. print(">")
  45. else if move == "w" then
  46. Y=Y-1
  47. term.clear()
  48. paintutils.drawImage(map, 1, 1)
  49. term.setCursorPos(X, Y)
  50. print("^")
  51. else if move == "s" then
  52. Y=Y+1
  53. term.clear()
  54. paintutils.drawImage(map, 1, 1)
  55. term.setCursorPos(X, Y)
  56. print("V")
  57. end
  58. end
  59. end
  60. end
  61. if X <= 0 then
  62. X=1
  63. else if X >= 52 then
  64. X=51
  65. else if Y >= 19 then
  66. Y=18
  67. else if Y <= 1 then
  68. Y=2
  69. end
  70. end
  71. end
  72. end
  73. if hp <= 0 then
  74. game_end()
  75. end
  76. term.clear()
  77. paintutils.drawImage(map, 1, 1)
  78. term.setCursorPos(X, Y)
  79. print("@")
  80. term.setCursorPos(1,1)
  81. print("HP: "..hp)
  82. term.setCursorPos(14,1)
  83. print("Kills: "..score)
  84. end
  85.  
  86. function coins()
  87.  
  88. if coina == 1 then
  89. term.setCursorPos(coina_X,coina_Y)
  90. print("$")
  91. if X == coina_X and Y == coina_Y then
  92. score=score+1
  93. coina=0
  94. end
  95. end
  96.  
  97. if coinb == 1 then
  98. term.setCursorPos(coinb_X,coinb_Y)
  99. print("$")
  100. if X == coinb_X and Y == coinb_Y then
  101. score=score+1
  102. coinb=0
  103. end
  104. end
  105.  
  106. if coinc == 1 then
  107. term.setCursorPos(coinc_X,coinc_Y)
  108. print("$")
  109. if X == coinc_X and Y == coinc_Y then
  110. score=score+1
  111. coinc=0
  112. end
  113. end
  114.  
  115. if coind == 1 then
  116. term.setCursorPos(coind_X,coind_Y)
  117. print("$")
  118. if X == coind_X and Y == coind_Y then
  119. score=score+1
  120. coind=0
  121. end
  122. end
  123.  
  124. if coine == 1 then
  125. term.setCursorPos(coine_X,coine_Y)
  126. print("$")
  127. if X == coine_X and Y == coine_Y then
  128. score=score+1
  129. coine=0
  130. end
  131. end
  132.  
  133.  
  134. end
  135.  
  136.  
  137. function mob()
  138. if moba == 1 then
  139. term.setCursorPos(moba_X,moba_Y)
  140. print("1")
  141. if X == moba_X and Y == moba_Y then
  142. X=28
  143. Y=10
  144. hp=hp-1
  145. end
  146. end
  147. end
  148.  
  149. function ai()
  150.  
  151. end
  152.  
  153. function weapon()
  154.  
  155. end
  156.  
  157. function game_end()
  158. term.clear()
  159. term.setCursorPos(8, 5)
  160. print("YOU LOST!")
  161. term.setCursorPos(8, 6)
  162. print("Thankyou for playing!")
  163. term.setCursorPos(8, 7)
  164. print("Made by Twig1233")
  165. term.setCursorPos(8, 8)
  166. print("Your score was: "..score)
  167. shell.run("game")
  168. end
  169.  
  170. while true do
  171. player()
  172. coins()
  173. mob()
  174. if score >= 5 then
  175. term.clear()
  176. term.setCursorPos(8, 5)
  177. print("YOU WON!")
  178. term.setCursorPos(8, 6)
  179. print("Thankyou for playing!")
  180. term.setCursorPos(8, 7)
  181. print("Made by maxderopnl")
  182. term.setCursorPos(8, 8)
  183. print("Your score was: "..score)
  184. shell.run("game")
  185. end
  186. sleep(0.01)
  187. end
Advertisement
Add Comment
Please, Sign In to add comment