Wait/Pause/Sleep?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Wait/Pause/Sleep?
Can you upload a .love file?
Re: Wait/Pause/Sleep?
You're not putting dt as argument to the love.draw function, are you? It should be to love.update, nothing else.
My game called Hat Cat and the Obvious Crimes Against the Fundamental Laws of Physics is out now!
Re: Wait/Pause/Sleep?
Nope. It's only in the update function, and that's all. I put this line in the update function:T-Bone wrote:You're not putting dt as argument to the love.draw function, are you? It should be to love.update, nothing else.
Code: Select all
love.graphics.print(dt, 100, 200)
Done!Jackim wrote:Can you upload a .love file?
- Attachments
-
- testgame.love
- (79.36 KiB) Downloaded 204 times
Re: Wait/Pause/Sleep?
The way you've set up your code, for whatever reason, makes it so dt doesn't work in your update function.
I put it in the love.update built in function and it works fine.
I put it in the love.update built in function and it works fine.
- Attachments
-
- fixed.love
- (80.5 KiB) Downloaded 189 times
- Jasoco
- Inner party member
- Posts: 3727
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: Wait/Pause/Sleep?
No. Don't do this. It's better to use or design a timer library and use those. I threw my own together for use in my own game and there's a few here you can use.Plu wrote:It's probably a better idea to doThe above would keep the CPU running all the time, which probably isn't neccesary.Code: Select all
love.timer.sleep( 5 )
Re: Wait/Pause/Sleep?
Thank you! So if I understand correctly, for anything that requires timers or the utilization of 'dt' I will need to always put those calculations in the actual built-in update function instead of the 'pcall' one?Jackim wrote:The way you've set up your code, for whatever reason, makes it so dt doesn't work in your update function.
I put it in the love.update built in function and it works fine.
Re: Wait/Pause/Sleep?
Yes, that's correct. If you want to call other functions that use dt, call them from within love.update and pass on dt as an argument.
Love.timer.sleep is, as far as I know, mainly used in threads that aren't the main thread.
Love.timer.sleep is, as far as I know, mainly used in threads that aren't the main thread.
My game called Hat Cat and the Obvious Crimes Against the Fundamental Laws of Physics is out now!
Who is online
Users browsing this forum: No registered users and 14 guests