1. Draw a picture on the screen with Commodore 128 graphics
statements, such as DRAW, BOX and PAINT, just as you did
in the raceway program in the last section. This time, make
the picture twice as large as a single sprite with the
dimensions 48 pixels wide by 21 pixels tall.
2. Use two SSHAPE statements to store the sprites into two
separate data strings. Position the first SSHAPE statement
coordinates over the 24 by 21 pixel area of the first half of the
picture you drew. Then position the second SSHAPE
statement coordinates over the second 24 by 21 pixel area.
Make sure you store each half of the picture data in a
different string. For example, the first SSHAPE statement
stores the first half of the picture into A$, and the second
SSHAPE statement stores the second half of the picture in
B$.
3. Transfer the picture data from each data string into a
separate sprite with the SPRSAV statement.
4. Turn on each sprite with the SPRITE statement.
5. Position the sprites so the beginning of one sprite starts at the
pixel next to where the first sprite ends. This is the step that
actually joins the sprites. For example, draw a picture 48 by
21 pixels. Position the first sprite (1, for example) at location
10,10 with this statement:
100 MOVSPR 1,10,10
where the first number is the sprite number, the second number
is the horizontal (X) coordinate and the third number is the
vertical (Y) coordinate. Position the second sprite 24 pixels to the
right of sprite 1 with this statement:
200 MOVSPR 2,34,10
At this point, the two sprites are displayed directly next to each
other. They look exactly like the picture you drew in the beginning
of the program, using the DRAW, BOX and PAINT statements.
6. Now you can move the sprites any way you like, again using
the MOVSPR statement. You can move them together along
the same path or in different directions. As you learned in the
last section, the MOVSPR statement allows you to move
sprites to a specific location on the screen, or to a location
relative to the sprite’s original position.
6-29