First time writing my own program, I did a sample program following a video and thought I had a handle on it. But for some reason drawText is persisting the text on screen which is not how I thought it would behave.
Example is this:
cursor_loc_kb starts at 1. So this line which is under playdate.update() originally draws "a" on the screen.
gfx.drawText(string.char(cursor_loc_kb + 96), 5,5);
I have code that changes cursor_loc_kb when the right arrow is pressed. So now it draws "b" on the screen. But the "a" is still there. So it's a "b" on top of an "a". I don't know how to make it disappear. Then if I increase the variable even more, I get the entire alphabet on location 5,5 (illegible because of the overlap).
I tested this out by removing all drawText out of the main update() loop and just put it in an initialize() function that gets called once. That text is all there on screen still (I would assume it would only show up for one frame and then disappear). What am I missing out here?
function playdate.update()
if playdate.buttonJustPressed(playdate.kButtonRight) then
cursor_loc_kb = cursor_loc_kb + 1
end
gfx.drawText(string.char(cursor_loc_kb + 96), 5,5);
gfx.sprite.update()
end