In a game, you'd want it so you can press something like 'e' to toggle sound. How would you do this? Currently, I have it so there are 2 different buttons: One for enabling sound and one for disabling. Hopefully this makes sense. If it doesn't, feel free to ask and I'll be sure to elaborate!
Thanks! Any help is appreciated!
Adding toggle buttons?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Adding toggle buttons?
"In those quiet moments, you come into my mind" - Liam Reilly
Re: Adding toggle buttons?
Code: Select all
local music = true
function love.keypressed( key )
if key == "m" then
music = not music -- actually changes the current state
end
end
Re: Adding toggle buttons?
That didn't work It still played the music!MadByte wrote:Code: Select all
local music = true function love.keypressed( key ) if key == "m" then music = not music -- actually changes the current state end end
EDIT: Nevermind, it worked! I just have to slam the M key really hard
"In those quiet moments, you come into my mind" - Liam Reilly
Who is online
Users browsing this forum: Google [Bot] and 4 guests