xXm0dzXx

Untitled

Apr 25th, 2012
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local direction = ">"
  2.  
  3. function clear()
  4. term.clear()
  5. term.setCursorPos(1,1)
  6. end
  7.  
  8. function change(param1)
  9. direction = param1
  10. end
  11.  
  12. function redraw()
  13. clear()
  14. write("\n+---+---+---+---+ +-Info-+\n")
  15. write("| | |Dir." ..direction.. " |\n")
  16. write("| | | |\n")
  17. write("| | +-Info-+\n")
  18. write("| |\n")
  19. write("+---+---+---+---+\n")
  20. write("| < | v | ^ | > |\n")
  21. write("+---+---+---+---+\n")
  22. if direction == ">" then
  23. term.setCursorPos(15, 9)
  24. elseif direction == "<" then
  25. term.setCursorPos(3, 9)
  26. elseif direction == "v" then
  27. term.setCursorPos(7, 9)
  28. elseif direction == "^" then
  29. term.setCursorPos(11, 9)
  30. end
  31.  
  32. write("^")
  33. end
  34.  
  35. while true do
  36. redraw()
  37. if rs.getInput("right") == true then
  38. clear()
  39. change(">")
  40. redraw()
  41. elseif rs.getInput("left") == true then
  42. clear()
  43. change("<")
  44. redraw()
  45. elseif rs.getInput("back") == true then
  46. clear()
  47. change("v")
  48. redraw()
  49. elseif rs.getInput("bottom") == true then
  50. clear()
  51. change("^")
  52. redraw()
  53. end
  54.  
  55. redraw()
  56. sleep(0)
  57. redraw()
  58. end
Advertisement
Add Comment
Please, Sign In to add comment