8-Bit Software Online Conversion
:0.$.Heli2 - Listing
10REM Helicopter Holocaust
20REM By Steven Flintham
30PROCSteven:PROCFlintham
40PROCSteven`Flintham(255)
50REPEAT
60MODE 5:VDU 23;8202;0;0;0;
70VDU 19,0,4,0,0,0,19,2,6,0,0,0,19,3,
0,0,0,0:PROCinfo
80PROCkeys
90MODE 5:VDU 23;8202;0;0;0;
100PROCSteven`Flintham(0):PROCinfo
110PROCbackground
120PROCprint`sprite(heli`pos(1),4,19,h
eli(1))
130PROCprint`sprite(heli`pos(2),4,19,h
eli(2))
140REPEAT
150PROCmove`heli1
160PROCmove`heli2
170PROCmove`fire
180PROCmove`fuel`hel
190PROCmove`fuel
200count%=count%-1
210IF count%=0 THEN FOR heli%=1 TO 2:f
uel%(heli%)=fuel%(heli%)-5:NEXT:count%=r
count%:PROCfuel`update
220IF hcount%>0 THEN hcount%=hcount%-1
230IF hcount%<=0 OR (FNfuel`short AND
hcount%<=0) THEN PROCheli`Flintham
240UNTIL FNdead(1,TRUE) OR FNdead(2,TR
UE)
250SOUND &10,0,0,0:PROCSteven`Flintham
(255)
260MODE 5:VDU 23;8202;0;0;0;
270VDU 19,0,4,0,0,0,19,2,6,0,0,0,19,3,
0,0,0,0:PROCinfo
280PROCwinner
290UNTIL FALSE
300END
310DEF PROCenable
320*FX229,0
330*FX4,0
340ENDPROC
350DEF PROCSteven
360*FX229,1
370*FX4,2
380ENDPROC
390DEF PROCFlintham
400ON ERROR MODE 7:REPORT:PRINT " at l
ine ";ERL:PROCenable:END
410DIM fire%(2),dir%(2),lives%(2),fuel
%(2),old`heli(2),heli(2),heli`pos(2),old
`heli`pos(2)
420start%=&70
430start2%=&72
440cols%=&74
450rows%=&76
460data%=&78
470flag%=&7F
480ENDPROC
490DEF PROCmove`heli1
500IF FNcollision(heli`pos(1),4,19,hel
i(1)) THEN PROCdetect(1)
510move%=FALSE
520IF INKEY(-67) THEN PROCheli`left(1)
530IF INKEY(-83) THEN PROCheli`right(1
)
540IF INKEY(-66) THEN PROCheli`up(1)
550IF INKEY(-98) THEN PROCheli`down(1)
560IF move% THEN PROCprint`sprite(old`
heli`pos(1),4,19,old`heli(1)):PROCprint`
sprite(heli`pos(1),4,19,heli(1)):old`hel
i(1)=heli(1):old`heli`pos(1)=heli`pos(1)
570IF FNcollision(heli`pos(1),4,19,hel
i(1)) THEN PROCdetect(1)
580IF INKEY(-2) THEN PROCfire(1)
590ENDPROC
600DEF PROCmove`heli2
610IF FNcollision(heli`pos(2),4,19,hel
i(2)) THEN PROCdetect(2)
620move%=FALSE
630IF INKEY(-103) THEN PROCheli`left(2
)
640IF INKEY(-104) THEN PROCheli`right(
2)
650IF INKEY(-73) THEN PROCheli`up(2)
660IF INKEY(-105) THEN PROCheli`down(2
)
670IF move% THEN PROCprint`sprite(old`
heli`pos(2),4,19,old`heli(2)):PROCprint`
sprite(heli`pos(2),4,19,heli(2)):old`hel
i(2)=heli(2):old`heli`pos(2)=heli`pos(2)
680IF FNcollision(heli`pos(2),4,19,hel
i(2)) THEN PROCdetect(2)
690IF INKEY(-74) THEN PROCfire(2)
700ENDPROC
710DEF PROCprint`sprite(at%,col%,row%,
add%)
720?start%=at% MOD 256
730start%?1=at% DIV 256
740?cols%=col%
750?rows%=row%
760?data%=add% MOD 256
770data%?1=add% DIV 256
780CALL &4F00
790ENDPROC
800DEF FNcollision(at%,col%,row%,add%)
810?start%=at% MOD 256
820start%?1=at% DIV 256
830?cols%=col%
840?rows%=row%
850?data%=add% MOD 256
860data%?1=add% DIV 256
870CALL &4F69
880=(?flag%=255)
890DEF PROCheli`left(heli%)
900IF heli%=1 THEN IF heli(1)=&C00 THE
N heli(1)=&C50:move%=TRUE:ENDPROC
910IF heli%=2 THEN IF heli(2)=&CA0 THE
N heli(2)=&A00:move%=TRUE:ENDPROC
920IF (heli`pos(heli%)-&5800) MOD &140
>0 THEN heli`pos(heli%)=heli`pos(heli%)-
8
930move%=TRUE
940ENDPROC
950DEF PROCheli`right(heli%)
960IF heli%=1 THEN IF heli(1)=&C50 THE
N heli(1)=&C00:move%=TRUE:ENDPROC
970IF heli%=2 THEN IF heli(2)=&A00 THE
N heli(2)=&CA0:move%=TRUE:ENDPROC
980IF (heli`pos(heli%)-&5920) MOD &140
>0 THEN heli`pos(heli%)=heli`pos(heli%)+
8
990move%=TRUE
1000ENDPROC
1010DEF PROCheli`up(heli%)
1020IF (heli`pos(heli%)-&5800)>=(&140*6
) THEN heli`pos(heli%)=heli`pos(heli%)-&
140
1030move%=TRUE
1040fuel%(heli%)=fuel%(heli%)-2
1050PROCfuel`update
1060ENDPROC
1070DEF PROCheli`down(heli%)
1080IF (heli`pos(heli%)-&5800)<&2440 TH
EN heli`pos(heli%)=heli`pos(heli%)+&140
1090move%=TRUE
1100ENDPROC
1110DEF PROCSteven`Flintham(heli%)
1120fheli%=0:hcount%=300:shcount%=hcoun
t%
1130efuel%=0:fuelc%=3:mfuelc%=fuelc%
1140fire%(1)=0:fire%(2)=0
1150fuel%(1)=496:fuel%(2)=496:mfuel%=fu
el%(1)
1160lives%(1)=3:lives%(2)=3
1170count%=10:rcount%=count%
1180VDU 19,2,6,0,0,0,19,0,4,0,0,0
1190VDU 19,3,0,0,0,0
1200PROClife`Flintham(heli%)
1210ENDPROC
1220DEF PROClife`Flintham(heli%)
1230IF heli%=2 THEN GOTO 1260
1240old`heli(1)=&C00:heli(1)=&C00
1250heli`pos(1)=&6100:old`heli`pos(1)=&
6100
1260IF heli%=1 THEN GOTO 1290
1270old`heli(2)=&A00:heli(2)=&A00
1280heli`pos(2)=&61A0:old`heli`pos(2)=&
61A0
1290IF heli%<>255 THEN SOUND &10,0,0,0:
SOUND 0,-15,3,255
1300ENDPROC
1310DEF FNdead(heli%,crash%)
1320IF lives%(heli%)<=0 THEN =TRUE
1330IF fuel%(heli%)>0 THEN =FALSE
1340IF NOT crash% THEN =TRUE
1350PROCcrash(heli%)
1360=TRUE
1370DEF PROCinfo
1380GCOL 0,3:MOVE 0,896:DRAW 1280,896
1390MOVE 640,896:DRAW 640,1024
1400PROCprint`sprite(&5800,4,19,&C00)
1410PROCfuel`update
1420PRINTTAB(2,0);"Lives:";lives%(1)
1430PROCprint`sprite(&5920,4,19,&A00)
1440PRINTTAB(11,0);"Lives:";lives%(2)
1450ENDPROC
1460DEF PROCfuel`update
1470PRINTTAB(2,1);"Fuel:";FNbar(1)
1480PRINTTAB(11,1);"Fuel:";FNbar(2)
1490ENDPROC
1500=num$
1510DEF FNbar(heli%)
1520IF fuel%(heli%)>mfuel% THEN fuel%(h
eli%)=mfuel%
1530GCOL 0,2
1540IF heli%=1 THEN sx%=132 ELSE sx%=70
8
1550MOVE sx%+((436/mfuel%)*fuel%(heli%)
),928:PLOT 0,(((436/mfuel%)*500)-((436/m
fuel%)*fuel%(heli%))),0:PLOT 81,0,28:PLO
T 0,-(((436/mfuel%)*500)-((436/mfuel%)*f
uel%(heli%))),0:PLOT 81,0,-28
1560GCOL 0,1
1570MOVE sx%,928:PLOT 0,(436/mfuel%)*fu
el%(heli%),0:PLOT 81,0,28:PLOT 0,-((436/
mfuel%)*fuel%(heli%)),0:PLOT 81,0,-28
1580GCOL 0,3
1590=CHR$(0)
1600DEF PROCfire(heli%)
1610IF fire%(heli%)<>0 THEN ENDPROC
1620IF heli(heli%)=&C50 OR heli(heli%)=
&A00 THEN IF (heli`pos(heli%)-&5800) MOD
&140<40 THEN ENDPROC
1630IF heli(heli%)=&C00 OR heli(heli%)=
&CA0 THEN IF ((heli`pos(heli%)-&5920) MO
D &140)>280 THEN ENDPROC
1640SOUND &10,0,0,0:SOUND 0,1,52,255
1650IF heli(heli%)=&C00 OR heli(heli%)=
&CA0 THEN dir%(heli%)=32 ELSE dir%(heli%
)=-32
1660fire%(heli%)=heli`pos(heli%)+dir%(h
eli%)
1670PROCprint`sprite(fire%(heli%)+&140,
4,2,&A50)
1680fuel%(heli%)=fuel%(heli%)-5
1690PROCfuel`update
1700ENDPROC
1710DEF PROCmove`fire
1720FOR heli%=1 TO 2
1730IF fire%(heli%)<>0 THEN PROCm`fire(
heli%)
1740NEXT
1750ENDPROC
1760DEF PROCm`fire(heli%)
1770PROCprint`sprite(fire%(heli%)+&140,
4,2,&A50)
1780fire%(heli%)=fire%(heli%)+(dir%(hel
i%)/4)
1790IF (fire%(heli%)-&5800+&140) MOD &1
40=0 THEN fire%(heli%)=0:SOUND &10,0,0,0
:PROCnoise(heli%):ENDPROC
1800IF (fire%(heli%)-&5920+&140) MOD &1
40=0 THEN fire%(heli%)=0:SOUND &10,0,0,0
:PROCnoise(heli%):ENDPROC
1810PROCprint`sprite(fire%(heli%)+&140,
4,2,&A50)
1820ENDPROC
1830DEF PROCnoise(heli%)
1840IF heli%=1 THEN other%=2 ELSE other
%=1
1850IF fire%(other%)=0 THEN SOUND 0,-15
,3,255 ELSE SOUND 0,1,52,255
1860ENDPROC
1870DEF PROClose`life(heli%)
1880lives%(heli%)=lives%(heli%)-1
1890kill%=heli%
1900IF heli%=1 THEN PRINTTAB(2,0); ELSE
PRINTTAB(11,0);
1910
1920IF lives%(heli%)>=0 THEN PRINT "Liv
es:";STR$(lives%(heli%))
1930FOR heli%=1 TO 2
1940IF heli%=kill% THEN PROCexplode(hel
i%)
1950PROCprint`sprite(heli`pos(heli%),4,
19,heli(heli%))
1960IF fire%(heli%)<>0 THEN PROCprint`s
prite(fire%(heli%)+&140,4,2,&A50):fire%(
heli%)=0
1970PROClife`Flintham(heli%)
1980PROCprint`sprite(heli`pos(heli%),4,
19,heli(heli%))
1990NEXT
2000IF fheli%<>0 THEN PROCprint`sprite(
fheli%,4,19,&5000):fheli%=0
2010IF efuel%<>0 THEN PROCprint`sprite(
efuel%,4,12,&AA0):efuel%=0:drop%=0
2020ENDPROC
2030DEF PROCdetect(heli%)
2040temp%=heli`pos(heli%)
2050IF heli%=1 THEN other%=2 ELSE other
%=1
2060hit%=FALSE
2070FOR x%=-48 TO 48 STEP 8
2080FOR y%=-(&140*3) TO &140*3 STEP &14
0
2090IF heli`pos(other%)=temp%+x%+y% THE
N PROClose`life(heli%):x%=999999:y%=9999
99:hit%=TRUE
2100IF fire%(other%)=temp%+x%+y% THEN P
ROCprint`sprite(fire%(other%)+&140,4,2,&
A50):fire%(other%)=0:SOUND &10,0,0,0:SOU
ND 0,-15,3,255:PROClose`life(heli%):x%=9
99999:y%=999999:hit%=TRUE
2110IF efuel%=temp%+x%+y% THEN SOUND &1
0,0,0,0:SOUND &11,0,0,0:SOUND 1,1,52,255
:PROCprint`sprite(efuel%,4,12,&AA0):efue
l%=0:drop%=0:fuel%(heli%)=fuel%(heli%)+2
00:PROCfuel`update:hit%=TRUE:SOUND &11,0
,0,0:SOUND &10,0,0,0:PROCsound(heli%)
2120NEXT
2130NEXT
2140IF NOT hit% THEN PROClose`life(heli
%):x%=999999:y%=999999
2150ENDPROC
2160DEF PROCsound(heli%)
2170IF heli%=1 THEN other%=2 ELSE other
%=1
2180IF fire%(other%)=0 AND fire%(heli%)
=0 THEN SOUND 0,-15,3,255 ELSE SOUND 0,1
,52,255
2190ENDPROC
2200DEF PROCbackground
2210x%=0:y%=200:MOVE x%,y%:REPEAT
2220x%=x%+RND(50)
2230y%=y%+(RND(100)-50)
2240IF y%<100 THEN y%=100
2250IF y%>500 THEN y%=500
2260DRAW x%,y%
2270UNTIL x%>=1280
2280ENDPROC
2290DEF PROCexplode(heli%)
2300SOUND &10,0,0,0:SOUND 0,-15,4,255
2310explode%=RND(30000)+32768
2320rep%=30+RND(20)
2330FOR repeat%=1 TO rep%
2340PROCprint`sprite(heli`pos(heli%),4,
19,explode%)
2350explode%=explode%+1
2360NEXT
2370FOR repeat%=rep% TO 1 STEP -1
2380explode%=explode%-1
2390PROCprint`sprite(heli`pos(heli%),4,
19,explode%)
2400NEXT
2410SOUND &10,0,0,0:SOUND 0,-15,3,255
2420ENDPROC
2430DEF PROCcrash(heli%)
2440REPEAT
2450PROCprint`sprite(heli`pos(heli%),4,
19,heli(heli%))
2460heli`pos(heli%)=heli`pos(heli%)+&14
0
2470PROCprint`sprite(heli`pos(heli%),4,
19,heli(heli%))
2480UNTIL FNcollision(heli`pos(heli%),4
,19,heli(heli%))
2490PROCdetect(heli%)
2500ENDPROC
2510DEF FNfuel`short
2520IF fuel%(1)>100 AND fuel%(2)>100 TH
EN =FALSE
2530IF fuel%(1)>=50 AND fuel%(1)<=100 T
HEN IF hcount%>100 THEN hcount%=100
2540IF fuel%(2)>=50 AND fuel%(2)<=100 T
HEN IF hcount%>100 THEN hcount%=100
2550IF fuel%(1)<50 OR fuel%(2)<50 THEN
IF hcount%>50 THEN hcount%=50
2560=TRUE
2570DEF PROCheli`Flintham
2580IF fheli%<>0 THEN ENDPROC
2590fheli%=&5D00
2600drop%=RND(37)+1
2610PROCprint`sprite(fheli%,4,19,&5000)
2620ENDPROC
2630DEF PROCmove`fuel`hel
2640IF fheli%=0 THEN ENDPROC
2650hcount%=shcount%
2660PROCprint`sprite(fheli%,4,19,&5000)
2670IF fheli%>=&5E20 THEN fheli%=0:hcou
nt%=shcount%:ENDPROC
2680fheli%=fheli%+8
2690PROCprint`sprite(fheli%,4,19,&5000)
2700IF (fheli%-&5D00)/8=drop% THEN efue
l%=fheli%+&3C0:PROCprint`sprite(efuel%,4
,12,&AA0)
2710ENDPROC
2720DEF PROCmove`fuel
2730IF efuel%=0 THEN ENDPROC
2740fuelc%=fuelc%-1
2750IF fuelc%>0 THEN ENDPROC
2760IF fuelc%=0 THEN fuelc%=mfuelc%
2770PROCprint`sprite(efuel%,4,12,&AA0)
2780efuel%=efuel%+&140
2790IF efuel%>=&8000 THEN efuel%=0:drop
%=0:ENDPROC
2800PROCprint`sprite(efuel%,4,12,&AA0)
2810ENDPROC
2820DEF PROCkeys
2830PROCprint`sprite(&6730,4,19,&C00)
2840PRINTTAB(5,5);"HELICOPTER"
2850VDU 5
2860MOVE 352,831:PRINT "HOLOCAUST"
2870MOVE 224,687:PRINT "A"
2880MOVE 224,543:PRINT "Z"
2890MOVE 96,607:PRINT "X"
2900MOVE 352,607:PRINT "C"
2910MOVE 128,479:PRINT "CTRL"
2920MOVE 32,447:PRINT "to fire"
2930PROCprint`sprite(&67F0,4,19,&A00)
2940MOVE 992,687:PRINT "*"
2950MOVE 992,543:PRINT "?"
2960MOVE 864,607:PRINT "<"
2970MOVE 1120,607:PRINT ">"
2980MOVE 832,479:PRINT "RETURN"
2990MOVE 800,447:PRINT "to fire"
3000MOVE 288,63:PRINT "Press SPACE"
3010VDU 4:*FX15,0
3020REPEAT UNTIL GET=32
3030ENDPROC
3040DEF PROCSteven`Flintham
3050VDU 5:MOVE 352,64:PRINT "Game Over"
:VDU 4
3060time%=TIME
3070REPEAT UNTIL TIME-time%>=1000
3080ENDPROC
3090DEF PROCwinner
3100PRINTTAB(0,10);"The winner is playe
r"
3110VDU 5:MOVE 608,671
3120IF FNdead(1,FALSE) THEN PRINT "2" E
LSE PRINT "1"
3130VDU 4
3140IF FNdead(1,FALSE) THEN heli%=&A00
ELSE heli%=&C00
3150PROCprint`sprite(&68D0,4,19,heli%)
3160VDU 5:MOVE 288,63:PRINT "Press SPAC
E":VDU 4
3170*FX15,0
3180REPEAT UNTIL GET=32
3190ENDPROC