"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 » Tue Jan 27, 2015 2:22 am

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: 1006
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

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

Post by Positive07 » Tue Jan 27, 2015 3:16 am

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/Positive07)

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 » Tue Jan 27, 2015 10:33 pm

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: 1006
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

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

Post by Positive07 » Tue Jan 27, 2015 11:21 pm

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/Positive07)

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 » Wed Jan 28, 2015 5:35 pm

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: 2888
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 » Wed Jan 28, 2015 5:45 pm

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 » Wed Jan 28, 2015 6:04 pm

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 » Wed Jan 28, 2015 6:17 pm

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 » Wed Jan 28, 2015 6:29 pm

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 » Wed Jan 28, 2015 6:32 pm

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: Bing [Bot] and 31 guests