home *** CD-ROM | disk | FTP | other *** search
/ APDL Public Domain 1 / APDL_PD1A.iso / program / animation / extractor / ChaptrText / Chapter3 < prev    next >
Encoding:
Text File  |  1994-07-20  |  2.7 KB  |  23 lines

  1. Chapter 3.  Using Sprites With Masks
  2. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  3.  
  4. When plotting sprites from machine code in the way used in chapter 2, a rectangle containing the sprite is plotted, but if you are plotting the sprite sphere then you may well wish to plot the sphere itself and not to plot the rectangular background as well.  A method called sprite masking offers a way to achieve this.  The sprite data for a masked sprite (in Acorn format) contains the normal sprite data first and then a mask consisting of values for each pixel telling the system if that pixel is masked (it shows the background pixel) or not (it displays the sprite pixel).
  5.  
  6. The way to give a sprite a mask is probably best explored in !Paint, consulting it's user guide for instruction.
  7.  
  8. In the introduction I mentioned that there are fourteen different mask interlace settings in Extractor and I need to explain what I mean.  The term "mask interlace" means how the sprite data and mask data are interwoven in the extracted data file.  They are also interwoven in the Acorn sprite format but at a very simple level, ie "Sprite then mask".  The extracted data can be interwoven word by word for fast access from machine code, or just the mask or just the sprite etc.  All the options are self-explanatory.  The part of the menu structure concerned with masking is shown below.
  9.  
  10.     Extract ⇨ Manual ⇨ Mask ⇨ {mask selection window}.
  11.  
  12. To select a type of mask interlace click on the diamond icon by the type you wish to use.  Also note that if a sprite has no mask then all the options but for the first one are un-selectable and the first option will be used.
  13.  
  14. Also on this window are two writable icons.  These refer to the number that will be stored in the extracted data to signify whether a pixels mask is on or off, mask on meaning transparent.  The values for these are restricted by the mode of the sprite, for modes 9 and 12 the values must be between 0 and 15 and for mode 13 and 15 the values must be between 0 and 255.  Always press return after entering a number to allow Extractor to show you if it is acceptable or not.
  15.  
  16. When you have finished altering the masking settings then click on the OK icon.
  17.  
  18. For an example of masking sprites from machine code, first load Extractor and open the 'Examples' directory.  Then load the 'EG Sprs' sprite file into Extractor as before.  Now use the part of the menu structure shown above to set the mask interlace to "1 sprite word then 1 mask word".  Save the extract list file in the 'Examples' directory as 'EGChptr3' and save the raw data file into the same directory under the name 'RawDC3'.  To see the sphere sprite displayed using a mask on top of a multi-coloured background, run the application called '!Chptr3EG'.
  19.  
  20.  
  21. { Continued in Chapter4 }
  22.  
  23.