
Look at the horizontal 8-pixel row shown below. This block sets the
first two pixels to background color, the second two pixels to Multi-Color
1, the third two pixels to Sprite Color and the fourth two pixels to Multi-
Color 2. The color of each PAIR of pixels depends on which bits in
each pair are solid and which are blank, according to the illustration
above. After you determine which colors you want in each pair of pixels,
the next step is to add the values of the solid pixels in the 8-pixel block,
and POKEthat number into the proper memory location. For example, if
the 8-pixel row shown below is the first block in a sprite which begins at
memory location 832, the value of the solid pixels is 16+8+2+1
= 27,
so you would POKE 832,27.
27
, 16 + 8 + 2 + l'
I 8 I 4 I 2 I 1 I
COLLISION:
You can detect whether a sprite has collided with another sprite by
using this line: IF PEEK(V+30)ANDX=XTHEN [insert action here]. This line
checks to see if a particular sprite has collided with ANY OTHERSPRITE,
where X equals 1 for sprite 0, 2 for sprite 1, 4 for sprite 2, 8 for sprite 3,
16 for sprite 4, 32 for sprite 5, 64 for sprite 6, and 128 for sprite 7. To
check to see if the sprite has collided with a "BACKGROUND
CHAR-
ACTER" use this line: IF PEEK(V+3l)ANDX=XTHEN [insert action here].
180 PROGRAMMING GRAPHICS
Komentáře k této Příručce