home *** CD-ROM | disk | FTP | other *** search
-
- PEEKs, POKEs, and SYSes -- Part 19
-
-
- by Jimmy Weiler
-
-
-
-
-
- We still need to tell VIC what color
-
- to make our sprite. Memory locations
-
- V+39 to V+46 are for sprite color.
-
- Use the same color values you normally
-
- use in basic -- 0 = black; 1 = white;
-
- etc.
-
-
- 190 POKE V+39,7
-
-
- This will make our umbrella sprite
-
- yellow.
-
-
- What about size? We have four
-
- options. We can expand it vertically,
-
- or horizontally, or both, or neither.
-
- To expand it vertically, set the
-
- corresponding bit in V+23. To expand
-
- horizontally, use V+29. Let's expand
-
- our umbrella in both directions.
-
-
- 200 POKE V+23,PEEK(V+23) OR 1
- 210 POKE V+29,PEEK(V+29) OR 1
-
-
- The OR 1 in these statements makes
-
- sure that we change only the value of
-
- bit one of bytes V+23 and V+29. We
-
- wouldn't want to unexpectedly expand
-
- one of the other sprites.
-
-
- To make your sprite go behind text
-
- on the screen, put a 1 in the
-
- corresponding bit of V+27. A 0 will
-
- make your sprite cover the text.
-
-
- 220 POKE V+27,PEEK(V+27) AND 254
-
-
- Now we're almost done. All we have
-
- to do is make the sprite visible.
-
- V+21 is the location for that. As
-
- usual, each bit of byte V+21
-
- corresponds to the sprite of the same
-
- number.
-
-
- 230 POKE V+21,PEEK(V+21) OR 1
-
-
- At last we're ready for some
-
- animation. Let's keep it simple.
-
- We'll just let the umbrella drop from
-
- the top of the screen to the bottom.
-
-
- 300 FOR VP = 50 TO 230 STEP .2
- 310 POKE V+1,VP
- 320 NEXT
-
-
- Well, that works fine, but it's not
-
- much fun. Let's see if we can spice
-
- it up a little.
-
-
- First, add a sprite image of a
-
- closed umbrella:
-
-
- 111 DATA 0,24,0,0,24,0,0,24,0,0,60,0,
- 0,60,0,0,60,0,0,126,0,0,126,0
- 112 DATA 0,126,0,0,255,0,0,24,0,0,24,
- 0,0,24,0,0,24,128,0,14,0,0,0,0,0,0,0,0
- 113 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0
- 114 FOR BL = 896 TO 896 + 62
- 115 READ D
- 116 POKE BL,D
- 117 NEXT BL
-
-
- This code will POKE the image into
-
- sprite page 14. Next we add code to
-
- make the closed umbrella jump back up
-
- to the top of the screen.
-
-
- 325 POKE 2040,14:rem sprite 1 = pg 14
- 330 FOR VP = 230 TO 50 STEP -2
- 340 POKE V+1,VP
- 350 NEXT
- 370 GOTO 120
-
-
- Not bad.... with a little work
-
- someone could make a game out of this.
-
-
- >For those of you who don't like to
- type that much, this entire program
- is on SIDE 2 of LOADSTAR 8. It is
- saved under the name UMBRELLA DEMO.
-
-
- ---------- End of Article ------------
-