[Prev] [Next] [Contents] [Commodore] [New] [Search] [Home]

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 POKE that 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.

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 OTHER SPRITE, 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 CHARACTER" use this line: IF PEEK(V+31)ANDX=XTHEN [insert action here].


[Prev] [Next] [Contents] [Commodore] [New] [Search] [Home]
This page has been created by Sami Rautiainen.
Read the small print. Last updated December 11, 2002.