Step 3: Line Breaks

Test your application. Anything look familiar?


It is our two old friends Carriage Return (known as \r) and Line Break (known as \n) being displayed as "AA". Create the following event to add line break functionality:
When the current character is \r, the Character object just created will have an ID value of -1. This is because the Find function returns -1 when it can't find the substring, which in our case is \r, which does NOT appear in CharSheet.

So, first thing we do is move the Blitter object back to the X Margin and down 20 pixels. We also add 1 to Blit Line, which is copied to the Line ID value of each Character object as we create it. This way each Character object has a record of which line it was created on.

It is neccessary that each Character object holds this value so that we may change the animation of the appropriate Character objects when the different menu items are highlighted.

All \r Character objects will be displayed as "A", as shown in the picture above, so we must destroy them. The thing is, an object is not destoryed until the entire fast loop is over. This is a problem because on every loop while a Character object exists with an ID value of -1 our code will think there is a line break, so we must set the ID to any value other than -1, we will use 0.

You will also remember that after every \r, there follows a \n. By adding 1 to the loopindex, we skip the \n and resume blitting at the next character.

6