Good afternoon, I am trying to throttle input for a set amount of time, in short the application will play a sound, and display some images each time a key is pressed but I want to throttle this so that there is a pause. (IE the audio has time to finish)
I'm using love.timer.sleep(1000) but finding that it will pause and then will act like any key pressed in that 1 second sleep is pressed each second after the sleep has ended. I want to know if there is a way to disable input while sleep is active so that key presses in that time are not registered.
Thanks in advance, Dan.
Disable Input when Sleeping
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Disable Input when Sleeping
love.timer.sleep is horrible, it stops code execution, and so effectively hangs your game. You should check whether it's ready wherever you check for keypresses. In your case you probably want to do something like
Code: Select all
if source:isStopped() then
doEpicThings()
end
Who is online
Users browsing this forum: Google [Bot] and 4 guests