A86: Re: Sprite Terms


[Prev][Next][Index][Thread]

A86: Re: Sprite Terms




Check out the sprite tutorials on 86 Central, it's all explained.  In the
future I might add a section on writing putsprite routines, as it's not as
hard as I'd always thought it was.

Clipping comes from (I imagine) cropping photographs or other images to fit
inside something.  Say you have a picture and are putting it on a piece of
paper, but it's too big.  So you clip the edges with scissors so it fits on
the page.

You can do the same with sprites.  If you have a sprite that needs to be
drawn halfway off the screen, you can't just draw the whole thing, without
it getting messed up (well, actually, you CAN, if you want to have a big
buffer, but that's another story :)  So you need to clip the side(s) of the
sprite that will be off the screen.  There are many ways to accomplish this.
But the bottom line is that the parts that are off the screen (read:
shouldn't be drawn) aren't drawn.

Masked sprites is another term for transparent sprites.  The term masked is
probably be used because transparency is always done using a mask (I've seen
some graphics books suggest rle encoding the transparency, but this would be
slow in asm using the 86's display memory configuration).

Sprite masking can be done for both b/w sprites and grayscale.  When drawing
a sprite, some parts of it will be white.  But the question is, should they
be white, or transparent?  In most cases, you will want both.  An example of
where sprite masking is very badly needed but absent is the Zelda Demo for
the 82/83/86.  You'll notice that only black pixels are drawn and everything
else is transparent, meaning the background shows through.  This makes it
look pretty bad, especially when walking over sand or whatever.  The
background shouldn't show through the player.

So you want parts inside the player to be white.  But then again, you don't
want the area inside the sprite but outside the player's body to be white,
because then you'd have an invisible square moving around the player.  Not
good.  So that needs to be transparent.  The easiest way to do this is to
have a transparency mask.  Simply put, if the bit is on in the transparency
mask, it will be drawn.  If it is off, it will not be drawn.  The Assembly
Studio 86 sprite editor allows for masked sprites, and if you're having
trouble visualizing what a sprite will look like when drawn and when in .db
form, play with it's sprite editor.

It is worth noting that for masked sprites, it might be advantageous to
store the masks inverted, because you usually end up doing that in the
putsprite routine anyway.  And when using grayscale sprites, the same mask
can be used for both layers of the sprite (whether interleaved or not).

>
> what does it mean to clip a sprite?  what do some of the other names like
> 'mask' a sprite and stuff like that mean?
>
> jimi




References: