Step 4: Stop Blitting
If you test the application, you will see line breaks are now recognized. However, the blitting continues passed the final character, each time displaying an "A".
This time the "A" is caused by something different. When the mid$ function is asked to retrieve a character outside the length of the string, then "" is returned and using Find to find "" in CharSheet will also return -1.
All we need to do is stop blitting once we reach the final character. The CurrentPosition of the final character is equal to the length of Text. The Len function is used to retrieved the length of a string.
- CurrentPosition of
= Len(Text( "
" ))
: Set Text to ""


For a more advanced text blitting engine supporting multiple tilesets, variable speeds and word wrapping, see the Examples page. There are also two more text blitting tutorials on the Tutorials page.
7