Moving Sprites With Movspr - Commodore 128 System Manual

Hide thumbs Also See for 128:
Table of Contents

Advertisement

Here's what each of the numbers in the SPRITE statements
mean:
SPRITE #,0,C ,P ,X ,Y ,M
# — Sprite number (1 to 8)
0 — Turn On (0 = 1 ) or Off (0 = 0 )
C - Color (1 to 16)
P— Priority—
If P = 1, sprite is behind objects on the screen
X — If X = 1 , expand sprite in horizontal (X) direction
If X=0, sprite is normal horizontal size
Y— If Y = 1 , expand sprite in vertical (Y) direction
If Y=0, sprite is normal vertical size
M — If M = 1 , sprite is multicolor
If M=0, sprite is standard
As you can see, the SPRITE statement is powerful, giving you
control over many sprite qualities.

Moving Sprites with MOVSPR

Now that your sprite is on the screen, all you have to do is move
it. The MOVSPR statement controls the motion of a sprite and
allows you to animate it on the screen. The MOVSPR statement
can be used in two ways. First, the MOVSPR statement can place
a sprite at an absolute location on the screen, using vertical and
horizontal coordinates. Add the following statements to your
program:
70 MOVSPR 1,240,70:REM POSITION SPRITE 1—X=240,
Y=70
80 MOVSPR 2,120,70:REM POSITION SPRITE 2—X=120,
Y=70
Line 70 positions sprite 1 at sprite coordinate 240,70. Line 80
places sprite 2 at sprite coordinate 120,70. You can also use the
MOVSPR statement to move sprites relative to their original
positions. For example, place sprites 1 and 2 at the coordinates
as in lines 70 and 80. You want to move them from their original
locations to another location on the screen. Use the following
statement to move sprites along a specific route on the screen:
85 MOVSPR 1,180 # 6:REM MOVE SPRITE 1 FROM THE
TOP TO THE BOTTOM
87 MOVSPR 2,180 # 7:REM MOVE SPRITE 2 FROM THE
TOP TO THE BOTTOM
If P=0, sprite is in front of objects on the screen
6-21

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

128d

Table of Contents