Nike622000

Untitled

May 23rd, 2016
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.39 KB | None | 0 0
  1. monSide = "back"
  2. mon = peripheral.wrap(monSide)
  3.  
  4. local xMax,yMax = mon.getSize()
  5.  
  6.  
  7. function hintergrund()
  8. mon.setBackgroundColor(colors.cyan)
  9. for b = 0,xMax,1 do
  10. for i = 0,yMax,1 do
  11. mon.setCursorPos(b,i)
  12. mon.write(" ")
  13. end
  14. end
  15. end
  16.  
  17. function animation()
  18. mon.setBackgroundColor(colors.white)
  19. g = -2
  20. for l = 1,8,1 do
  21. mon.setBackgroundColor(colors.white)
  22. mon.setCursorPos(l,2)
  23. mon.write(" ")
  24. sleep(0.1)
  25. mon.setBackgroundColor(colors.cyan)
  26. mon.setCursorPos(g,2)
  27. mon.write(" ")
  28. g = g+1
  29. mon.setBackgroundColor(colors.white)
  30. end
  31.  
  32. --S
  33. for l = 8,6,-1 do
  34. mon.setCursorPos(l,2)
  35. mon.write(" ")
  36. sleep(0.1)
  37. end
  38. mon.setCursorPos(6,3)
  39. mon.write(" ")
  40. sleep(0.1)
  41. for l = 6,8,1 do
  42. mon.setCursorPos(l,4)
  43. mon.write(" ")
  44. sleep(0.1)
  45. end
  46. mon.setCursorPos(8,5)
  47. mon.write(" ")
  48. sleep(0.1)
  49. for l = 8,6,-1 do
  50. mon.setCursorPos(l,6)
  51. mon.write(" ")
  52. sleep(0.1)
  53. end
  54. --N
  55. for l = 6,2,-1 do
  56. mon.setCursorPos(10,l)
  57. mon.write(" ")
  58. sleep(0.1)
  59. end
  60. mon.setCursorPos(11,2)
  61. g = 11
  62. for l = 3,5,1 do
  63. mon.setCursorPos(g,l)
  64. mon.write(" ")
  65. g=g+1
  66. sleep(0.1)
  67. end
  68. for l = 6,2,-1 do
  69. mon.setCursorPos(14,l)
  70. mon.write(" ")
  71. sleep(0.1)
  72. end
  73. --A
  74. for l = 6,3,-1 do
  75. mon.setCursorPos(16,l)
  76. mon.write(" ")
  77. sleep(0.1)
  78. end
  79. for l = 17,18,1 do
  80. mon.setCursorPos(l,2)
  81. mon.write(" ")
  82. sleep(0.1)
  83. end
  84. for l = 3,6,1 do
  85. mon.setCursorPos(19,l)
  86. mon.write(" ")
  87. sleep(0.1)
  88. end
  89. for l = 17,18,1 do
  90. mon.setCursorPos(l,4)
  91. mon.write(" ")
  92. sleep(0.1)
  93. end
  94. --K
  95. for l = 6,2,-1 do
  96. mon.setCursorPos(21,l)
  97. mon.write(" ")
  98. sleep(0.1)
  99. end
  100. g = 4
  101. for l = 22,24,1 do
  102. mon.setCursorPos(l,g)
  103. mon.write(" ")
  104. g=g-1
  105. sleep(0.1)
  106. end
  107. g = 5
  108. for l = 23,24,1 do
  109. mon.setCursorPos(l,g)
  110. mon.write(" ")
  111. g=g+1
  112. sleep(0.1)
  113. end
  114. --E
  115. for l = 6,2,-1 do
  116. mon.setCursorPos(26,l)
  117. mon.write(" ")
  118. sleep(0.1)
  119. end
  120. for g = 2,6,2 do
  121. for l = 27,28,1 do
  122. mon.setCursorPos(l,g)
  123. mon.write(" ")
  124. sleep(0.1)
  125. end
  126. end
  127. g = 27
  128. for l = 29,xMax,1 do
  129. mon.setBackgroundColor(colors.white)
  130. mon.setCursorPos(l,6)
  131. mon.write(" ")
  132. sleep(0.1)
  133. if g >= 29 then
  134. mon.setBackgroundColor(colors.cyan)
  135. mon.setCursorPos(g,6)
  136. mon.write(" ")
  137. end
  138. g=g+1
  139. end
  140. snake=xMax-5
  141. for l = xMax,snake,-1 do
  142. mon.setBackgroundColor(colors.cyan)
  143. mon.setCursorPos(l,6)
  144. mon.write(" ")
  145. end
  146. end
  147.  
  148. function steuerung()
  149. mon.setBackgroundColor(colors.black)
  150. mon.setTextColor(colors.white)
  151. mon.setCursorPos(60,15)
  152. mon.write("W")
  153. mon.setCursorPos(57,17)
  154. mon.write("A")
  155. mon.setCursorPos(60,17)
  156. mon.write("+")
  157. mon.setCursorPos(63,17)
  158. mon.write("S")
  159. mon.setCursorPos(60,19)
  160. mon.write("D")
  161. end
  162.  
  163. function hauptmenu()
  164. hintergrund()
  165. animation()
  166. steuerung()
  167. mon.setBackgroundColor(colors.cyan)
  168. mon.setTextScale(1)
  169. mon.setTextColor(colors.white)
  170. mon.setCursorPos(7,8)
  171. mon.write("[Spiel starten]")
  172. sleep(0.5)
  173. mon.setCursorPos(7,9)
  174. mon.write("[Optionen]")
  175. sleep(0.5)
  176. mon.setCursorPos(7,10)
  177. mon.write("[Anleitung]")
  178. sleep(0.5)
  179. mon.setCursorPos(7,11)
  180. mon.write("[Beenden]")
  181. end
  182.  
  183. hauptmenu()
  184.  
  185. os.loadAPI("ocs/apis/sensor")
  186. proximity = sensor.wrap("top")
  187. player = "warte auf Spieler..."
  188. while true do
  189. sleep(0.2)
  190. targets = proximity.getTargets()
  191. for k,v in pairs(targets) do
  192. if v.Name == "Player"
  193. and v.Position.X<=3 and v.Position.X>=-3
  194. and v.Position.Z<=9 and v.Position.Z>=3
  195. and v.Position.Y>=-3 and v.Position.Y<=4
  196. then
  197. player = k
  198. else
  199. player = "warte auf Spieler..."
  200. --W
  201. if v.Name == "Player" and
  202. v.Position.X>=-0.5 and v.Position.X <=0.5 and
  203. v.Position.Z>=4.5 and v.Position.Z<=5.5 and
  204. v.Position.Y>=-3 and v.Position.Y<=4 then
  205. print("W")
  206. end
  207.  
  208.  
  209. if v.Name == "Player" then
  210. print(v.Position.X .." ".. v.Position.Z .." ".. v.Position.Y)
  211. end
  212. end
  213. end
  214. for l = 1,xMax,1 do
  215. mon.setCursorPos(l,1)
  216. mon.setBackgroundColor(colors.cyan)
  217. mon.write(" ")
  218. end
  219. mon.setCursorPos(1,1)
  220. mon.setBackgroundColor(colors.black)
  221. mon.write(player)
  222. end
  223. end
  224. end
Advertisement
Add Comment
Please, Sign In to add comment