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

DIRECT mode, if you RUN your program the sprite will return to its origi- nal color (white).

LINE 70, determines the HORIZONTAL or "X" POSITION of the sprite on the screen. This number represents the location of the UPPER LEFT CORNER of the sprite. The farthest left horizontal (X) position which you can see on your television screen is position number 24, although you can move the sprite OFF THE SCREEN to position number 0.

LINE 80 determines the VERTICAL or "Y" POSITION of the sprite. In this program, we placed the sprite at X (horizontal) position 24, and Y (vertical) position 100. To try another location, type this POKE in DIRECT mode and hit <RETURN>:

   POKE V,24:POKE V+1,50
This places the sprite at the upper left corner of the screen. To move the sprite to the lower left corner, type this:
   POKE V,24:POKE V+1,229
Each number from 832 to 895 in our sprite 0 address represents one block of 8 pixels, with three 8-pixel blocks in each horizontal row of the sprite. The loop in line 80 tells the computer to POKE 832,255 which makes the first 8 pixels solid . . . then POKE 833,255 to make the second 8 pixels solid, and so on to location 894 which is the last group of 8 pixels in the bottom right corner of the sprite. To better see how this works, try typing the following in DIRECT r-node, and notice that the second group of 8 pixels is erased:
   POKE 833,0 (to put it back type POKE 833,255 or RUN your program)
The following line, which you can add to your program. erases the blocks in the MIDDLE of the sprite you created:
   90 FOR A=836 TO 891 STEP 3:POKE A,O:NEXT A
Remember, the pixels that make up the sprite are grouped in blocks of eight. This line erases the 5th group of eight pixels (block 836) and every third block up to block 890. Try POKEing any of the other numbers from 832 to 894 with either a 255 to make them solid or 0 to make them blank.
[Prev] [Next] [Contents] [Commodore] [New] [Search] [Home]
This page has been created by Sami Rautiainen.
Read the small print. Last updated May 12, 2002.