
256 (on the left side of the screen), then the X MSB of that sprite must
be 0 (turned OFF). Bits 0 to 7 of the X MSB register correspond to sprites
o to 7, respectively.
The following program moves a sprite across the screen:
EXAMPLE:
--IDIIiI"
10 PF.:It-IT"::T'-
20 F'OKE2040.13
30 FORI=0T062:POKE832+I.129:NEXT
40 ..,.=5:324:3
50 POKE'.'!+21,. 1
6121POKE"'!+3S<..1
70 POKEV+ 1 " 1121(1
8121FOF(J=!3TOcH7
90 HX=INTeJ/256)'LX=J-256*HX
100 POKEV.LX:POKEV+16.HX:NE~T
When moving expanded sprites onto the left side of the screen in the
X direction, you have to start the sprite OFF SCREENon the RIGHTSIDE.
This
is because an expanded sprite is larger than the amount of space
available on the left side of the screen.
EXAMPLE:
,ABI"
1121pF.:nn":J"
2(1 F'OKE2!~140.
13
30
FORI=0T062:POKE832+I.129:NEXT
4121 \.':=::5::':248
50 POKE','!+21" 1
60
POKEV+39.1:POKEV+23.1:POKEV+29.1
70 POKE'.,!+1 . 10(~
:3121J~48:::
90 HX=INTeJ/256):LX=J-256*HX
100 POKEV,LX:POKEV+16.HX
110 J=J+l:IFJ)511THENJ=0
120 IFJ)4880RJ<348GOT090
The charts in Figure 3-3 explain sprite positioning.
By using these values, you can position each sprite anywhere. By mov-
ing the sprite a single dot position at a time, very smooth movement is
easy to achieve.
142 PROGRAMMING GRAPHICS
Komentáře k této Příručce