This line POKEs V+16 with the number required to "open up" the right side of the screen... the new X position 24 for sprite 0 now begins 24 pixels to the RIGHT of position 255. To check the right edge of the screen, change line 60 to:
60 POKE V+16,1:POKE V,65:POKE V+1,75
Some experimentation with the settings in the sprite chart will give you the settings you need to position and move sprites on the left and right sides of the screen. The section on "moving sprites" will also increase your understanding of how sprite positioning works.
You can actually make different sprites seem to move IN FRONT OF or BEHIND each other on the screen. This incredible three dimensional illu- sion is achieved by the built-in SPRITE PRIORITIES which determine which sprites have priority over the others when 2 or more sprites OVERLAP on the screen.
The rule is "first come, first served" which means lower-numbered sprites AUTOMATICALLY have priority over higher-numbered sprites. For example, if you display sprite 0 and sprite 1 so they overlap on the screen, sprite 0 will appear to be IN FRONT OF sprite 1. Actually, sprite 0 always supersedes all the other sprites because it's the lowest num- bered sprite. In comparison, sprite 1 has priority over sprites 2-7; sprite 2 has priority over sprites 3-7, etc. Sprite 7 (the last sprite) has LESS PRIORITY than any of the other sprites, and will always appear to be displayed "BEHIND" any other sprites which overlap its position.
To illustrate how priorities work, change lines 50, 60, and 70 in the program above to the following:
50 POKEV,24:POKEV+1,50:POKEV+16,0 60 POKEV+2,34:POKEV+3,60 70 POKEV+4,44:POKEV+5,70
You should see a white sprite on top of a yellow sprite on top of an orange sprite. Of course, now that you see how priorities work, you can also MOVE SPRITES and take advantage of these priorities in your ani- mation.
|This page has been created by Sami Rautiainen.|
|Read the small print.||Last updated May 12, 2002.|