Advertisement
Descaii

t

Jan 26th, 2016
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.80 KB | None | 0 0
  1. Forward = {x=1,y=0,z=0}
  2. function shift(direction)
  3.     if direction=="right" then
  4.         print("shifting direction right")
  5.         if Forward.x==1 then
  6.             Forward.x=0
  7.             Forward.z=1
  8.         elseif Forward.z==1 then
  9.             Forward.x=-1
  10.             Forward.z=0
  11.         elseif Forward.x==-1 then
  12.             Forward.x=0
  13.             Forward.z=-1
  14.         elseif Forward.z==-1 then
  15.             Forward.z=0
  16.             Forward.x=1
  17.         end
  18.     end
  19.     if direction=="left" then
  20.         print("shifting direction left")
  21.         if Forward.x==1 then
  22.             Forward.x=0
  23.             Forward.z=-1
  24.         elseif Forward.z==-1 then
  25.             Forward.x=-1
  26.             Forward.z=0
  27.         elseif Forward.x==-1 then
  28.             Forward.x=0
  29.             Forward.z=1
  30.         elseif Forward.z==1 then
  31.             Forward.z=0
  32.             Forward.x=1
  33.         end
  34.     end
  35. end
  36. for i = 1,20 do
  37.     print("Forward")
  38.     for i,v in pairs(Forward) do
  39.         print(i.."="..v)
  40.     end
  41.     shift("right")
  42.     sleep(1)
  43. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement