"Questions that don't deserve their own thread" thread

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.
Locked
User avatar
Zilarrezko
Party member
Posts: 345
Joined: Mon Dec 10, 2012 5:50 am
Location: Oregon

Re: "Questions that don't deserve their own thread" thread

Post by Zilarrezko »

Jasoco wrote:'snip'
He could also replace

Code: Select all

if signature = true then
    print(signaturetext)
else
    print("Error: Signature Not Found")
end
with

Code: Select all

if signature == true then
    print(signaturetext)
else
    print("Error: Signature Not Found")
end
To not get an error.

though um... If he wanted to control whether signaturetext prints or not with signature, then

Code: Select all

print(signaturetext or "Error: Signature Not Found")
would be

Code: Select all

print(signature and signaturetext or "Error: Signature Not Found")
correct?

EDIT: sorry, I became "that" guy who corrects everything :cry:
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: "Questions that don't deserve their own thread" thread

Post by Positive07 »

Zilarrezko wrote: EDIT: sorry, I became "that" guy who corrects everything :cry:
Robin? hahaha :rofl:
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: "Questions that don't deserve their own thread" thread

Post by Robin »

Positive07 wrote:Robin? hahaha :rofl:
:ehem:

love.system.openURL(Github.com/Positive07) should really be love.system.openURL("https://www.github.com/Positive07") although I think you can lose the https:// www.
Help us help you: attach a .love.
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: "Questions that don't deserve their own thread" thread

Post by Positive07 »

Robin wrote: :ehem:
Dont worry Robin no one will ever be able to replace you!

And yeah I know, I just wanted to remark the important parts of it ;)
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
Bindie
Party member
Posts: 151
Joined: Fri Jan 23, 2015 1:29 pm

Re: "Questions that don't deserve their own thread" thread

Post by Bindie »

Hey, I need a love function which detects if I just pressed a key, but only one time. Is there a smooth way?

To be extra clear: When I push a button, no matter how long I hold the key down, it will only call whatever code one single time.
User avatar
slime
Solid Snayke
Posts: 3131
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: "Questions that don't deserve their own thread" thread

Post by slime »

You can use the [wiki]love.keypressed[/wiki] event callback for that:

Code: Select all

function love.keypressed(key)
    if key == "a" then
        DoSomething()
    end
end
Bindie
Party member
Posts: 151
Joined: Fri Jan 23, 2015 1:29 pm

Re: "Questions that don't deserve their own thread" thread

Post by Bindie »

Thank you.
Bindie
Party member
Posts: 151
Joined: Fri Jan 23, 2015 1:29 pm

Re: "Questions that don't deserve their own thread" thread

Post by Bindie »

function love.keypressed(key)
if key == "escape" then
love.event.quit()
end
end

Let's say if I need to use it to more than one thing,

if Machine.on == true and love.keypressed(key) then
Machine.on = not Machine.on
end

It seems I have missed something. How do I use it like a return true when I hit a certain key?
User avatar
Zilarrezko
Party member
Posts: 345
Joined: Mon Dec 10, 2012 5:50 am
Location: Oregon

Re: "Questions that don't deserve their own thread" thread

Post by Zilarrezko »

Bindie wrote: Let's say if I need to use it to more than one thing,

if Machine.on == true and love.keypressed(key) then
Machine.on = not Machine.on
end

It seems I have missed something. How do I use it like a return true when I hit a certain key?
would

Code: Select all

if Machine.on == true and love.keypressed(key) then
Machine.on = not Machine.on
end
be

Code: Select all

if Machine.on == true and key == "escape" then
Machine.on = not Machine.on
end
Is this the droid you are looking for?
Bindie
Party member
Posts: 151
Joined: Fri Jan 23, 2015 1:29 pm

Re: "Questions that don't deserve their own thread" thread

Post by Bindie »

Awesome. Lol, *Bow wow*

Let's say I have:

Code: Select all

function love.keypressed(key)
    if key == " " then
    return true
    end
end
Inside of love.load()

And inside love.update() I want to

Code: Select all

if key == " " and CheckCollision(Players coordinates, Machines coordinates) then
Machine.on = not Machine.on
     if Machine.on == true then
     play(On-Sound)
     else
     play(Off-Sound)
     end

end
How do I?
Locked

Who is online

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