Matt is describing an approach where you use sprite:setImage()
and either lockFocus
or pushContext()
to draw into that image. That's what I do most of the time. Another approach is to put your drawing calls inside the sprite:draw()
function.
Here's a complete example. I tried to comment the code to explain how it all works. After launching it, press A to show the textbox. It currently draws one letter per frame; you could base it on a timer instead. I hope this helps!
typewriter.zip (9.0 KB)