
STEP 8:
CRUNCH YOUR PROGRAM INTO A SMALLER SPACE BY RUNNING TO-
GETHER ALL THE DATA'STATEMENTS, AS SHOWN IN THE SAMPLE PRO-
GRAM 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 thereto help you. see
which numbers relate to which 'groups of pixels in your sprite. Your final
program should be "crunched" like this:
~S!iImm
1121"PRHlT":J" :'POI<E53280, 5: POKE53281., 6
2(1 V=5::::24:3: POKEV+34,. 3
30 POKE53269., 4 : POKE2042, 13
4121FOF.:I'I=0T062: READQ : POKE832+t.j, Q : NEi':T
100 DATA255,255,255,128,(I,1,128,0,1,128,O.I,144,(I,
1,144,0,1..144,0,1,144,(1,1
101 DATAL44,0,1,144~0,1,144,O,1,144,e,I,144,0,1,
144, 0., 1.' 12:::., (I, L 128, 0, 1
11212DI=tTAI28, 10,1.,128.,121,1,128.,.(1,1.,128.. e.. 1..255.. 255, 25~l
20tt ;<:=200: ITI=100 : POI<E53252., :x:: POKE53253., IT'
MOVING YOUR SPRITE ON THE SCREEN
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=24T0255:POKE V+4,X:NEXT:POKE
V+16,4'
55 FOR X=OT065: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 re-
quired to'cross to' the riglit.side of the s<:reen.
LINE55 hasa FOR. . . NEXTloop which continues to POKEthe sprite
in.the last 65 positions on the screen. Note that the X value was reset to
zero but because you. used the RIGHTX 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
GOT050.
PROGRAMMINGGRAPHICS 165.
Komentáře k této Příručce