Advertisement
Guest User

move

a guest
Aug 22nd, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.17 KB | None | 0 0
  1. --code wall making sure that no funny
  2. --business is going on with the tape drive
  3. local run = true
  4. tape = peripheral.find("tape_drive")
  5. if not tape then
  6.   print("ya need a tape fer this eiet")
  7.   run = false
  8. end
  9. if not tape.isReady() and not tape.getLabel() == "Movement_SoundPAC" then
  10.   print("put the correct tape in boy")
  11.   run = false
  12. end
  13. --if run is false, program will not start
  14. if tape and tape.isReady() and tape.getLabel() == "Movement_SoundPAC" then
  15.   tape.seek(-tape.getSize()) --adding "()" to getSize will call the function
  16. end
  17.  
  18. local scene = 1 -- not used yet
  19. local x = 2 --defining
  20. local y = 2 --position variables
  21. local function input()
  22.   local event,key,aux1,aux2 = os.pullEvent()
  23.   if event == "key" then
  24.     if key == "200" or key == "17" and y > 1 then
  25.       y = y - 1
  26.     elseif key == "208" or key == "31" and y < 9 then
  27.       y = y + 1
  28.     elseif key == "203" or key == "30" and x > 1 then
  29.       x = x - 1
  30.     elseif key == "205" or key == "32" and x > 1 then
  31.       x = x + 1
  32.     elseif key == "28" then
  33.       if tape.getState() == "PLAYING" then
  34.         tape.stop()
  35.         tape.seek(-tape.getSize())
  36.       end  
  37.       run = false
  38.     end
  39.   end
  40. end
  41. local l1 = {}
  42. local l2 = {}
  43. local l3 = {}
  44. local l4 = {}
  45. local l5 = {}
  46. local l6 = {}
  47. local l7 = {}
  48. local l8 = {}
  49. local l9 = {}
  50. local l10 = {}
  51. local l11 = {}
  52. -- dont define as local for every change, because it messes up lua
  53. --while run do
  54.   term.clear()
  55.   term.setCursorPos(1,1)
  56.   l1 = {"#","#","#","#","#","#","#","#","#","#","#"}
  57.   l2 = {"#"," "," "," "," "," "," "," "," "," ","#"}
  58.   l3 = {"#"," "," "," "," "," "," "," "," "," ","#"}
  59.   l4 = {"#"," "," "," "," "," "," "," "," "," ","#"}
  60.   l5 = {"#"," "," "," "," "," "," "," "," "," ","#"}
  61.   l6 = {"#"," "," "," "," "," "," "," "," "," ","#"}
  62.   l7 = {"#"," "," "," "," "," "," "," "," "," ","#"}
  63.   l8 = {"#"," "," "," "," "," "," "," "," "," ","#"}
  64.   l9 = {"#"," "," "," "," "," "," "," "," "," ","#"}
  65.   l10 ={"#"," "," "," "," "," "," "," "," "," ","#"}
  66.   l11 ={"#","#","#","#","#","#","#","#","#","#","#"}
  67.   for i,f in pairs(l1)do
  68.     char = 1
  69.     term.write(f)
  70.     term.setCursorPos(i,1)
  71.     char = char + 1
  72.   end
  73. --end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement