When I use love.timer.sleep() it freezes I don't want it to freeze but delay
How can I do that?
I have tried looking in other topics
[SOLVED] Sleep without freezing
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
[SOLVED] Sleep without freezing
Last edited by 6l8 on Fri Feb 20, 2015 8:52 am, edited 1 time in total.
Re: Sleep without freezing
love.timer.sleep() pauses the thread, It's not really meant for delaying things. You can implement a simple timer instead.
The following code would print "Hello world" after 3 seconds.
The following code would print "Hello world" after 3 seconds.
Code: Select all
local time = 3
local cTime = 0
function love.update(dt)
cTime = cTime + dt
if cTime > time then
print("Hello world")
end
end
- Jasoco
- Inner party member
- Posts: 3726
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: Sleep without freezing
Use a Timer library like cron.lua. It'll make it dead simple.
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 9 guests