Hello everyone,
after trying for some time by myself i guess it’s time to ask for help.
Scenario:
start an animation chain
wait for it to end
start another animation chain
I want to avoid the use of a last callback on chain 1 to fire the second set of animations as everything wil become messy as i would have to pass down the callback thru many subroutines
So i’m exploring coroutines and wrote:
function waitAnimationEnd()
while(animating) do
socket.sleep(0.1)
end
end
function checkMatchingGlyphs()
print("check matching")
co1 = coroutine.create(function()
checkMatchingGlyph(C.PLAYER1)
end)
co2 = coroutine.create(function()
waitAnimationEnd()
checkMatchingGlyph(C.PLAYER2)
end)
coroutine.resume(co1)
coroutine.resume(co2)
end
the animating flag is set and reset properly
however, if i resume coroutine(co2), everything freezes while i expected that sleeping in the coroutine would not affect the main thread
what i did not understood?