Page 29 of 91
Re: "Questions that don't deserve their own thread" thread
Posted: Tue Jan 27, 2015 2:22 am
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
Re: "Questions that don't deserve their own thread" thread
Posted: Tue Jan 27, 2015 3:16 am
by Positive07
Zilarrezko wrote:
EDIT: sorry, I became "that" guy who corrects everything
Robin? hahaha
Re: "Questions that don't deserve their own thread" thread
Posted: Tue Jan 27, 2015 10:33 pm
by Robin
Positive07 wrote:Robin? hahaha
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.
Re: "Questions that don't deserve their own thread" thread
Posted: Tue Jan 27, 2015 11:21 pm
by Positive07
Robin wrote:
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
Re: "Questions that don't deserve their own thread" thread
Posted: Wed Jan 28, 2015 5:35 pm
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.
Re: "Questions that don't deserve their own thread" thread
Posted: Wed Jan 28, 2015 5:45 pm
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
Re: "Questions that don't deserve their own thread" thread
Posted: Wed Jan 28, 2015 6:04 pm
by Bindie
Thank you.
Re: "Questions that don't deserve their own thread" thread
Posted: Wed Jan 28, 2015 6:17 pm
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?
Re: "Questions that don't deserve their own thread" thread
Posted: Wed Jan 28, 2015 6:29 pm
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?
Re: "Questions that don't deserve their own thread" thread
Posted: Wed Jan 28, 2015 6:32 pm
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?