Text?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
miz656
Prole
Posts: 20
Joined: Fri Nov 25, 2011 3:39 pm

Text?

Post 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 =-=
User avatar
vrld
Party member
Posts: 917
Joined: Sun Apr 04, 2010 9:14 pm
Location: Germany
Contact:

Re: Text?

Post by vrld »

Have a look at this.
I have come here to chew bubblegum and kick ass... and I'm all out of bubblegum.

hump | HC | SUIT | moonshine
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Text?

Post 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.
Help us help you: attach a .love.
LuaWeaver
Party member
Posts: 183
Joined: Wed Mar 02, 2011 11:15 pm
Location: Ohio, USA

Re: Text?

Post 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.
"your actions cause me to infer your ego is the size of three houses" -finley
User avatar
miko
Party member
Posts: 410
Joined: Fri Nov 26, 2010 2:25 pm
Location: PL

Re: Text?

Post 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.
My lovely code lives at GitHub: http://github.com/miko/Love2d-samples
Post Reply

Who is online

Users browsing this forum: Amazon [Bot], Bing [Bot], Google [Bot] and 7 guests