Im trying to make my game have you input name after you picked one of options using a-z keys, however the key used to pick the option also gets carried on to the next screen as the first letter of name.
function love.load()
text = ""
inputReady = false
end
function love.textinput(t)
if inputReady then
text = text .. t
end
end
function love.draw()
if inputReady then
love.graphics.print(text, 0, 0)
else love.graphics.print("press a to start typing",0,0) end
end
function love.keypressed(key)
if inputReady then
if key == "backspace" then text = string.sub(text,1,string.len(text)-1)
end
elseif key == "a" then inputReady = true
end
end
This code is roughly what i have so far, and ive sure tried a plethora of different workarounds so far, but they all didnt change anything.
function love.load()
text = ""
inputReady = false
end
function love.textinput(t)
if inputReady then
text = text .. t
end
end
function love.draw()
if inputReady then
love.graphics.print(text, 0, 0)
else
love.graphics.print("press a to start typing",0,0)
end
end
function love.keyreleased(key)
if inputReady then
if key == "backspace" then
text = string.sub(text,1,string.len(text)-1)
end
elseif key == "a" then
inputReady = true
end
end