Posted 08 November 2012 - 09:50 AM
I'm fooling around with the parallel api, and it sounds great, but I can't seem to get it to work.
For example i want two animations to run at once (see code below)
It only plays the first function i put into the parallel.waitForAll
For example i want two animations to run at once (see code below)
It only plays the first function i put into the parallel.waitForAll
local frame1 = 1
local frame2 = 1
local animT = {"/","-","\\","|",}
function play()
while true do
term.setCursorPos(10,4)
currAnim = animT[frame1]
term.write(currAnim)
if frame1 == #animT then frame1 = 0 end
frame1 = frame1 + 1
sleep(.5)
end
end
function play2()
while true do
term.setCursorPos(20,2)
currAnim = animT[frame2]
term.write(currAnim)
if frame2 == #animT then frame2 = 0 end
frame2 = frame2 + 1
sleep(.1)
end
end
parallel.waitForAll(play(), play2())