
than enough register locations to handle moving a sprite up and down.
You also want to be able to smoothly move a sprite on and off the
screen. More than 200 values are needed for this.
The first on-screen value from the top of the screen, and in the Y
direction for an unexpanded sprite is 30. For a sprite expanded in the Y
direction it would be 9. (Since each dot is twice as tall, this makes a
certain amount of sense, as the initial position is STILLcalculated from
the top left corner of the sprite.)
The first Y value in which a sprite (expanded or not) is fully on the
screen (all 21 possible lines displayed) is 50.
The last Y value in which an unexpanded sprite is fully on the screen is
229. The last Y value in which an expanded sprite is fully on the screen
is 208.
The first Y value in which a sprite is fully off the screen is 250.
EXAMPLE:
---mD~
1121PRnn":T - :REt'1 CLEAF.: SCF.:EEt,1
20 POKE2040 , 13 :REM GET SPRITE 0
DATA FROM BLOCK 13
30 FORI=OT062:POKE832+I,129'NEXT:REM POKE SPRITE
DATA INTO BLOCK 13 (13*64=832)
40 V=53248 :REM SET BEGINNING
OF VIDEO CHIP
5121POKEV+21" 1 :F.'Et1 EI"IABLE ~;PRITE
1
60 pm~E""'+:39., 1
COLOR
71<:1POKE '+ 1 " 11210
'T' POSITIO~I
80 POKEV+16,0:POKEV,100
>': POSITION
:REM SET SPRITE (1
:REM SET SPRITE 0
:REM SET SPRITE 121
HORIZONTAL POSITIONING
Positioning in the horizontal direction is more complicated because
there are more than 256 positions. This means that an extra bit, or 9th
bit is used to control the X position. By adding the extra bit when neces-
sary a sprite now has 512 possible positions in the left/right, X, direc-
tion. This makes more possible combinations than can be seen on the
visible part of the screen. Each sprite can have a position from 0 to 511.
However, only those values between 24 and 343 are visible on the
screen. If the X position of a sprite is greater than 255 (on the right side
of the screen), the bit in the X MOST SIGNIFICANTBITPOSITION register
must be set to a 1 (turned ON). If the X position of a sprite is less than
PROGRAMMINGGRAPHICS 139
Komentáře k této Příručce