So… uhm…
I’m kind of absolutely new to Defold, and I’m just trying to figure out how to get a button to only register that it has been pressed once without continuing to do more things afterwards. Also, strange things happen as I try to get the input to change a variable. It stays one value and just spams it in the debug. I’ve tried to make a boolean for the button but it’s not working…?
This is the code I’m working with:
if curstate == "title" then
if action_id == hash("up") and antibutton == false then
if action.pressed then
if curselect == "start" then
curselect = "quit"
end
if curselect == "quit" then
curselect = "option"
end
if curselect == "option" then
curselect = "start"
end
end
end
if action_id == hash("down") and antibutton == false then
if action.pressed then
if curselect == "start" then
curselect = "option"
end
if curselect == "option" then
curselect = "quit"
end
if curselect == "quit" then
curselect = "start"
end
end
end
-- if action_id == hash("up") and action.repeated or action_id == hash("down") and action.repeated then
-- antibutton = true
-- end
-- if action_id == hash("up") and action.pressed or action_id == hash("down") and action.pressed then
-- antibutton = true
-- end
-- if action_id == hash("up") and action.released and action_id == hash("down") and action.released then
-- antibutton = false
-- end
print(curselect)
I would appreciate any help, thank you.