How do I wait until a condition is given in LOVE2D?

Asked

Viewed 45 times

0

I’ve already tried

timer=require'hump.timer'
    timer.script(function(wait)
    repeat
        wait(0)
    until condição

but it didn’t work.I even tried to remove the wait,but the game crashed.Please help me!!!

1 answer

0

The function wait makes use of coroutines, so this should work normally. Or already tried to use timer.every?

timer.every(0, function()
    if condição then
        --[=[ Ação final ]=]
        -- Acaba por aqui.
        return;
    end
    return true;
end);

Or:

timer.every(0, function()
    --[=[ Ação enquanto isso não acaba ]=]
    return not condição;
end);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.