Page 1 of 1
Text?
Posted: Sat Nov 26, 2011 10:51 pm
by miz656
function love.update()
if key == "9" then
for i = 1,9 do
wait(1)
text = i +1
end
end
end
Why won't it work? I know nothing about love objects =-=
Re: Text?
Posted: Sat Nov 26, 2011 11:16 pm
by vrld
Re: Text?
Posted: Sun Nov 27, 2011 11:40 am
by Robin
Yes, please carefully read the forum rules again.
You'll want to use
love.keypressed.
Also note there is nothing like "wait(1)" in LÖVE. If it were, doing that would stop everything for a second, completely freezing it, so you can't even close the window. What you do instead is, for example, setting a variable to 0 and adding
dt each time in
love.update(dt). Once it is larger than the number of seconds you want to wait, you run the code.
Re: Text?
Posted: Sun Nov 27, 2011 11:46 pm
by LuaWeaver
Robin wrote:Yes, please carefully read the forum rules again.
You'll want to use
love.keypressed.
Also note there is nothing like "wait(1)" in LÖVE. If it were, doing that would stop everything for a second, completely freezing it, so you can't even close the window. What you do instead is, for example, setting a variable to 0 and adding
dt each time in
love.update(dt). Once it is larger than the number of seconds you want to wait, you run the code.
Yes. I tried love.timer.sleep(1) once. I was upset.
Re: Text?
Posted: Mon Nov 28, 2011 9:14 am
by miko
miz656 wrote:function love.update()
if key == "9" then
for i = 1,9 do
wait(1)
text = i +1
end
end
end
Why won't it work? I know nothing about love objects =-=
You have already asked this question, and it was already answered here:
http://love2d.org/forums/viewtopic.php?f=4&t=4624
BTW, looking at this loop (which is useless, because the text variable will be always set to "10" after it finishes), I think you should define first what do you mean by "work". It surely works, but seems you expect something different, and I (we?) don't quite understand what that could be.