NOOOOOOOOO. It will do the same love.timer.sleep is, which is actually included by default too, and it will cause the entirety of the game to stop, no drawing, no updating, no events. So this is not a solution.miko wrote: you could use socket.sleep().
Waiting.
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Waiting.
- TheKraigose
- Prole
- Posts: 9
- Joined: Tue Apr 12, 2011 5:20 pm
- Location: Somewhere that's Hi in the middle, Round at Both Ends!
- Contact:
Re: Waiting.
I'm not sure if it helps or anything, because I'm not knowing the specifics of exactly what you are trying to accomplish.
However, when it comes to waiting... one thing I notice is I'm able to do a countdown clock method.
This is a simple example from my own game:
This might be tweaked a bit as it's a similar method I use to make enemies wait before shooting again. I just tweaked it for the user input to "wait".
However, when it comes to waiting... one thing I notice is I'm able to do a countdown clock method.
This is a simple example from my own game:
Code: Select all
-- in player.lua
pauseCooldown = 60 -- so the pause button actually works, we wait a while to make sure of this
-- many code and functions later...
-- in input.lua
function checkPauseKey()
if love.keyboard.isDown("p") and pauseCooldown >= 60 then -- check if we can "press 'p'" again
if isPaused == false then
isPaused = true -- this flag stops the main game rendering and logic
else
isPaused = false -- this flag unfreezes game rendering and logic
end
pauseCooldown = 0 -- set the cooldown to 0
end
if pauseCooldown < 60 then -- if not cooled down completely
pauseCooldown = pauseCooldown + 1 -- then we increment the cooldown timer up one tic
end
end
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Waiting.
Good example.
How about:
?
Code: Select all
if isPaused == false then
isPaused = true -- this flag stops the main game rendering and logic
else
isPaused = false -- this flag unfreezes game rendering and logic
end
Code: Select all
isPaused = not isPaused
Help us help you: attach a .love.
- TheKraigose
- Prole
- Posts: 9
- Joined: Tue Apr 12, 2011 5:20 pm
- Location: Somewhere that's Hi in the middle, Round at Both Ends!
- Contact:
Re: Waiting.
Ah! I was not familiar with the not keyword! Does it basically act like !varName does in C++?Robin wrote:Good example.
How about:Code: Select all
if isPaused == false then isPaused = true -- this flag stops the main game rendering and logic else isPaused = false -- this flag unfreezes game rendering and logic end
?Code: Select all
isPaused = not isPaused
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Waiting.
Yes.
- BlackBulletIV
- Inner party member
- Posts: 1261
- Joined: Wed Dec 29, 2010 8:19 pm
- Location: Queensland, Australia
- Contact:
Re: Waiting.
Oh dear, well you'll certainly need it. (Although you could use condition == false, but that gets ugly).TheKraigose wrote:I was not familiar with the not keyword!
Who is online
Users browsing this forum: No registered users and 5 guests