crife

Controllo mining turtle

Mar 30th, 2013
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.99 KB | None | 0 0
  1. -- crife muovi la turtle
  2. --Varianti
  3. tasto = ""
  4.  
  5. --Funzioni
  6.  
  7. function muovi()
  8.     print (think)
  9.     if tasto == "17" then
  10.         turtle.forward()
  11.         print ("Avanti")
  12.     elseif tasto == "30" then
  13.         turtle.turnLeft()
  14.         print ("gira a sinistra")
  15.     elseif tasto == "31" then
  16.         turtle.back()
  17.         print ("indietro")
  18.     elseif tasto == "32" then
  19.         turtle.turnRight()
  20.         print ("gira a destra")
  21.     elseif tasto == "18" then
  22.         turtle.dig()
  23.         print ("scava avanti")
  24.     elseif tasto == "16" then
  25.         turtle.digDown()
  26.         print ("scava sotto")
  27.     elseif tasto == "44" then
  28.         turtle.down()
  29.         print ("vai giu")
  30.     elseif tasto == "45" then
  31.         turtle.up()
  32.         print ("vai su")
  33.     end
  34. end
  35.  
  36. --Programma
  37. --Comandi
  38. print ("W = avanti")
  39. print ("A = voltati a sinistra")
  40. print ("S = indietro")
  41. print ("D = voltati a destra")
  42. print ("E = scava avanti")
  43. print ("Q = scava sotto")
  44. print ("Z = vai giu")
  45. print ("X = vai su")
  46.  
  47. --loop
  48. while true do
  49.     event, scancode = os.pullEvent("key")
  50.     tasto = tostring(scancode)
  51.     muovi()
  52. end
Advertisement
Add Comment
Please, Sign In to add comment