Advertisement
Guest User

turrent

a guest
Dec 29th, 2015
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.59 KB | None | 0 0
  1. local event
  2. local degree = 0
  3.  
  4. local deltaDeg = math.pi/20
  5. local minDeg = -0.3*math.pi
  6. local maxDeg = 0.3*math.pi
  7.  
  8. local function shot()
  9.   while true do
  10.     local tag = string.format("{Motion:[0:%fd,1:%fd,2:%fd]}",math.sin(degree)+0.001,0.2,math.cos(degree)+0.001)
  11.     commands.summon("Arrow","~","~1","~",tag)
  12.     if (minDeg and degree + deltaDeg < minDeg) or (maxDeg and degree + deltaDeg > maxDeg) then
  13.       deltaDeg = -deltaDeg
  14.     end
  15.     sleep(0.1)
  16.     degree = degree + deltaDeg
  17.   end
  18. end
  19.  
  20. local function stop()
  21.   os.pullEvent("char")
  22. end
  23.  
  24. parallel.waitForAny(shot,stop)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement