@SPRITE id, filename$[, table]
filename$ and
assigns the identifier id to it.
Supported image formats are PNG, JPEG, BMP, IFF ILBM, and some more
depending on the platform Hollywood is running on. Starting with
Hollywood 4.5, @SPRITE can also open animation formats (IFF ANIM,
GIF ANIM, uncompressed AVIs or AVIs using Motion JPEG compression) and
convert these animations into a sprite directly.
The third argument is optional. It is a table that can be used to set further options for the loading operation. The following fields of the table can be used:
Transparency:
LoadAlpha:True if the alpha channel of the image
shall be loaded, too. Please note that not all pictures have
an alpha channel and that not all picture formats are capable
of storing alpha channel information. It is suggested that
you use the PNG format if you need alpha channel data. This
field defaults to False.
Link:False if you do not want to have this sprite
linked to your executable/applet when you compile your script.
This field defaults to True which means that the sprite is linked
to your to your executable/applet when Hollywood is in compile mode.
X, Y, Width, Height, Frames, FPR:@SPRITE create a sprite with multiple
frames from a single picture. Width and Height define the dimensions
for the sprite and Frames specifies how many frames @SPRITE shall read
from the source image. If the frames are aligned in multiple rows in
the source image, you will also have to pass the argument FPR (stands
for frames per row) to tell @SPRITE how many frames there are in each
row. Finally, you can tell @SPRITE where in the image it should start
scanning by specifying the fields X and Y (they both default to 0).
@SPRITE will then start off at position X and Y and read Frames number
of images with the dimensions of Width by Height from the picture
specified by filename$. After it has read FPR number of images, it will
advance to the next row. All of these fields can only be used if you
specify an image file in filename$. If you specify an anim file, they
are ignored.
Loader:
Adapter:
LoadTransparency:True, the monochrome transparency of the image will
be loaded. Please note that this tag is specifically designed for monochrome
transparency channels, i.e. a transparent pen in a palette-based image. If
you want to load the alphachannel of an image, set the LoadAlpha tag to
True. This tag defaults to False. (V6.0)
LoadPalette:True, Hollywood will load the sprite as a palette sprite.
This means that you can get and modify the sprite's palette which is useful
for certain effects like color cycling. You can also make pens transparent using
the TransparentPen tag (see below) or the LoadTransparency tag (see above).
Palette sprites also have the advantage of requiring less memory because 1 pixel
just needs 1 byte of memory instead of 4 bytes for 32-bit images. This tag
defaults to False. (V9.0)
TransparentPen:LoadPalette tag has been set to True (see above), the TransparentPen
tag can be used to define a pen that should be made transparent. Pens are counted
from 0. Alternatively, you can also set the LoadTransparency tag to True
to force Hollywood to use the transparent pen that is stored in the file
(if the file format supports the storage of transparent pens). This tag defaults
to #NOPEN. (V9.0)
UserTags:
Please note that the Transparency, LoadTransparency and LoadAlpha fields are mutually
exclusive. A sprite can only have one transparency setting!
If you want to load sprites manually, please use the LoadSprite() command.
@SPRITE 1, "MySprite.png", {Transparency = #RED}
This loads "MySprite.png" as sprite 1 with the color red being transparent.
@SPRITE 1, "PlayerSprites.png", {Width = 32, Height = 32,
Frames = 16, FPR = 8, Transparency = #BLACK}
The code above creates sprite 1 from the file "PlayerSprites.png".
Sprite 1 will be of the dimensions 32x32 and will contain 16 different
frames. The single frames are aligned with 8 frames per row in the
image "PlayerSprites.png". Thus, @SPRITE needs to scan two rows to
read the full 16 frames.