Commodore 128 Programmer's Reference Manual page 285

Hide thumbs Also See for 128:
Table of Contents

Advertisement

n
11
SPRITES
275
'"I
Here's an explanation of the program:
Line 5 COLORs the background black and the foreground white.
Line 10 selects standard bit map mode and clears the bit map screen.
Lines 17 through 21 DRAW the stars.
Line 23 BOXes in a display area for the picture of the spacecraft in the top-left
corner of the screen.
Line 24 DRAWs and PAINTs the planet.
Line 25 DRAWs the CIRCLES around the planet.
Line 26 DRAWs the outline of the capsule portion of the spacecraft.
Line 28 DRAWs the bottom window of the space capsule.
Line 35 DRAWs the top window of the space capsule.
Line 38 PAINTs the space capsule white.
Line 40 DRAWs the outline of the retro rocket portion of the spacecraft.
Line 42 and 43 DRAW the retro rocket engines on the back of the spacecraft.
Line 44 PAINTs the retro rocket engines and DRAWs an outline of the back of the retro
rocket in the background color.
Line 45 DRAWs lines on the retro rocket portion of the spacecraft in the background
color. (At this point, you have displayed only pictures on the screen. You have
not used any sprite statements, so your rocketship is not yet a sprite.)
Line 47 positions the SSHAPE coordinates above the first half (24 by 21 pixels) of the
capsule of the spacecraft and stores it in a data string, A$.
Line 48 positions the SSHAPE coordinates above the second half (24 by 21 pixels) of
the spacecraft and stores it in a data string, B$.
Line 50 transfers the data from A$ into sprite 1.
Line 55 transfers the data from B$ into sprite 2.
Line 60 turns on sprite 1 and colors it red.
Line 65 turns on sprite 2 and colors it blue.
Line 82 positions sprite 1 at coordinate 150,150.
Line 83 positions sprite 2, 23 pixels to the right of the starting coordinate of
sprite 1.
Lines 82 and 83 actually join the two sprites.
Lines 85 and 87 move the joined sprites across the screen.
Line 90 delays the program. This time, delay is necessary for the sprites to complete the
two trips across the screen. If you leave out the delay, the sprites do not have
enough time to move across the screen.
Lines 92 and 93 position the sprites in the center of the screen, and prepare the
spacecraft to fire the retro rockets.
Line 95 propels sprite 1, the space capsule, forward. The number 10 in line 95 specifies
the speed in which the sprite moves. The speed ranges from 0 (stop ) to 15
(fastest).
Line 96 moves the expired retro rocket portion of the spacecraft backward and off the
screen.

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents