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


CRUNCH YOUR PROGRAM INTO A SMALLER SPACE BY RUNNING TOGETHER ALL THE DATA STATEMENTS, AS SHOWN IN THE SAMPLE PROGRAM BELOW. Note that we asked you to write your sprite program on a piece of paper. We did this for a good reason. The DATA STATEMENT LINES 100-120 in the program in STEP 1 are only there to help you see which numbers relate to which groups of pixels in your sprite. Your final program should be "crunched" like this:

 10 PRINT"{CLEAR}":POKE53280,5:POKE53281,6
 20 V=53248:POKEV+34,3
 30 POKE 53269,4:POKE2042,13
 100 DATA255,255,255,128,0,1,128,0,1,128,0,1,144,0,1,144,0,1,144,0,1,144,0
 101 DATA1,144,0,1,144,0,1,144,0,1,144,0,1,144,0,1,144,0,1,128,0,1,128,0,1
 102 DATA128,0,1,128,0,1,128,0,1,128,0,1,255,255,255
 200 X=200:Y=100:POKE53252,X:POKE53253,Y


Now that you've created your sprite, let's do some interesting things with it. To move your sprite smoothly across the screen, add these two lines to your program:

   50 POKE V+5,100:FOR X=24TO255:POKE V+4,X:NEXT:POKE V+16,4
   55 FOR X=0TO65:POKE V+4,X:NEXT X:POKE V+16,0:GOTO 50

LINE 50 POKEs the Y POSITION at 100 (try 50 or 229 instead for variety). Then it sets up a FOR... NEXT loop which POKEs the sprite into X position 0 to X position 255, in order. When it reaches the 255th position, it POKEs the RIGHT X POSITION (POKE V+16,4) which is required to cross to the right side of the screen.

LINE 55 has a FOR... NEXT loop which continues to POKE the sprite in the last 65 positions on the screen. Note that the X value was reset to zero but because you used the RIGHT X setting (POKE V+16,2) X starts over on the right side of the screen.

This line keeps going back to itself (GOTO 50). If you just want the sprite to move ONCE across the screen and disappear, then take out GOTO50.

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