
This line POKEs V+16 with the number required to "open up" the right
side of the screen. . .the new X position 24 for sprite 0 now begins 24
pixels to the RIGHT of position 255. To check the right edge of the
screen, change line 60 to:
60 POKE V+16,1:POKE V,65:POKE V+l,75
Some experimentation with the settings in the sprite chart will give you
the settings you need to position and move sprites on the left and right
sides of the screen. The section on "moving sprites" will also increase
your understanding of how sprite positioning works.
SPRITE PRIORITIES
You can actually make different sprites seem to move IN FRONT OF or
BEHINDeach other on the screen. This incredible three dimensional illu-
sion is achieved by the built-in SPRITEPRIORITIESwhich determine which
sprites have priority over the others when 2 or more sprites OVERLAPon
the screen.
The rule is "first come, first served" which means lower-numbered
sprites AUTOMATICALLYhave priority over higher-numbered sprites. For
example, if you display sprite 0 and sprite 1 so they overlap on the
screen, sprite 0 will appear to be IN FRONT OF sprite 1. Actually, sprite
o always supersedes all the other sprites because it's the lowest num-
bered sprite. In comparison, sprite 1 has priority over sprites 2-7; sprite
2 has priority over sprites 3-7, etc. Sprite 7 (the last sprite) has LESS
PRIORITYthan any of the other sprites, and will always appear to be
displayed "BEHIND" any other sprites which overlap its position.
To illustrate how priorities work, change lines 50, 60, and 70 in the
program above to the following:
18
20
31Z1
48
5121
68
7121
~
I"'~.":I'IM:I
I .. II' _C:"'-' . ~_r'.'-t'-' C:-. f!"'. '-,IC:'!:':'. ...
P~INT. .V-~3,48.FOR~-o~,T089~.POKE~,~~~.NE0T
FORt1=2048T02042 : POKEM, 13: t.1E:>I,T.
POKEV+21,7
POKEV+39,1:POKEV+40,7:POKEV+41,8
POKEV., 24 : POKEV+ 1 , 5121: pm~E',...+16., (I
POKEV+2.34:POKEV+3,60
POKEV+4,44:PC~EV+5,70
You should see a white sprite on top of a yellow sprite on top of an
orangesprite. Of course, now that you see how priorities work, you can
also MOVE SPRITESand take advantage of these priorities in your ani-
mation.
PROGRAMMING GRAPHICS 161
Komentáře k této Příručce