Saving The Picture Data In A Sprite; Turning On Sprites - Commodore 128 System Manual

Hide thumbs Also See for 128:
Table of Contents

Advertisement

Make sure you position the SSHAPE statement directly on the
correct coordinate. Also, be sure to create the picture with the
dimensions 24 pixels wide by 21 pixels tall, the size of a single
sprite.
The SSHAPE statement transforms the picture of the racing car
into a data string that the computer interprets as picture data. The
data string, A$, stores a string of zeros and ones in the
computer's memory that make up the picture on the screen. As in
all computer graphics, the computer has a way it can represent
visual graphics with bits in its memory. Each dot on the screen,
called a pixel, has a bit in the computer's memory that controls it.
ln standard bit-map mode, if the bit in memory is equal to a 1
(on), then the pixel on the screen is turned on. If the controlling bit
in memory is equal to a 0 (off), then the pixel is turned off.

Saving the Picture Data in a Sprite

Your picture is now stored in a string. The next step is to transfer
the picture data from the data string (A$) into the sprite data area
so you can turn it on and animate it. The statement that does this
is SPRSAV. Here are the statements:
50 SPRSAV A$,1:REM STORE DATA STRING IN SPRITE 1
55 SPRSAV A$,2:REM STORE DATA STRING IN SPRITE 2
Your picture data is transferred into sprite 1 and sprite 2. Both
sprites have the same data, so they look exactly the same. You
can't see the sprites yet, because you have to turn them on.

Turning on Sprites

The SPRITE statement turns on a specific sprite (numbered 1
through 8), colors it, specifies its screen priority, expands the
sprite's size and determines the type of sprite display. The screen
priority refers to whether the sprite passes in front of or behind
the objects on the screen. Sprites can be expanded to twice their
original size in either the horizontal or vertical directions. The type
of sprite display determines whether the sprite is a standard bit
map sprite or a multicolor bit mapped sprite. Here are the two
statements that turn on sprites 1 and 2.
60 SPRITE 1,1,7,0,0,0,0:REM TURN ON SPR 1
65 SPRITE 2,1,3,0,0,0,0:REM TURN ON SPR 2
6-20

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

128d

Table of Contents