6. DEFINING SPRITES

6.1 USING THE SPRITE DEFINER


   Sprites are each defined separately, and each is saved as a separate file. It is therefore possible to build up a library of sprites, which can be selected in programs. Instructions on how to load sprites into a program can be found in section 6.2 below.

   Each sprite is defined in two parts, the first being displayed when the X co-ordinate of the sprite's position is even, and the second when it is odd. The purpose of this feature is to allow for the employment of animation techniques, eg. to generate a funning man or flying bird. When using the sprite definer, you can select which is being displayed by typing "1" for part 1 and "2" for part 2. Each is defined on an 8 by 16 grid. Unless the second part is defined, it is assumed to be identical to the first.

   Super sprites have four parts. These should be considered as two pairs (or phases) of normal sprites amalgamated into one. Super sprites are defined by defining two normal sprites, each of which may have two parts as usual. The two normal sprite definitions are saved exactly as for normal sprites. But when they are loaded back into the machine code sprite handler, a different piece of code is used (ie. SS/CODE rather than M/CODE), and the two pairs are saved into it separately. See section 6.2, which gives the load addresses for the two phases of each super sprite.

To define a sprite proceed as follows:

(a)   Load the sprite definer program. Disc users should select it from the menu, and tape users should load it with

   CHAIN "DEFINE"


   It is the fifth file on the cassette.

(b)   Press "1".

(c)   Move the cursor (a small dot in the left-hand grid) by pressing the cursor control keys; and press the relevant function keys to paint the square at the position of the cursor as required. Continue until the sprite is complete.

(d)   If the second part of the sprite is required to be defined differently, then press "2" and repeat (c).

(e)   Press "S" to save the sprite on tape or disc (see the end of this section for more precise details).

(f)   If you are creating a super sprite, repeat (b) to (e) above to generate and save (separately) its second phase.

   Note that you may clear the grid to any chosen colour by selected a with the function keys, and then pressing "C".

Key aloneKey with shift
f0blackblack/white
f1redred/cyan
f2greengreen/magenta
f3yellowyellow/blue
f4blueblue/yellow
f5magentamagenta/green
f6cyancyan/red
f7whitewhite/black

The colours generated with the shift keys and a function key are all flashing colours.

NOTES

The smaller square grid shows the sprite at actual size.

To alter a previously defined sprite, type "L" (for Load), load the sprite, alter it, and save it again.

Saving sprites on tape.

(a)   Make sure that there is a clean part of the tape in the tape recorder. Any tape can be used except the one containing the sprite package.

(a)   Press the S key.

(b)   Type in the name of your SPRITE (up to seven letters).

(c)   Press the RECORD button on your tape-recorder.

(d)   Press RETURN

(e)   After the sprite has been save press the STOP button on your tape-recorder.

Loading sprites from tape back into the definer.

   Once your sprite has been recorded on tape it can be loaded back into the sprite definer program at any time to be altered.

(a)   Load the sprite definer program into your computer.

(b)   Line up the start of the part of the tape on which you have recorded your sprite.

(c)   Press the L key

(d)   Type in the name that you gave to the sprite.

(e)   Press the play button on the tape-recorder.

(f)   After your sprite has loaded press the STOP button on the tape-recorder.

Saving sprites on disc.

(a)   Insert a spare formatted disc into the disc drive. If a double drive is being used, drive 0 should be selected.

(b)   Press the S key.

(c)   Type in the name of your SPRITE (up to seven letters).

Once your sprite has been saved on disc it can be loaded back into the sprite definer program at any time to be altered.

Loading sprites from disc back into the definer

(a)   Load the sprite definer program into your computer.

(b)   Press the L key.

(c)   Type in the name that you gave to the sprite.


6.2 INCORPORATING USER DEFINED SPRITES


   Before you use your sprites in a Basic program they must be placed in the relevant machine code sprite handling routine (M/CODE for normal sprites, SS/CODE for super sprites). This subroutine must then be re-saved containing the new sprites, so that it can run together with the main Basic program. It is advised that the altered program is saved under a different name. The operation should be performed in mode seven, with HIMEM set to &2800 for normal sprites and &2500 for super sprites.

(a)   Type MODE 7: HIMEM = &2800 (or &2500)

(b)   Run the machine code subroutine using:

   *RUN M/CODE   (normal sprites)

   *RUN SS/CODE   (super sprites)


   Cassette users should note that M/CODE is the second file on cassette, and SS/CODE the eighth.

(c)   Load in the require sprites which should have been previously saved on tape or disc by typing:

   *LOAD name nnnn


   where name is the sprite name
   and nnnn is the relevant address (see table below)

Normal spritesspritennnn
number
12800
22880
32900
42980
52A00
62A80
72B00
Super spritesSpritennnnnnnn
number(phase 1)(phase 2)
125002580
226002680
327002780
428002880
529002980
62A002A80
72D002B80

   If you only want to use two sprites in your Basic program for example then only load the two sprites that you require into the machine. The remaining sprites will remain the default designs.

(d)   To re-save the machine code program that now contains the redefined sprites type:-

    *SAVE name 2800 +900 3000 (for normal sprites)


   *SAVE name 2500 +C00 3000 (for super sprites)


   This saved program will now contain the redesigned sprites and can be run exactly as if it were the original M/CODE or SS/CODE.