'Program Name : Ship2.bas 'Author : Lloyd L. Smith 'Date - Last Rev : 12-21-92 'Description : Sprite movement in PowerBASIC ' : Quick Annimation Program, can be improved greatly. DIM Array1(2000) DIM Array2(2000) dim a$(40) 'for i=1 to 40:a$(i)=space$(32):next i Restore Ship:for i=1 to 20: read a$(i):next i dsp=0 screen 9,,0,0 hs=3 'Horz Size vs=2 'Vert Size ho=4 'Horz Offset vo=4 'Vert Offset gosub ShipUpMk hs=3:vs=2:ho=4:vo=4 gosub ShipDnMk cls d=1 Idle: k$ = UCASE$(INKEY$): IF k$ = CHR$(27) THEN SYSTEM gosub movchar FOR Dly = 1 TO 500: NEXT Dly if vos>275 then d=0 if vos<3 then d=1 GOTO Idle end ShipUpMk: for j=1 to 20 for i=1 to len(a$(j)) if mid$(a$(j),i,1)="K" then fg=0 'K 0 black if mid$(a$(j),i,1)="B" then fg=1 'B 1 Blue if mid$(a$(j),i,1)="G" then fg=2 'G 2 Green if mid$(a$(j),i,1)="C" then fg=3 'C 3 Cyan if mid$(a$(j),i,1)="R" then fg=4 'R 4 Red if mid$(a$(j),i,1)="M" then fg=5 'M 5 Magenta if mid$(a$(j),i,1)="N" then fg=6 'N 6 Brown if mid$(a$(j),i,1)="W" then fg=7 'W 7 White if mid$(a$(j),i,1)="A" then fg=8 'A 8 Gray if mid$(a$(j),i,1)="b" then fg=9 'b 9 Light Blue if mid$(a$(j),i,1)="g" then fg=10 'g 10 Light Green if mid$(a$(j),i,1)="c" then fg=11 'c 11 Light Cyan if mid$(a$(j),i,1)="r" then fg=12 'r 12 Light Red if mid$(a$(j),i,1)="m" then fg=13 'm 13 Light Magenta if mid$(a$(j),i,1)="y" then fg=14 'y 14 Yellow if mid$(a$(j),i,1)="w" then fg=15 'w 15 Bright White if mid$(a$(j),i,1)=" " then fg=0 if (mid$(a$(j),i,1)=chr$(34)) then fg=0 line(0+ho,0+vo)-(hs+ho,vs+vo),fg,bf ho=ho+2 next i ho=4:n=n+1:vo=vo+2 next j 'line (0,0)-(74,50),12,b x1 = 0: y1 = 0: x2 = 74: y2 = 50 GET (x1, y1)-(x2, y2), Array1 line(x1,y1)-(x2,y2),0,bf return ShipDnMk: Restore Ship for j=20 to 1 step -1 for i= 1 to len(a$(j)) if mid$(a$(j),i,1)="K" then fg=0 'K 0 black if mid$(a$(j),i,1)="B" then fg=1 'B 1 Blue if mid$(a$(j),i,1)="G" then fg=2 'G 2 Green if mid$(a$(j),i,1)="C" then fg=3 'C 3 Cyan if mid$(a$(j),i,1)="R" then fg=4 'R 4 Red if mid$(a$(j),i,1)="M" then fg=5 'M 5 Magenta if mid$(a$(j),i,1)="N" then fg=6 'N 6 Brown if mid$(a$(j),i,1)="W" then fg=7 'W 7 White if mid$(a$(j),i,1)="A" then fg=8 'A 8 Gray if mid$(a$(j),i,1)="b" then fg=9 'b 9 Light Blue if mid$(a$(j),i,1)="g" then fg=10 'g 10 Light Green if mid$(a$(j),i,1)="c" then fg=11 'c 11 Light Cyan if mid$(a$(j),i,1)="r" then fg=12 'r 12 Light Red if mid$(a$(j),i,1)="m" then fg=13 'm 13 Light Magenta if mid$(a$(j),i,1)="y" then fg=14 'y 14 Yellow if mid$(a$(j),i,1)="w" then fg=15 'w 15 Bright White if mid$(a$(j),i,1)=" " then fg=0 if (mid$(a$(j),i,1)=chr$(34)) then fg=0 line(0+ho,0+vo)-(hs+ho,vs+vo),fg,bf ho=ho+2 next i ho=4:n=n+1:vo=vo+2 next j 'line (0,0)-(74,50),12,b x1 = 0: y1 = 0: x2 = 74: y2 = 50 GET (x1, y1)-(x2, y2), Array2 line(x1,y1)-(x2,y2),0,bf return MovChar: IF Dsp = 1 THEN SCREEN 9, , 1, 0 LINE (x1 , y1+vos)-(x2 + 10, y2+vos), 0, BF if d=1 then vos = vos + 3 if d=0 then vos = vos - 3 if d=1 then PUT (x1 , y1+vos), Array2 , XOR if d=0 then PUT (x1 , y1+vos), Array1 , XOR SCREEN 9, , 0, 1 'now display the back ground screen Dsp = 0 ret = 1 END IF IF ret = 1 THEN ret = 0: RETURN IF Dsp = 0 THEN SCREEN 9, , 0, 1 LINE (x1, y1+vos)-(x2 + 10, y2+vos), 0, BF if d=1 then vos = vos + 3 if d=0 then vos = vos - 3 if d=1 then PUT (x1 , y1+vos), Array2 , XOR if d=0 then PUT (x1 , y1+vos), Array1 , XOR SCREEN 9, , 1, 0 Dsp = 1 END IF RETURN Ship: data " bb " data " BBBB " data " BBBB " data " BB " data " AABBAA " data " AGGCCGGA " data " AGGGCCGGGA " data " AGGGGGGGGGGA " data " AGGGGGGGGGGA " data " y AGGGGGGGGGGGGA y " data " ACA AADGGGGGGGGGGRAA ACA " data " ACA AAGGGRGGGmmGGGRGGGAA ACA " data " ACGAAAGGGGGRGGmmmmGGRGGGGGAAAGCA " data " ACGGGGGGGGGGRGmmmmGRGGGGGGGGGGCA " data " GGGGGGGGGGGGRGmGGmGRGGGGGGGGGGGG " data " AACGGGGGGGRGGGGGGGGGGRGGGGGGGCA " data " ACCGGGRRRRRRRRRRRRRRGGGCCA " data " AGGRRRRRAAAAARRRRRRGGA " data " ARRRRAAA AAARRRRA " data " RRyR RyRR "