Step 2: Blitting the Characters

This is where the magic happens! While there is text to blit, this event will continue to loop, creating a new Character object and changing it to the appropriate animation frame. There is a lot happening here, so I will break it down and explain the purpose of each action. Remember, MMF2 executes actions sequentially and the order is very important. You can change the order of your actions from the Event List Editor (press Ctrl+L).

This simply creates a new Character object at the co-ordinates of the Blitter object.

This action uses the Mid$ function to isolate the current character we are blitting. Mid$ is a function which returns a specified number of characters from within a string. Mid$ requries 3 parameters:

Parameter Description In our case...
String The string from which characters are returned. Text("Blitter")
Start Specifies the starting position. CurrentPosition("Blitter")
Length Specifies the number of characters to return. 1

So, Mid$(string, start, length) becomes Mid$(Text( "Blitter" ), CurrentPosition( "Blitter" ), 1)

This action uses the Find function to retrieve the numeric position of the CurrentCharacter within the CharSheet. The animation frame is then set to this value. Remember CharSheet is a string containing every possible character and in the same order as the animation frames. Find is a function which retrieves the numeric position of a smaller string within a larger string. It also requires 3 parameters:

Parameter Description In our case...
String The larger string you are searching. CharSheet("Blitter")
Query The smaller string you are searching for. CurrentCharacter("Blitter")
Start Specifies the starting position. 0

So, Find(string, query, start becomes Find(CharSheet( "Blitter" ), CurrentCharacter( "Blitter" ), 0)

This action stores the value returned from the Find function in each Character object as we create it. You will see why in the next step.

This action moves the Blitter object to the right edge of the Character object it just created.
X Right is an MMF2 expression which returns the x co-ordinate at the right-most edge of an object.

We are using the CurrentPosition value to keep track of which character we are blitting. So everytime we parse a character, we must add 1 to this value.

5