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 .
Zilarrezko
Party member
Posts: 345 Joined: Mon Dec 10, 2012 5:50 am
Location: Oregon
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
Positive07
Party member
Posts: 1014 Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina
Post
by Positive07 » Tue Jan 27, 2015 3:16 am
Zilarrezko wrote:
EDIT: sorry, I became "that" guy who corrects everything
Robin? hahaha
for i, person
in ipairs (everybody)
do
[tab] if not person.obey
then person:setObey(
true )
end
end
love.system.openURL(
github.com/pablomayobre )
Robin
The Omniscient
Posts: 6506 Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:
Post
by Robin » Tue Jan 27, 2015 10:33 pm
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.
Positive07
Party member
Posts: 1014 Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina
Post
by Positive07 » Tue Jan 27, 2015 11:21 pm
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
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
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.
slime
Solid Snayke
Posts: 3166 Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:
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
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
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?
Zilarrezko
Party member
Posts: 345 Joined: Mon Dec 10, 2012 5:50 am
Location: Oregon
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
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?
Users browsing this forum: No registered users and 14 guests