'The program starts with SPIRITS.BAS ,but you should change the
'"maxstars=30" line in STAGE.BAS in order to slow down the program if you
'run it on faster computers.  It was made on a 486SX/33 so it will be too
'fast on most other computers. 

DEFINT A-Z
CLS : SCREEN 9: WIDTH 80, 25: CLS
DIM T(100): DIM Starx(400): DIM Stary(400)
DIM TE(500): DIM TF(500): DIM RNB(400): DIM RN(400)
OPEN "TEMP.DAT" FOR INPUT AS #1
INPUT #1, SHIP$, ENERGY, SPEED, BOMBS
CLOSE #1
SPEED = SPEED + 1
FOR JE = 1 TO 100: T(JE) = JE * 2: NEXT JE: STAGE = 1: X = 320: Y = 300
IF SHIP$ = "Phantom" THEN FOR JE = 1 TO 100: T(JE) = JE * 3: NEXT JE
GUN$ = "Pellet": POWER = 6: INV$ = "OFF": V$ = "DOWN": U$ = "RIGHT"
IF SHIP$ = "Oval" THEN GUN$ = "Triple Shot": POWER = 4
IF SHIP$ = "Paladon" THEN GUN$ = "Laser": POWER = 1
AA = Y: BB = Y: CC = Y: DD = Y: EE = Y: WEP = 1
A = X: B = X: C = X: D = X: E = X

MaxStars = 30

IF MaxStars > 350 THEN MaxStars = 350
30 CLS
Q = 30: XX = 0: YY = 0: FIREA$ = "OFF": FIREB$ = "OFF": FIREC$ = "OFF": FIRED$ = "OFF": FIREE$ = "OFF"
FOR stars = 1 TO MaxStars
Starx(stars) = INT(RND * 640) + 1
Stary(stars) = INT(RND * 350) + 1
RNB(stars) = INT(STAGE * RND)
RN(stars) = INT((STAGE + 2) * RND)
NEXT stars
GOSUB ENEM
GOSUB STAGE
GOTO KEYPRESS

STAGE:
CHO$ = INKEY$
COLOR 14, 0
LOCATE 10, 30: PRINT "STAGE "; STAGE; ": "; ENEMY$
COLOR 4, 0
LOCATE 10, 30: PRINT "STAGE "; STAGE; ": "; ENEMY$; "                      "
COLOR 12, 0
LOCATE 10, 30: PRINT "STAGE "; STAGE; ": "; ENEMY$; "                      "
LOCATE 15, 25: PRINT "Push ENTER to Continue.........."
COLOR 15, 0
IF CHO$ = CHR$(13) THEN CLS : RETURN
IF RT$ <> "ON" AND CHO$ = "M" THEN SOUND 1000, 1: SOUND 3000, 1: SOUND 100, 1: SHIP$ = "Zodiac": ENERGY = 30: RT$ = "ON": BOMBS = 3: SPEED = 14
IF RT$ <> "ON" AND CHO$ = "E" THEN SOUND 1000, 1: SOUND 3000, 1: SOUND 100, 1: SOUND 4000, 5: SHIP$ = "Ediion": ENERGY = 20: RT$ = "ON": BOMBS = 7: SPEED = 14
IF RT$ <> "ON" AND CHO$ = "J" THEN SOUND 1000, 1: SOUND 3000, 1: SOUND 100, 1: SHIP$ = "Crusade": ENERGY = 30: RT$ = "ON": BOMBS = 3: SPEED = 14
GOTO STAGE

ENEM:
VV$ = "DOWN": UU$ = "RIGHT"
FOR JE = 1 TO 100: T(JE) = JE * 2: NEXT JE: X = 320: Y = 300: UU = U: VV = V: U$ = "RIGHT": V$ = "UP"
IF SHIP$ = "Phantom" THEN FOR JE = 1 TO 100: T(JE) = JE * 3: NEXT JE
IF SHIP$ = "Star Base" THEN FOR JE = 1 TO 100: T(JE) = JE * 3: NEXT JE
U = 320: V = 100: EP = 3
IF ENEMY$ = "REFLECTION" THEN STAGE = 19
IF SHIP$ = "Paladon" THEN WEP1$ = "Laser"
IF SHIP$ = "Oval" THEN WEP1$ = "Triple Shot": WEP2$ = "Spread": WEP3$ = "Side Shot": WEP4$ = "Double Charge": WEP5$ = "Heats"
IF SHIP$ = "Star Base" THEN WEP1$ = "Pellet"
IF SHIP$ = "Phantom" THEN WEP1$ = "Pellet"
IF SHIP$ = "Star Tank" THEN WEP1$ = "Pellet"
IF SHIP$ = "Dark Spire" THEN WEP1$ = "Pellet"
IF SHIP$ = "Zodiac" THEN WEP1$ = "Pellet"
IF STAGE = 1 THEN ENEMY$ = "STONEWALL": Q = 50: V$ = "DROP": U$ = "RIGHT": U = 320: V = 100: ESP = 1: EP = 3
IF STAGE = 2 THEN ENEMY$ = "SOLEMN": Q = 60: V$ = "UP": U$ = "RIGHT": U = 320: V = 100: ESP = 4: EP = 3
IF STAGE = 3 THEN ENEMY$ = "DOWNFALL": Q = 70: U$ = "": ESP = 4: EP = 4
IF STAGE = 4 THEN ENEMY$ = "Bonus": Q = 70: U$ = "": ESP = 4: EP = 3
IF STAGE = 5 THEN ENEMY$ = "APPON": Q = 50: U$ = "RIGHT": V$ = "DOWN": ESP = 4: EP = 3
IF STAGE = 6 THEN ENEMY$ = "DOWNFALL": Q = 80: U$ = "RIGHT": ESP = 5: EP = 4: V$ = "DOWN": UU = 120: VV = 100: U = 520: V = 100
IF STAGE = 7 THEN ENEMY$ = "ENEMI": U$ = "RIGHT": V$ = "DOWN": ESP = 6: EP = 4
IF STAGE = 8 THEN ENEMY$ = "Bonus": Q = 30: U$ = "": ESP = 4: EP = 3
IF STAGE = 9 THEN ENEMY$ = "RAMPAGE": Q = 50: U$ = "RIGHT": V$ = "DOWN": ESP = 4: EP = 3
IF STAGE = 10 THEN ENEMY$ = "SOLEMN": Q = 80: V$ = "UP": U$ = "RIGHT": ESP = 10: EP = 3
IF STAGE = 11 THEN ENEMY$ = "COPYMOVE": Q = ENERGY: V$ = "RIGHT": V$ = "DOWN": ESP = SPEED: EP = POWER + 1
IF STAGE = 12 THEN ENEMY$ = "Bonus": Q = 20: U$ = "": ESP = 4: EP = 3
IF STAGE = 13 THEN ENEMY$ = "SYNTAX": Q = 150: U$ = "": V$ = "": ESP = 10: EP = 5
IF STAGE = 14 THEN ENEMY$ = "APPON": Q = 80: U$ = "RIGHT": ESP = 6: EP = 4
IF STAGE = 15 THEN ENEMY$ = "SECTOR": Q = 80: U$ = "RIGHT": V$ = "DOWN": ESP = 10: EP = 4
IF STAGE = 16 THEN ENEMY$ = "Bonus": Q = 30: U$ = "": ESP = 4: EP = 3
IF STAGE = 17 THEN ENEMY$ = "SAVAGE": Q = 200: U$ = "": V$ = "": ESP = 10: EP = 4
IF STAGE = 18 THEN ENEMY$ = "REFLECTION": Q = 200: U$ = "UP": V$ = "DOWN": ESP = 10: EP = 4
IF STAGE = 19 THEN ENEMY$ = "DAZZLE": Q = 100: U$ = "RIGHT": V$ = "UP": ESP = 12: EP = 2
IF STAGE = 20 THEN ENEMY$ = "Bonus": Q = (60 - ENERGY) + 20: U$ = "RIGHT": ESP = 4: EP = 3
IF STAGE = 21 THEN ENEMY$ = "The End": Q = 80: U$ = "": V$ = "": ESP = 0: EP = 0: U = 0: V = 0
IF STAGE = 22 THEN ENEMY$ = "The End?": Q = 80: U$ = "": V$ = "": ESP = 0: EP = 0: U = 0: V = 0
RETURN

KEYPRESS:
CHO$ = INKEY$
IF ENERGY <= 0 THEN GOTO GAMEOVER
IF GUN$ = "Heats" THEN TT = TT - 1: IF TT = 0 THEN TT = -1: FIREA$ = "OFF": FIREB$ = "OFF": FIREC$ = "OFF": FIRED$ = "OFF": FIREE$ = "OFF": CLS
RANDOMIZE (TIMER)
IF FIREA$ <> "ON" THEN AA = 0: A = 0
IF FIREB$ <> "ON" THEN BB = 0: B = 0
IF FIREC$ <> "ON" THEN CC = 0: C = 0
IF FIRED$ <> "ON" THEN DD = 0: D = 0
IF FIREE$ <> "ON" THEN EE = 0: E = 0
GOSUB FLOWSTAGE
IF CHO$ <> "" AND STAGE <> 22 THEN GOSUB CHKEY
IF FIREA$ = "ON" THEN GOSUB SHOTA
IF FIREB$ = "ON" THEN GOSUB SHOTB
IF FIREC$ = "ON" THEN GOSUB SHOTC
IF FIRED$ = "ON" THEN GOSUB SHOTD
IF FIREE$ = "ON" THEN GOSUB SHOTE
IF WEP$ <> "" THEN GOSUB WEPSWTCH
RNDM = INT(15 * RND)
IF RNDM = 10 THEN GOSUB DRAWSHIP
GOTO KEYPRESS

WEPSWTCH:
IF WEP$ = "WEP1" AND FIREA$ <> "ON" AND FIREB$ <> "ON" AND FIREC$ <> "ON" AND FIRED$ <> "ON" AND FIREE$ <> "ON" THEN GOSUB WEP1: WEP$ = ""
IF WEP$ = "WEP2" AND FIREA$ <> "ON" AND FIREB$ <> "ON" AND FIREC$ <> "ON" AND FIRED$ <> "ON" AND FIREE$ <> "ON" THEN GOSUB WEP2: WEP$ = ""
IF WEP$ = "WEP3" AND FIREA$ <> "ON" AND FIREB$ <> "ON" AND FIREC$ <> "ON" AND FIRED$ <> "ON" AND FIREE$ <> "ON" THEN GOSUB WEP3: WEP$ = ""
IF WEP$ = "WEP4" AND FIREA$ <> "ON" AND FIREB$ <> "ON" AND FIREC$ <> "ON" AND FIRED$ <> "ON" AND FIREE$ <> "ON" THEN GOSUB WEP4: WEP$ = ""
IF WEP$ = "WEP5" AND FIREA$ <> "ON" AND FIREB$ <> "ON" AND FIREC$ <> "ON" AND FIRED$ <> "ON" AND FIREE$ <> "ON" THEN GOSUB WEP5: WEP$ = ""
RETURN

CHKEY:
IF GUN$ = "Laser" THEN POWER = 1
IF X < 310 AND STAGE = 21 THEN GOSUB ERASHIP: X = X + SPEED: GOSUB DRAWSHIP
IF X > 310 AND STAGE = 21 THEN GOSUB ERASHIP: X = X - SPEED: GOSUB DRAWSHIP
IF STAGE = 21 THEN RETURN
IF CHO$ = CHR$(13) AND BOMBS > 0 THEN GOSUB BOMB: RETURN
IF CHO$ = "1" THEN GOSUB WEP1: WEP = 1: RETURN
IF CHO$ = "2" THEN GOSUB WEP2: WEP = 2: RETURN
IF CHO$ = "3" THEN GOSUB WEP3: WEP = 3: RETURN
IF CHO$ = "4" THEN GOSUB WEP4: WEP = 4: RETURN
IF CHO$ = "5" THEN GOSUB WEP5: WEP = 5: RETURN
IF CHO$ = "6" THEN GOSUB WEP6: WEP = 6: RETURN
IF CHO$ = "7" THEN GOSUB WEP7: WEP = 7: RETURN
IF CHO$ = "8" THEN GOSUB WEP8: WEP = 8: RETURN
IF CHO$ = "9" THEN GOSUB WEP9: WEP = 9: RETURN
IF CHO$ = CHR$(0) + "M" THEN GOSUB MRIGHT: RETURN
IF CHO$ = CHR$(0) + "K" THEN GOSUB MLEFT: RETURN
IF CHO$ = CHR$(0) + "H" THEN GOSUB MUP: RETURN
IF CHO$ = CHR$(0) + "P" THEN GOSUB MDOWN: RETURN
IF CHO$ = " " AND NN <= 0 AND FIREA$ <> "ON" THEN GOSUB FIREA: CHO$ = ""
IF CHO$ = " " AND NN <= 0 AND FIREB$ <> "ON" AND GUN$ <> "Spread" AND GUN$ <> "Side Shot" AND GUN$ <> "Double Charge" AND GUN$ <> "Quark" AND GUN$ <> "Double" AND GUN$ <> "Triple Shot" AND GUN$ <> "Heats" THEN GOSUB FIREB: CHO$ = ""
IF CHO$ = " " AND NN <= 0 AND FIREC$ <> "ON" AND GUN$ <> "Spread" AND GUN$ <> "Triple Shot" AND GUN$ <> "Heats" THEN GOSUB FIREC: CHO$ = ""
IF CHO$ = " " AND NN <= 0 AND FIRED$ <> "ON" AND GUN$ <> "Spread" AND GUN$ <> "Heats" THEN GOSUB FIRED: CHO$ = ""
IF CHO$ = " " AND NN <= 0 AND FIREE$ <> "ON" AND GUN$ <> "Spread" AND GUN$ <> "Heats" THEN GOSUB FIREE: CHO$ = ""
IF CHO$ = CHR$(27) THEN SYSTEM
RETURN

BOMB:
IF SHIP$ = "Star Base" OR SHIP$ = "Ediion" THEN GOSUB BIGBALL
IF SHIP$ = "Phantom" THEN GOSUB FLARE
IF SHIP$ = "Oval" THEN GOSUB ABSORB
IF SHIP$ = "Paladon" THEN GOSUB LASBLST
IF SHIP$ = "Star Tank" THEN GOSUB SPLIT
IF SHIP$ = "Dark Spire" OR SHIP$ = "Zodiac" THEN GOSUB DARK
IF SHIP$ = "Crusade" THEN GOSUB FLARE2
RETURN

DARK:
GOSUB FLOWSTAGE
GOSUB ERASHIP
XX = X: YY = Y: HH = 0
23 X = INT(620 * RND): Y = INT(350 * RND)
   HH = HH + 10
   INV$ = "ON": INV = 100
   GOSUB DRAWSHIP
   CIRCLE (310, 175), HH, 1: PAINT (310, 175), 1
   GOSUB FLOWSTAGE
   IF HH > 300 THEN UU = 0: VV = 0: U2 = 0: V2 = 0: U3 = 0: V3 = 0: U4 = 0: V4 = 0: U5 = 0: V5 = 0: U6 = 0: V6 = 0: U7 = 0: V7 = 0: U8 = 0: V8 = 0: X = XX: Y = YY: HH = 0: XX = 0: YY = 0: BOMBS = BOMBS - 1: LINE (312, 17)-(Q + 312, 24), H, BF: Q = Q - 15: GHI$ = "": CLS : RETURN
GOTO 23

SPLIT:
GOSUB FLOWSTAGE
GOSUB ERASHIP
HH = Y
11 G = 4: F = 1: LA = 12
HH = HH - 3
LINE (X - T(18), Y + T(9))-(X - T(10), Y - T(8)), G, BF
LINE (X + T(18), Y + T(9))-(X + T(10), Y - T(8)), G, BF
LINE (X - T(5), Y + T(7))-(X + T(5), Y - T(7)), F, BF
CIRCLE (X, Y), T(2), LA: PAINT (X, Y), LA
IF GHI$ = "DONE" THEN 13
GH$ = "ON"
13 XX = X: YY = HH
LINE (X - T(5), Y)-(X + T(5), HH), 14, BF
LINE (X + T(18), Y)-(X + T(10), HH), 14, BF
LINE (X - T(18), Y)-(X - T(10), HH), 14, BF
GOSUB CHKHIT
IF GHI$ = "DONE" THEN HH = V: CIRCLE (X, HH), 100, 4: PAINT (X, HH), 4: COLOR 0, 14: COLOR 15, 12: COLOR 0, 4: COLOR 0, 12: COLOR 0, 14: COLOR 15, 0: XX = 0: HH = 0: YY = 0: GHI$ = "": CLS : BOMBS = BOMBS - 1: CLS : RETURN
IF HH < Y - 300 THEN CIRCLE (X, HH), 100, 4: PAINT (X, HH), 4: COLOR 0, 14: COLOR 15, 12: COLOR 0, 4: COLOR 0, 12: COLOR 0, 14: COLOR 15, 0: XX = 0: HH = 0: YY = 0: GHI$ = "": CLS : BOMBS = BOMBS - 1: CLS : RETURN
GOTO 11

LASBLST:
GOSUB DRAWSHIP
GOSUB FLOWSTAGE
HH = Y
9 HH = HH - 2
IF GHI$ = "DONE" THEN 3
GH$ = "ON"
3 GOSUB DRAWSHIP
GOSUB CHKHIT
XX = X: YY = HH
LINE (X - T(2), Y)-(X + T(2), HH), 14, BF
IF GHI$ = "DONE" THEN HH = V: CIRCLE (X, HH), 100, 4: PAINT (X, HH), 4: COLOR 0, 14: COLOR 15, 12: COLOR 0, 4: COLOR 0, 12: COLOR 0, 14: COLOR 15, 0: XX = 0: HH = 0: YY = 0: GHI$ = "": CLS : BOMBS = BOMBS - 1: CLS : RETURN
IF HH < Y - 150 THEN CIRCLE (X, HH), 100, 4: PAINT (X, HH), 4: COLOR 0, 14: COLOR 15, 12: COLOR 0, 4: COLOR 0, 12: COLOR 0, 14: COLOR 15, 0: XX = 0: HH = 0: YY = 0: GHI$ = "": CLS : BOMBS = BOMBS - 1: CLS : RETURN
GOTO 9

ABSORB:
GOSUB DRAWSHIP
GOSUB FLOWSTAGE
HH = 20
8 HH = HH - 2
GOSUB ERASHIP
IF HH <= 0 THEN FOR JE = 1 TO 100: T(JE) = JE * 2: NEXT JE: HH = 0: XX = 0: YY = 0: Q = Q - 15: CLS : BOMBS = BOMBS - 1: UU = 0: VV = 0: U2 = 0: V2 = 0: U3 = 0: V3 = 0: U4 = 0: V4 = 0: U5 = 0: V5 = 0: U6 = 0: V6 = 0: U7 = 0: V7 = 0: U8 = 0: V8 = 0: RETURN
FOR JE = 1 TO 100: T(JE) = T(JE) * 1.5: NEXT JE
GOSUB DRAWSHIP
GOTO 8

BIGBALL:
GOSUB DRAWSHIP
GOSUB FLOWSTAGE
XX = X: YY = Y - T(9)
5 IF YY < 30 THEN XX = 0: YY = 0: CLS : BOMBS = BOMBS - 1: GHI$ = "": RETURN
IF GHI$ = "DONE" THEN 2
GH$ = "ON"
2 GOSUB DRAWSHIP
CIRCLE (XX, YY), 30, H: PAINT (XX, YY), H
YY = YY - 3
GOSUB CHKHIT
CIRCLE (XX, YY), 30, 4: PAINT (XX, YY), 4
GOTO 5

FLARE:
GOSUB FLOWSTAGE
XX = X: YY = Y - T(9)
6 GOSUB DRAWSHIP
IF HH > 410 THEN UU = 0: VV = 0: U2 = 0: V2 = 0: U3 = 0: V3 = 0: U4 = 0: V4 = 0: U5 = 0: V5 = 0: U6 = 0: V6 = 0: U7 = 0: V7 = 0: U8 = 0: V8 = 0: HH = 0: XX = 0: YY = 0: CLS : BOMBS = BOMBS - 1: LINE (312, 17)-(Q + 312, 24), H, BF: Q = Q - 5: RETURN
HH = HH + 15
CIRCLE (XX, YY), HH, 12: PAINT (XX, YY), 12
CIRCLE (XX, YY), HH, 4: PAINT (XX, YY), 4
GOTO 6

FLARE2:
GOSUB FLOWSTAGE
XX = X: YY = Y - T(9)
GOSUB DRAWSHIP
FOR HH = 30 TO 410
RAR = INT(14 * RND) + 1
CIRCLE (XX, YY), HH, RAR
NEXT HH
HH = 0
67 GOSUB DRAWSHIP
IF HH > 410 THEN UU = 0: VV = 0: U2 = 0: V2 = 0: U3 = 0: V3 = 0: U4 = 0: V4 = 0: U5 = 0: V5 = 0: U6 = 0: V6 = 0: U7 = 0: V7 = 0: U8 = 0: V8 = 0: HH = 0: XX = 0: YY = 0: CLS : BOMBS = BOMBS - 1: LINE (312, 17)-(Q + 312, 24), H, BF: Q = Q - 15: RETURN
HH = HH + 15
RAR = INT(14 * RND) + 1
CIRCLE (XX, YY), HH, 1: PAINT (XX, YY), 1
CIRCLE (XX, YY), HH, RAR: PAINT (XX, YY), RAR
GOTO 67


FLOWSTAGE:
IF Q <= 0 THEN STAGE = STAGE + 1: GOTO 30
IF INV$ = "ON" THEN GOSUB DRAWSHIP
IF FIREA$ <> "ON" THEN AA = 0: A = 0
IF FIREB$ <> "ON" THEN BB = 0: B = 0
IF FIREC$ <> "ON" THEN CC = 0: C = 0
IF FIRED$ <> "ON" THEN DD = 0: D = 0
IF FIREE$ <> "ON" THEN EE = 0: E = 0
GOSUB Down
IF SPEED >= 10 THEN SPEED = 10
IF STAGE = 1 THEN GOSUB STAGE1
IF STAGE = 2 THEN GOSUB STAGE2
IF STAGE = 3 THEN GOSUB STAGE3
IF STAGE = 4 THEN GOSUB STAGE4
IF STAGE = 5 THEN GOSUB STAGE5
IF STAGE = 6 THEN GOSUB STAGE6
IF STAGE = 7 THEN GOSUB STAGE7
IF STAGE = 8 THEN GOSUB STAGE4
IF STAGE = 9 THEN GOSUB STAGE9
IF STAGE = 10 THEN GOSUB STAGE10
IF STAGE = 11 THEN GOSUB STAGE11
IF STAGE = 12 THEN GOSUB STAGE4
IF STAGE = 13 THEN GOSUB STAGE12
IF STAGE = 14 THEN GOSUB STAGE5
IF STAGE = 15 THEN GOSUB STAGE12
IF STAGE = 16 THEN GOSUB STAGE4
IF STAGE = 17 THEN GOSUB STAGE12
IF STAGE = 19 THEN GOSUB STAGE19
IF STAGE = 20 THEN GOSUB STAGE4
IF STAGE = 21 THEN GOSUB STAGE21
IF STAGE = 22 THEN GOSUB STAGE22
IF WER > 2000 THEN WER = 0
IF ENEMY$ = "REFLECTION" AND WER = 1600 THEN U$ = "": V$ = "UP": CLS
IF ENEMY$ = "REFLECTION" AND WER = 1200 THEN U$ = "RIGHT": V$ = "DOWN": CLS
IF ENEMY$ = "REFLECTION" AND WER = 800 THEN U$ = "": V$ = "UP": CLS
IF ENEMY$ = "REFLECTION" AND WER = 600 THEN U$ = "LEFT": V$ = "UP": CLS
IF ENEMY$ = "REFLECTION" AND WER = 400 THEN U$ = "": V$ = "UP": CLS
IF ENEMY$ = "REFLECTION" AND WER = 200 THEN U$ = "": V$ = "UP": CLS
IF ENEMY$ = "REFLECTION" AND WER = 1 THEN U$ = "RIGHT": V$ = "DROP": CLS
IF ENEMY$ = "REFLECTION" AND WER < 1600 THEN STAGE = 17
IF ENEMY$ = "REFLECTION" AND WER < 1200 THEN STAGE = 7
IF ENEMY$ = "REFLECTION" AND WER < 800 THEN STAGE = 13
IF ENEMY$ = "REFLECTION" AND WER < 600 THEN STAGE = 5
IF ENEMY$ = "REFLECTION" AND WER < 400 THEN STAGE = 3
IF ENEMY$ = "REFLECTION" AND WER < 200 THEN STAGE = 1
WER = WER + 1
IF STAGE <> 22 THEN GOSUB CHKHIT
NN = NN - 1
INV = INV - 1
IF NN <= 0 THEN NN = 0: GOSUB DRAWSHIP
IF INV <= 0 THEN INV = 0: INV$ = "OFF": GOSUB DRAWSHIP
IF STAGE <> 22 THEN LOCATE 1, 1: PRINT "Name: "; SHIP$: LOCATE 3, 1: PRINT "Bombs: "; BOMBS
IF STAGE <> 22 THEN LOCATE 2, 1: PRINT "Energy: ": LOCATE 4, 1: PRINT "Speed: "; SPEED
IF STAGE <> 22 AND GUN$ <> "Laser" AND GUN$ <> "Heats" AND GUN$ <> "Quark" THEN LOCATE 1, 26: PRINT "Enemy: "; ENEMY$: LOCATE 1, 52: PRINT "Weapon: "; GUN$; "       "
IF STAGE <> 22 AND GUN$ = "Laser" THEN LOCATE 1, 26: PRINT "Enemy: "; ENEMY$: LOCATE 1, 52: PRINT "Weapon: "; GUN$; "         "
IF STAGE <> 22 AND GUN$ = "Heats" OR STAGE <> 22 AND GUN$ = "Quark" THEN LOCATE 1, 26: PRINT "Enemy: "; ENEMY$: LOCATE 1, 52: PRINT "Weapon: "; GUN$; "          "
IF STAGE <> 22 THEN LOCATE 2, 26: PRINT "Enemy Energy: ": LOCATE 2, 52: PRINT "Weapon Power: "; POWER; "  "
IF STAGE <> 22 THEN LOCATE 3, 52: PRINT "Weapon Number: "; WEP
IF STAGE <> 22 THEN LOCATE 3, 26: PRINT "Stage: "; STAGE
IF Q >= 100 THEN QK = 15
IF Q < 80 THEN QK = 14
IF Q < 70 THEN QK = 9
IF Q < 50 THEN QK = 11
IF Q < 40 THEN QK = 2
IF Q < 20 THEN QK = 12
IF Q < 10 THEN QK = 4
IF ENERGY >= 30 THEN EK = 15
IF ENERGY < 30 THEN EK = 14
IF ENERGY < 25 THEN EK = 9
IF ENERGY < 20 THEN EK = 11
IF ENERGY < 15 THEN EK = 2
IF ENERGY < 10 THEN EK = 12
IF ENERGY < 5 THEN EK = 4
IF STAGE <> 22 THEN LINE (62, 17)-(ENERGY + 62, 24), EK, BF
IF STAGE <> 22 THEN LINE (312, 17)-(Q + 312, 24), QK, BF
RETURN

Down:
IF STAGE = 5 THEN RETURN
IF STAGE = 19 OR STAGE = 22 THEN RETURN
IF STAGE = 17 THEN MaxStars = MaxStars - 10
10 stars = stars + 1
IF RN(stars) > 20 THEN RN(stars) = 20
IF RN(stars) <= 18 THEN COLOR 14
IF RN(stars) <= 10 THEN COLOR 15
IF RN(stars) <= 3 THEN COLOR 7
IF RN(stars) <= 1 THEN COLOR 8
PRESET (Starx(stars), Stary(stars))
IF stars > 10 THEN Stary(stars) = Stary(stars) + RN(stars)
IF stars <= 10 THEN Stary(stars) = Stary(stars) + RNB(stars)
IF Stary(stars) > 350 THEN Starx(stars) = INT(620 * RND): Stary(stars) = 0
PSET (Starx(stars), Stary(stars))
IF stars < MaxStars THEN 10
stars = 0
COLOR 15
IF STAGE = 17 THEN MaxStars = MaxStars + 10
RETURN

CHKHIT:
IF STAGE = 1 THEN HPA = 30: HPB = 30: HPC = 50: HPD = 30
IF STAGE = 2 THEN HPA = 29: HPB = 29: HPC = 29: HPD = 29
IF STAGE = 3 THEN HPA = 30: HPB = 30: HPC = 30: HPD = 30
IF STAGE = 5 THEN HPA = INT(35 * RND): HPB = INT(35 * RND): HPC = INT(35 * RND): HPD = INT(35 * RND)
IF STAGE = 6 THEN HPA = 30: HPB = 30: HPC = 30: HPD = 30
IF STAGE = 7 THEN HPA = 25: HPB = 25: HPC = 25: HPD = 25
IF STAGE = 9 THEN HPA = 50: HPB = 50: HPC = 50: HPD = 50
IF STAGE = 10 THEN HPA = 45: HPB = 45: HPC = 45: HPD = 45
IF STAGE = 11 THEN HPA = T(12): HPB = T(12): HPC = T(12): HPD = T(12)
IF STAGE = 13 THEN HPA = 30: HPB = 30: HPC = 35: HPD = 35
IF STAGE = 14 THEN HPA = INT(35 * RND): HPB = INT(35 * RND): HPC = INT(25 * RND): HPD = INT(25 * RND)
IF STAGE = 15 THEN HPA = 30: HPB = 30: HPC = 30: HPD = 30
IF STAGE = 17 THEN HPA = 30: HPB = 30: HPC = 30: HPD = 30
IF STAGE = 19 THEN HPA = 25: HPB = 25: HPC = 25: HPD = 25
IF GUN$ = "Flare" AND HH > 20 AND A > U - HPA + HH AND A < U + HPB + HH AND AA < V + HPC + HH AND AA > V - HPD + HH THEN FIREA$ = "OFF": GOSUB EHIT
IF A > U - HPA AND A < U + HPB AND AA < V + HPC AND AA > V - HPD THEN FIREA$ = "OFF": GOSUB EHIT
IF B > U - HPA AND B < U + HPB AND BB < V + HPC AND BB > V - HPD THEN FIREB$ = "OFF": GOSUB EHIT
IF C > U - HPA AND C < U + HPB AND CC < V + HPC AND CC > V - HPD THEN FIREC$ = "OFF": GOSUB EHIT
IF D > U - HPA AND D < U + HPB AND DD < V + HPC AND DD > V - HPD THEN FIRED$ = "OFF": GOSUB EHIT
IF E > U - HPA AND E < U + HPB AND EE < V + HPC AND EE > V - HPD THEN FIREE$ = "OFF": GOSUB EHIT
IF UU <> 0 AND VV <> 0 THEN GOSUB CHKUU
IF U2 <> 0 AND V2 <> 0 THEN GOSUB CHKU2
IF U3 <> 0 AND V3 <> 0 THEN GOSUB CHKU3
IF U4 <> 0 AND V4 <> 0 THEN GOSUB CHKU4
IF U5 <> 0 AND V5 <> 0 THEN GOSUB CHKU5
IF U6 <> 0 AND V6 <> 0 THEN GOSUB CHKU6
IF U7 <> 0 AND V7 <> 0 THEN GOSUB CHKU7
IF U8 <> 0 AND V8 <> 0 THEN GOSUB CHKU8
IF GUN$ = "Laser" AND A > U - HPA AND A < U + HPB AND Y > V - HPD THEN FIREA$ = "OFF": GOSUB EHIT
IF SHIP$ = "Star Base" AND GH$ = "ON" AND XX > U - (HPA + 30) AND XX < U + (HPB + 30) AND YY < V + (HPC + 30) AND YY > V - (HPD + 30) THEN GOSUB EHIT: GH$ = "OFF"
IF SHIP$ = "Paladon" AND GH$ = "ON" AND XX > U - HPA AND XX < U + HPB AND YY < V + HPC AND YY > V - HPD THEN GOSUB EHIT: GH$ = "OFF"
IF SHIP$ = "Star Tank" AND GH$ = "ON" AND XX > U - (HPA + 35) AND XX < U + (HPB + 35) AND YY < V + (HPC + 30) AND YY > V - (HPD + 30) THEN GOSUB EHIT: GH$ = "OFF"
RETURN

CHKUU:
IF A > UU - 9 AND A < UU + 9 AND AA < VV + 5 AND AA > VV - 5 THEN FIREA$ = "OFF": UU = 0: VV = 0: SOUND 3500, 1: CLS
IF B > UU - 9 AND B < UU + 9 AND BB < VV + 5 AND BB > VV - 5 THEN FIREB$ = "OFF": UU = 0: VV = 0: SOUND 3500, 1: CLS
IF C > UU - 9 AND C < UU + 9 AND CC < VV + 5 AND CC > VV - 5 THEN FIREC$ = "OFF": UU = 0: VV = 0: SOUND 3500, 1: CLS
IF D > UU - 9 AND D < UU + 9 AND DD < VV + 5 AND DD > VV - 5 THEN FIRED$ = "OFF": UU = 0: VV = 0: SOUND 3500, 1: CLS
IF E > UU - 9 AND E < UU + 9 AND EE < VV + 5 AND EE > VV - 5 THEN FIREE$ = "OFF": UU = 0: VV = 0: SOUND 3500, 1: CLS
RETURN

CHKU2:
UC = U2: VC = V2
IF A > UC - 9 AND A < UC + 9 AND AA < VC + 5 AND AA > VC - 5 THEN FIREA$ = "OFF": UC = 0: VC = 0: SOUND 3500, 1: CLS
IF B > UC - 9 AND B < UC + 9 AND BB < VC + 5 AND BB > VC - 5 THEN FIREB$ = "OFF": UC = 0: VC = 0: SOUND 3500, 1: CLS
IF C > UC - 9 AND C < UC + 9 AND CC < VC + 5 AND CC > VC - 5 THEN FIREC$ = "OFF": UC = 0: VC = 0: SOUND 3500, 1: CLS
IF D > UC - 9 AND D < UC + 9 AND DD < VC + 5 AND DD > VC - 5 THEN FIRED$ = "OFF": UC = 0: VC = 0: SOUND 3500, 1: CLS
IF E > UC - 9 AND E < UC + 9 AND EE < VC + 5 AND EE > VC - 5 THEN FIREE$ = "OFF": UC = 0: VC = 0: SOUND 3500, 1: CLS
U2 = UC: V2 = VC
RETURN

CHKU3:
UC = U3: VC = V3
IF A > UC - 9 AND A < UC + 9 AND AA < VC + 5 AND AA > VC - 5 THEN FIREA$ = "OFF": UC = 0: VC = 0: SOUND 3500, 1: CLS
IF B > UC - 9 AND B < UC + 9 AND BB < VC + 5 AND BB > VC - 5 THEN FIREB$ = "OFF": UC = 0: VC = 0: SOUND 3500, 1: CLS
IF C > UC - 9 AND C < UC + 9 AND CC < VC + 5 AND CC > VC - 5 THEN FIREC$ = "OFF": UC = 0: VC = 0: SOUND 3500, 1: CLS
IF D > UC - 9 AND D < UC + 9 AND DD < VC + 5 AND DD > VC - 5 THEN FIRED$ = "OFF": UC = 0: VC = 0: SOUND 3500, 1: CLS
IF E > UC - 9 AND E < UC + 9 AND EE < VC + 5 AND EE > VC - 5 THEN FIREE$ = "OFF": UC = 0: VC = 0: SOUND 3500, 1: CLS
U3 = UC: V3 = VC
RETURN

CHKU4:
UC = U4: VC = V4
IF A > UC - 9 AND A < UC + 9 AND AA < VC + 5 AND AA > VC - 5 THEN FIREA$ = "OFF": UC = 0: VC = 0: SOUND 3500, 1: CLS
IF B > UC - 9 AND B < UC + 9 AND BB < VC + 5 AND BB > VC - 5 THEN FIREB$ = "OFF": UC = 0: VC = 0: SOUND 3500, 1: CLS
IF C > UC - 9 AND C < UC + 9 AND CC < VC + 5 AND CC > VC - 5 THEN FIREC$ = "OFF": UC = 0: VC = 0: SOUND 3500, 1: CLS
IF D > UC - 9 AND D < UC + 9 AND DD < VC + 5 AND DD > VC - 5 THEN FIRED$ = "OFF": UC = 0: VC = 0: SOUND 3500, 1: CLS
IF E > UC - 9 AND E < UC + 9 AND EE < VC + 5 AND EE > VC - 5 THEN FIREE$ = "OFF": UC = 0: VC = 0: SOUND 3500, 1: CLS
U4 = UC: V4 = VC
RETURN

CHKU5:
UC = U5: VC = V5
IF A > UC - 9 AND A < UC + 9 AND AA < VC + 5 AND AA > VC - 5 THEN FIREA$ = "OFF": UC = 0: VC = 0: SOUND 3500, 1: CLS
IF B > UC - 9 AND B < UC + 9 AND BB < VC + 5 AND BB > VC - 5 THEN FIREB$ = "OFF": UC = 0: VC = 0: SOUND 3500, 1: CLS
IF C > UC - 9 AND C < UC + 9 AND CC < VC + 5 AND CC > VC - 5 THEN FIREC$ = "OFF": UC = 0: VC = 0: SOUND 3500, 1: CLS
IF D > UC - 9 AND D < UC + 9 AND DD < VC + 5 AND DD > VC - 5 THEN FIRED$ = "OFF": UC = 0: VC = 0: SOUND 3500, 1: CLS
IF E > UC - 9 AND E < UC + 9 AND EE < VC + 5 AND EE > VC - 5 THEN FIREE$ = "OFF": UC = 0: VC = 0: SOUND 3500, 1: CLS
U5 = UC: V5 = VC
RETURN

CHKU6:
UC = U6: VC = V6
IF A > UC - 9 AND A < UC + 9 AND AA < VC + 5 AND AA > VC - 5 THEN FIREA$ = "OFF": UC = 0: VC = 0: SOUND 3500, 1: CLS
IF B > UC - 9 AND B < UC + 9 AND BB < VC + 5 AND BB > VC - 5 THEN FIREB$ = "OFF": UC = 0: VC = 0: SOUND 3500, 1: CLS
IF C > UC - 9 AND C < UC + 9 AND CC < VC + 5 AND CC > VC - 5 THEN FIREC$ = "OFF": UC = 0: VC = 0: SOUND 3500, 1: CLS
IF D > UC - 9 AND D < UC + 9 AND DD < VC + 5 AND DD > VC - 5 THEN FIRED$ = "OFF": UC = 0: VC = 0: SOUND 3500, 1: CLS
IF E > UC - 9 AND E < UC + 9 AND EE < VC + 5 AND EE > VC - 5 THEN FIREE$ = "OFF": UC = 0: VC = 0: SOUND 3500, 1: CLS
U6 = UC: V6 = VC
RETURN

CHKU7:
UC = U7: VC = V7
IF A > UC - 9 AND A < UC + 9 AND AA < VC + 5 AND AA > VC - 5 THEN FIREA$ = "OFF": UC = 0: VC = 0: SOUND 3500, 1: CLS
IF B > UC - 9 AND B < UC + 9 AND BB < VC + 5 AND BB > VC - 5 THEN FIREB$ = "OFF": UC = 0: VC = 0: SOUND 3500, 1: CLS
IF C > UC - 9 AND C < UC + 9 AND CC < VC + 5 AND CC > VC - 5 THEN FIREC$ = "OFF": UC = 0: VC = 0: SOUND 3500, 1: CLS
IF D > UC - 9 AND D < UC + 9 AND DD < VC + 5 AND DD > VC - 5 THEN FIRED$ = "OFF": UC = 0: VC = 0: SOUND 3500, 1: CLS
IF E > UC - 9 AND E < UC + 9 AND EE < VC + 5 AND EE > VC - 5 THEN FIREE$ = "OFF": UC = 0: VC = 0: SOUND 3500, 1: CLS
U7 = UC: V7 = VC
RETURN

CHKU8:
UC = U8: VC = V8
IF A > UC - 9 AND A < UC + 9 AND AA < VC + 5 AND AA > VC - 5 THEN FIREA$ = "OFF": UC = 0: VC = 0: SOUND 3500, 1: CLS
IF B > UC - 9 AND B < UC + 9 AND BB < VC + 5 AND BB > VC - 5 THEN FIREB$ = "OFF": UC = 0: VC = 0: SOUND 3500, 1: CLS
IF C > UC - 9 AND C < UC + 9 AND CC < VC + 5 AND CC > VC - 5 THEN FIREC$ = "OFF": UC = 0: VC = 0: SOUND 3500, 1: CLS
IF D > UC - 9 AND D < UC + 9 AND DD < VC + 5 AND DD > VC - 5 THEN FIRED$ = "OFF": UC = 0: VC = 0: SOUND 3500, 1: CLS
IF E > UC - 9 AND E < UC + 9 AND EE < VC + 5 AND EE > VC - 5 THEN FIREE$ = "OFF": UC = 0: VC = 0: SOUND 3500, 1: CLS
U8 = UC: V8 = VC
RETURN


EHIT:
SOUND 1000, 1: SOUND 2000, 1
IF STAGE <> 19 THEN CLS
J = 0
IF GH$ = "ON" AND SHIP$ = "Star Base" THEN Q = Q - 15
IF GH$ = "ON" AND SHIP$ = "Paladon" THEN Q = Q - 9
IF GH$ = "ON" AND SHIP$ = "Star Tank" THEN Q = Q - 11
IF GH$ = "ON" THEN GHI$ = "DONE"
IF GH$ <> "ON" AND ENEMY$ <> "Bonus" THEN Q = Q - POWER
IF ENEMY$ = "Bonus" THEN V = 400
LINE (312, 17)-(Q + 312, 24), QK, BF
GH$ = "OFF"
IF GHI$ = "DONE" THEN RETURN
NN = 40
IF GUN$ = "Laser" THEN NN = 5
RETURN

STAGE1:
LINE (U - 30, V - 30)-(U + 30, V + 50), H, BF
IF X > U - 40 AND X < U + 40 AND Y > V - 30 AND Y < V + 50 AND INV$ = "OFF" THEN EP = 2: GOSUB HIT
IF U$ = "RIGHT" AND V$ = "DROP" THEN U = U + 2
IF U$ = "LEFT" AND V$ = "DROP" THEN U = U - 2
IF U > 620 THEN U$ = "LEFT"
IF U < 20 THEN U$ = "RIGHT"
IF V <= 70 THEN V$ = "DROP"
IF X > U - 20 AND X < U + 20 THEN V$ = "DOWN"
IF V$ = "DOWN" THEN V = V + 2
IF V > 400 THEN V$ = "UP"
IF V$ = "UP" THEN V = V - 5
LINE (U - 30, V - 30)-(U + 30, V + 50), 7, BF
LINE (U, V - 30)-(U, V + 50), 8
LINE (U - 30, V + 10)-(U + 30, V + 10), 8
LINE (U - 30, V + 30)-(U + 30, V + 30), 8
LINE (U - 30, V - 10)-(U + 30, V - 10), 8
IF Q < 12 THEN CIRCLE (U, V - 20), 2, H: PAINT (U, V - 20), H
IF Q < 20 THEN CIRCLE (U - 20, V + 10), 5, H: PAINT (U - 20, V + 10), H
IF Q < 25 THEN CIRCLE (U + 10, V - 3), 1, H
IF Q < 8 THEN CIRCLE (U - 10, V + 15), 10, H: PAINT (U - 10, V + 15), H
RETURN

STAGE2:
CIRCLE (U, V), 30, H: PAINT (U, V), H
CIRCLE (UU, VV), 5, H: PAINT (UU, VV), H
IF Q < 30 THEN ESP = 7
GOSUB MOV
IF X > U - 30 AND X < U + 30 AND Y > V - 30 AND Y < V + 30 AND INV$ = "OFF" THEN EP = 3: GOSUB HIT
CIRCLE (U, V), 30, 4: PAINT (U, V), 4: CIRCLE (U, V), 20, 12: PAINT (U, V), 12: CIRCLE (U, V), 10, 1: PAINT (U, V), 1
IF VV$ = "DOWN" THEN VV = VV + 3
IF VV$ = "UP" THEN VV = VV - 3
IF UU$ = "RIGHT" THEN UU = UU + 2
IF UU$ = "LEFT" THEN UU = UU - 2
IF VV > 320 OR VV < 20 OR UU > 620 OR UU < 20 THEN GOSUB CHSRND: UU = U: VV = V
IF UU > X - T(12) AND UU < X + T(12) AND VV > Y - T(10) AND VV < Y + T(10) AND INV$ = "OFF" THEN EP = 5: GOSUB HIT
CIRCLE (UU, VV), 5, 1: PAINT (UU, VV), 1: CIRCLE (UU, VV), 5, 4: PAINT (UU, VV), 4
IF Q < 12 THEN CIRCLE (U, V - 20), 2, H: PAINT (U, V - 20), H
IF Q < 20 THEN CIRCLE (U - 20, V + 10), 5, H: PAINT (U - 20, V + 10), H
IF Q < 25 THEN CIRCLE (U + 10, V - 3), 1, H
IF Q < 8 THEN CIRCLE (U - 10, V + 15), 10, H: PAINT (U - 10, V + 15), H
RETURN

STAGE3:
CIRCLE (U, V), 30, H: PAINT (U, V), H
IF V$ = "DOWN" THEN LINE (U - 30, V)-(U, V - 50), H: LINE (U + 30, V)-(U, V - 50), H: PAINT (U, V - 30), H
IF V$ = "UP" THEN LINE (U - 30, V)-(U, V + 50), H: LINE (U + 30, V)-(U, V + 50), H: PAINT (U, V + 30), H
GOSUB MOV
IF X > U - 30 AND X < U + 30 AND Y > V - 30 AND Y < V + 30 AND INV$ = "OFF" THEN EP = 3: GOSUB HIT
CIRCLE (U, V), 30, 4: PAINT (U, V), 4
IF V$ = "DOWN" THEN LINE (U - 30, V)-(U, V - 50), 4: LINE (U + 30, V)-(U, V - 50), 4: PAINT (U, V - 30), 4
IF V$ = "UP" THEN LINE (U - 30, V)-(U, V + 50), 4: LINE (U + 30, V)-(U, V + 50), 4: PAINT (U, V + 30), 4
IF Q < 12 THEN CIRCLE (U, V - 20), 2, H: PAINT (U, V - 20), H
IF Q < 20 THEN CIRCLE (U - 20, V + 10), 5, H: PAINT (U - 20, V + 10), H
IF Q < 25 THEN CIRCLE (U + 10, V - 3), 1, H
IF Q < 8 THEN CIRCLE (U - 10, V + 15), 10, H: PAINT (U - 10, V + 15), H
RETURN

STAGE4:
LOCATE 11, 35: PRINT "Bonus Stage"
V$ = "DOWN": U$ = ""
TT = TT - 1
IF TT <= 0 THEN TT = 14: LINE (312, 17)-(Q + 312, 24), H, BF: Q = Q - 1
CIRCLE (U, V), 5, H: PAINT (U, V), H
IF X > U - 15 AND X < U + 15 AND Y > V - 15 AND Y < V + 15 THEN SOUND 1000, 1: SOUND 100, 1: SOUND 3500, 2: GOSUB BONUS
V = V + 7
IF U$ = "RIGHT" AND U > 600 THEN U$ = "LEFT"
IF U$ = "LEFT" AND U < 20 THEN U$ = "RIGHT"
IF U$ = "RIGHT" THEN U = U + 3
IF U$ = "LEFT" THEN U = U + 3
IF V > 350 THEN V = 0: U = INT(600 * RND) + 20: BONUS = BONUS + 1
CIRCLE (U, V), 5, 14: PAINT (U, V), 14
RETURN

BONUS:
BONUS = INT(50 * RND)
CIRCLE (U, V), 5, H: PAINT (U, V), H
V = 400
IF BONUS < 5 THEN ENERGY = ENERGY + 1: RETURN
IF BONUS = 6 AND SPEED >= 10 THEN ENERGY = ENERGY + 5
IF BONUS = 6 THEN SPEED = SPEED + 1: RETURN
IF BONUS < 10 THEN BOMBS = BOMBS + 1: RETURN
IF BONUS < 15 THEN Q = Q + 20: RETURN
IF BONUS < 50 THEN ENERGY = ENERGY + 1: RETURN
RETURN

STAGE5:
IF J = 0 THEN J = 1
LINE (U - HPA, V - HPC)-(U + HPB, V + HPD), H
LINE (U - HPA, V + HPC)-(U + HPB, V - HPD), H
LINE (U, V + HPC)-(U, V - HPD), H
LINE (U - HPA, V)-(U + HPB, V), H
ESP = INT(12 * RND)
IF TE(J - 1) = TE(J) THEN TE(J) = U + 10: GOTO 80
IF TF(J - 1) = TF(J) THEN TF(J) = V - 10: GOTO 80
TE(J) = U: TF(J) = V
80 FOR JE = 1 TO 500 STEP 20
IF TE(JE) = 0 OR TF(JE) = 0 THEN TE(JE) = INT(640 * RND): TF(JE) = V: CLS
CIRCLE (TE(JE), TF(JE)), 25, H
LINE (TE(JE) - 25, TF(JE) - 25)-(TE(JE) + 25, TF(JE) + 25), H
LINE (TE(JE) + 25, TF(JE) - 25)-(TE(JE) - 25, TF(JE) + 25), H
TF(JE) = TF(JE) + 1
IF X > TE(JE) - 25 AND X < TE(JE) + 25 AND Y > TF(JE) - 15 AND Y < TF(JE) + 15 AND INV$ = "OFF" THEN EP = 3: GOSUB HIT: TE(JE) = -50: TF(JE) = -50: COLOR 4, 4: COLOR 15, 15: COLOR 4, 4: COLOR 15, 0: CLS
IF A > TE(JE) - 25 AND A < TE(JE) + 25 AND AA > TF(JE) - 15 AND AA < TF(JE) + 15 THEN TE(JE) = -50: TF(JE) = -50: COLOR 4, 4: COLOR 15, 15: COLOR 4, 4: COLOR 15, 0: CLS : FIREA$ = "OFF": AA = 0
IF B > TE(JE) - 25 AND B < TE(JE) + 25 AND BB > TF(JE) - 15 AND BB < TF(JE) + 15 THEN TE(JE) = -50: TF(JE) = -50: COLOR 4, 4: COLOR 15, 15: COLOR 4, 4: COLOR 15, 0: CLS : FIREB$ = "OFF": BB = 0
IF C > TE(JE) - 25 AND C < TE(JE) + 25 AND CC > TF(JE) - 15 AND CC < TF(JE) + 15 THEN TE(JE) = -50: TF(JE) = -50: COLOR 4, 4: COLOR 15, 15: COLOR 4, 4: COLOR 15, 0: CLS : FIREC$ = "OFF": CC = 0
IF D > TE(JE) - 25 AND D < TE(JE) + 25 AND DD > TF(JE) - 15 AND DD < TF(JE) + 15 THEN TE(JE) = -50: TF(JE) = -50: COLOR 4, 4: COLOR 15, 15: COLOR 4, 4: COLOR 15, 0: CLS : FIRED$ = "OFF": DD = 0
IF E > TE(JE) - 25 AND E < TE(JE) + 25 AND EE > TF(JE) - 15 AND EE < TF(JE) + 15 THEN TE(JE) = -50: TF(JE) = -50: COLOR 4, 4: COLOR 15, 15: COLOR 4, 4: COLOR 15, 0: CLS : FIREE$ = "OFF": EE = 0
CIRCLE (TE(JE), TF(JE)), 25, 14
LINE (TE(JE) - 25, TF(JE) - 25)-(TE(JE) + 25, TF(JE) + 25), 14
LINE (TE(JE) + 25, TF(JE) - 25)-(TE(JE) - 25, TF(JE) + 25), 14
NEXT JE
J = J + 1
IF J > 500 THEN J = 1: CLS
GOSUB MOV
IF X > U - 25 AND X < U + 25 AND Y > V - 15 AND Y < V + 15 AND INV$ = "OFF" THEN EP = 3: GOSUB HIT
IF STAGE = 5 THEN LINE (U - HPA, V - HPC)-(U + HPB, V + HPD), 4
IF STAGE = 5 THEN LINE (U - HPA, V + HPC)-(U + HPB, V - HPD), 4
IF STAGE = 5 THEN LINE (U, V + HPC)-(U, V - HPD), 4
IF STAGE = 5 THEN LINE (U - HPA, V)-(U + HPB, V), 4
IF STAGE = 14 THEN LINE (U - HPA, V - HPC)-(U + HPB, V + HPD), 14
IF STAGE = 14 THEN LINE (U - HPA, V + HPC)-(U + HPB, V - HPD), 14
IF STAGE = 14 THEN LINE (U, V + HPC)-(U, V - HPD), 14
IF STAGE = 14 THEN LINE (U - HPA, V)-(U + HPB, V), 14
RETURN

STAGE6:
CIRCLE (U, V), 30, H: PAINT (U, V), H
CIRCLE (UU, VV), 30, H: PAINT (UU, VV), H
IF V$ = "DOWN" THEN LINE (U - 30, V)-(U, V - 50), H: LINE (U + 30, V)-(U, V - 50), H: PAINT (U, V - 30), H
IF V$ = "UP" THEN LINE (U - 30, V)-(U, V + 50), H: LINE (U + 30, V)-(U, V + 50), H: PAINT (U, V + 30), H
IF V$ = "DOWN" THEN LINE (UU - 30, VV)-(UU, VV - 50), H: LINE (UU + 30, VV)-(UU, VV - 50), H: PAINT (UU, VV - 30), H
IF V$ = "UP" THEN LINE (UU - 30, VV)-(UU, VV + 50), H: LINE (UU + 30, VV)-(UU, VV + 50), H: PAINT (UU, VV + 30), H
GOSUB MOV
IF X > U - 30 AND X < U + 30 AND Y > V - 30 AND Y < V + 30 AND INV$ = "OFF" THEN EP = 3: GOSUB HIT
IF U > UU - 60 AND U < UU + 60 AND U$ = "RIGHT" AND V < VV + 60 AND V > VV - 30 THEN U$ = "LEFT"
IF U > UU - 60 AND U < UU + 60 AND U$ = "LEFT" AND V < VV + 60 AND V > VV - 30 THEN U$ = "RIGHT"
IF X > UU - 30 AND X < UU + 30 AND Y > VV - 30 AND Y < VV + 30 AND INV$ = "OFF" THEN EP = 3: GOSUB HIT
CIRCLE (U, V), 30, 4: PAINT (U, V), 4
CIRCLE (UU, VV), 30, 14: PAINT (UU, VV), 14
IF V$ = "DOWN" THEN LINE (U - 30, V)-(U, V - 50), 4: LINE (U + 30, V)-(U, V - 50), 4: PAINT (U, V - 30), 4
IF V$ = "UP" THEN LINE (U - 30, V)-(U, V + 50), 4: LINE (U + 30, V)-(U, V + 50), 4: PAINT (U, V + 30), 4
IF V$ = "DOWN" THEN LINE (UU - 30, VV)-(UU, VV - 50), 14: LINE (UU + 30, VV)-(UU, VV - 50), 14: PAINT (UU, VV - 30), 14
IF V$ = "UP" THEN LINE (UU - 30, VV)-(UU, VV + 50), 14: LINE (UU + 30, VV)-(UU, VV + 50), 14: PAINT (UU, VV + 30), 14
RETURN

STAGE7:
IF UU = 0 OR U2 = 0 OR U3 = 0 OR U4 = 0 THEN UU = 0: U2 = 0: U3 = 640: U4 = 640
CIRCLE (U, V), 10, H: PAINT (U, V), H: CIRCLE (U - 15, V - 15), 10, H: PAINT (U - 15, V - 15), H
CIRCLE (U + 15, V + 15), 10, H: PAINT (U + 15, V + 15), H: CIRCLE (U + 15, V - 15), 10, H: PAINT (U + 15, V - 15), H
CIRCLE (U - 15, V + 15), 10, H: PAINT (U - 15, V + 15), H
GOSUB MOV
CIRCLE (UU, VV), 5, H: PAINT (UU, VV), H
CIRCLE (U2, V2), 5, H: PAINT (U2, V2), H
CIRCLE (U3, V3), 5, H: PAINT (U3, V3), H
CIRCLE (U4, V4), 5, H: PAINT (U4, V4), H
IF X > U - 25 AND X < U + 25 AND Y > V - 25 AND Y < V + 25 AND INV$ = "OFF" THEN EP = 5: GOSUB HIT
IF X > UU - 10 AND X < UU + 10 AND Y > VV - 10 AND Y < VV + 10 AND INV$ = "OFF" THEN EP = 3: GOSUB HIT
IF X > U2 - 10 AND X < U2 + 10 AND Y > V2 - 10 AND Y < V2 + 10 AND INV$ = "OFF" THEN EP = 3: GOSUB HIT
IF X > U3 - 10 AND X < U3 + 10 AND Y > V3 - 10 AND Y < V3 + 10 AND INV$ = "OFF" THEN EP = 3: GOSUB HIT
IF X > U4 - 10 AND X < U4 + 10 AND Y > V4 - 10 AND Y < V4 + 10 AND INV$ = "OFF" THEN EP = 3: GOSUB HIT
UU = UU - 5: VV = VV - 5
U2 = U2 - 5: V2 = V2 + 5
U3 = U3 + 5: V3 = V3 - 5
U4 = U4 + 5: V4 = V4 + 5
IF UU < 20 OR VV < 20 THEN UU = U - 15: VV = V - 15
IF U2 < 20 OR V2 > 330 THEN U2 = U - 15: V2 = V + 15
IF U3 > 600 OR V3 < 20 THEN U3 = U + 15: V3 = V - 15
IF U4 > 600 OR V4 > 330 THEN U4 = U + 15: V4 = V + 15
CIRCLE (U, V), 10, 3: PAINT (U, V), 3: CIRCLE (U - 15, V - 15), 10, 9: PAINT (U - 15, V - 15), 9
CIRCLE (U + 15, V + 15), 10, 9: PAINT (U + 15, V + 15), 9: CIRCLE (U + 15, V - 15), 10, 9: PAINT (U + 15, V - 15), 9
CIRCLE (U - 15, V + 15), 10, 9: PAINT (U - 15, V + 15), 9
CIRCLE (UU, VV), 5, 2: PAINT (UU, VV), 2
CIRCLE (U2, V2), 5, 6: PAINT (U2, V2), 6
CIRCLE (U3, V3), 5, 4: PAINT (U3, V3), 4
CIRCLE (U4, V4), 5, 14: PAINT (U4, V4), 14
RETURN

STAGE9:
IF UU = 0 OR U2 = 0 OR U3 = 0 OR U4 = 0 THEN UU = 0: U2 = 0: U3 = 640: U4 = 640: U5 = 0: U6 = 640
LINE (U - 51, V - 51)-(U + 51, V + 51), H, B
GOSUB MOV
CIRCLE (UU, VV), 8, H: PAINT (UU, VV), H
CIRCLE (U2, V2), 8, H: PAINT (U2, V2), H
CIRCLE (U3, V3), 8, H: PAINT (U3, V3), H
CIRCLE (U4, V4), 8, H: PAINT (U4, V4), H
CIRCLE (U5, V5), 8, H: PAINT (U5, V5), H
CIRCLE (U6, V6), 8, H: PAINT (U6, V6), H
IF X > U - 50 AND X < U + 50 AND Y > V - 50 AND Y < V + 50 AND INV$ = "OFF" THEN EP = 5: GOSUB HIT
IF X > UU - 16 AND X < UU + 16 AND Y > VV - 16 AND Y < VV + 16 AND INV$ = "OFF" THEN EP = 3: GOSUB HIT
IF X > U2 - 16 AND X < U2 + 16 AND Y > V2 - 16 AND Y < V2 + 16 AND INV$ = "OFF" THEN EP = 3: GOSUB HIT
IF X > U3 - 16 AND X < U3 + 16 AND Y > V3 - 16 AND Y < V3 + 16 AND INV$ = "OFF" THEN EP = 3: GOSUB HIT
IF X > U4 - 16 AND X < U4 + 16 AND Y > V4 - 16 AND Y < V4 + 16 AND INV$ = "OFF" THEN EP = 3: GOSUB HIT
IF X > U5 - 16 AND X < U5 + 16 AND Y > V5 - 16 AND Y < V5 + 16 AND INV$ = "OFF" THEN EP = 3: GOSUB HIT
IF X > U6 - 16 AND X < U6 + 16 AND Y > V6 - 16 AND Y < V6 + 16 AND INV$ = "OFF" THEN EP = 3: GOSUB HIT
UU = UU - 5: VV = VV - 5
U2 = U2 - 5: V2 = V2 + 5
U3 = U3 + 5: V3 = V3 - 5
U4 = U4 + 5: V4 = V4 + 5
V5 = V5 - 5
V6 = V6 + 5
IF UU < 20 OR VV < 20 THEN UU = U - 15: VV = V - 15
IF U2 < 20 OR V2 > 330 THEN U2 = U - 15: V2 = V + 15
IF U3 > 600 OR V3 < 20 THEN U3 = U + 15: V3 = V - 15
IF U4 > 600 OR V4 > 330 THEN U4 = U + 15: V4 = V + 15
IF U5 < 20 OR V5 < 20 THEN U5 = U: V5 = V
IF U6 > 600 OR V6 > 330 THEN U6 = U: V6 = V
LINE (U - 50, V - 50)-(U + 50, V + 50), 4, BF
CIRCLE (U, V), 20, 12: PAINT (U, V), 12
LINE (U - 51, V - 51)-(U + 51, V + 51), 12, B
CIRCLE (UU, VV), 8, 2: PAINT (UU, VV), 2
CIRCLE (U2, V2), 8, 6: PAINT (U2, V2), 6
CIRCLE (U3, V3), 8, 4: PAINT (U3, V3), 4
CIRCLE (U4, V4), 8, 14: PAINT (U4, V4), 14
CIRCLE (U5, V5), 8, 12: PAINT (U5, V5), 12
CIRCLE (U6, V6), 8, 1: PAINT (U6, V6), 1
IF Q < 12 THEN CIRCLE (U, V - 20), 2, H: PAINT (U, V - 20), H
IF Q < 20 THEN CIRCLE (U - 20, V + 10), 5, H: PAINT (U - 20, V + 10), H
IF Q < 25 THEN CIRCLE (U + 10, V - 3), 1, H
IF Q < 8 THEN CIRCLE (U - 10, V + 15), 10, H: PAINT (U - 10, V + 15), H
RETURN

STAGE10:
CIRCLE (U, V), 45, H: PAINT (U, V), H
IF Q < 30 THEN ESP = 15
GOSUB MOV
IF X > U - 45 AND X < U + 45 AND Y > V - 45 AND Y < V + 45 AND INV$ = "OFF" THEN EP = 3: GOSUB HIT
CIRCLE (U, V), 45, 4: PAINT (U, V), 4: CIRCLE (U, V), 20, 12: PAINT (U, V), 12: CIRCLE (U, V), 10, 1: PAINT (U, V), 1
IF Q < 12 THEN CIRCLE (U, V - 20), 2, H: PAINT (U, V - 20), H
IF Q < 20 THEN CIRCLE (U - 20, V + 10), 5, H: PAINT (U - 20, V + 10), H
IF Q < 25 THEN CIRCLE (U + 10, V - 3), 1, H
IF Q < 8 THEN CIRCLE (U - 10, V + 15), 10, H: PAINT (U - 10, V + 15), H
RETURN

STAGE11:
U6 = X: V6 = Y
X = U: Y = V
AW$ = "ON"
LINE (U - T(22), V - T(15))-(U + T(22), V + T(15)), H, BF
GOSUB MOVSHIP
GOSUB DRAWSHIP
X = U6: Y = V6
AW$ = "OFF"
CIRCLE (UU, VV), 80, H: PAINT (UU, VV), H
VV = VV + 5: IF VV > 630 THEN UU = U: VV = V + 80: CLS
CIRCLE (UU, VV), 80, 14: PAINT (UU, VV), 14
CIRCLE (UU, VV), 40, 12: PAINT (UU, VV), 12
CIRCLE (UU, VV), 20, 4: PAINT (UU, VV), 4
IF X > UU - 80 AND X < UU + 80 AND Y > VV - 80 AND Y < VV + 80 AND INV$ = "OFF" THEN EP = 3: GOSUB HIT
RETURN

STAGE12:
IF Q < 90 AND RNDM = 5 AND U > 320 THEN Q = Q + 1: CLS
IF Q < 90 AND AW$ <> "DONE" THEN U$ = "LEFT": V$ = "DOWN": AW$ = "DONE"
IF Q >= 90 THEN U$ = "": V$ = "": AW$ = "OFF"
IF STAGE = 13 THEN CIRCLE (U, V), 30, H: PAINT (U, V), H
IF STAGE = 13 THEN LINE (U - 30, V - 30)-(U + 30, V - 35), H, BF
IF STAGE = 13 THEN LINE (U - 30, V + 30)-(U + 30, V + 35), H, BF
IF STAGE = 13 THEN LINE (U - 31, V - 31)-(U + 31, V + 31), H, B
IF STAGE = 15 THEN CIRCLE (U, V), 30, H: PAINT (U, V), H
IF STAGE = 17 THEN LINE (U - 30, V - 30)-(U + 30, V + 30), H, BF
GOSUB MOV
RRR = INT(14 * RND) + 1
IF STAGE = 13 THEN CIRCLE (U, V), 30, RRR: PAINT (U, V), RRR
IF STAGE = 13 THEN LINE (U - 30, V - 30)-(U + 30, V - 35), RRR, BF
IF STAGE = 13 THEN LINE (U - 30, V + 30)-(U + 30, V + 35), RRR, BF
IF STAGE = 13 THEN LINE (U - 31, V - 31)-(U + 31, V + 31), RRR, B
IF STAGE = 15 THEN CIRCLE (U, V), 30, RRR: PAINT (U, V), RRR
IF STAGE = 17 THEN LINE (U - 30, V)-(U - 10, V - 10), 9: LINE (U + 30, V)-(U + 10, V - 10), 9: LINE (U + 10, V - 10)-(U - 10, V - 10), 9
IF STAGE = 17 THEN LINE (U - 30, V)-(U - 10, V + 10), 9: LINE (U + 30, V)-(U + 10, V + 10), 9: LINE (U + 10, V + 10)-(U - 10, V + 10), 9
IF STAGE = 17 THEN PAINT (U, V), 9: LINE (U - 30, V - 2)-(U + 30, V + 2), H, BF
IF STAGE = 17 THEN CIRCLE (U, V), 30, 14: LINE (U - 10, V - 8)-(U + 10, V - 6), RRR, BF: LINE (U - 10, V + 8)-(U + 10, V + 6), RRR, BF
IF UU = 0 OR U2 = 0 OR U3 = 0 OR U4 = 0 THEN UU = 0: U2 = 0: U3 = 640: U4 = 640: U5 = 0: U6 = 640: U7 = 0: U8 = 640
CIRCLE (UU, VV), 8, H: PAINT (UU, VV), H
CIRCLE (U2, V2), 8, H: PAINT (U2, V2), H
CIRCLE (U3, V3), 8, H: PAINT (U3, V3), H
CIRCLE (U4, V4), 8, H: PAINT (U4, V4), H
CIRCLE (U5, V5), 8, H: PAINT (U5, V5), H
CIRCLE (U6, V6), 8, H: PAINT (U6, V6), H
CIRCLE (U7, V7), 10, H: PAINT (U7, V7), H
CIRCLE (U8, V8), 10, H: PAINT (U8, V8), H
IF X > U - 30 AND X < U + 30 AND Y > V - 30 AND Y < V + 30 AND INV$ = "OFF" THEN EP = 5: GOSUB HIT
IF X > UU - 16 AND X < UU + 16 AND Y > VV - 16 AND Y < VV + 16 AND INV$ = "OFF" THEN EP = 3: GOSUB HIT
IF X > U2 - 16 AND X < U2 + 16 AND Y > V2 - 16 AND Y < V2 + 16 AND INV$ = "OFF" THEN EP = 3: GOSUB HIT
IF X > U3 - 16 AND X < U3 + 16 AND Y > V3 - 16 AND Y < V3 + 16 AND INV$ = "OFF" THEN EP = 3: GOSUB HIT
IF X > U4 - 16 AND X < U4 + 16 AND Y > V4 - 16 AND Y < V4 + 16 AND INV$ = "OFF" THEN EP = 3: GOSUB HIT
IF X > U5 - 16 AND X < U5 + 16 AND Y > V5 - 16 AND Y < V5 + 16 AND INV$ = "OFF" THEN EP = 3: GOSUB HIT
IF X > U6 - 16 AND X < U6 + 16 AND Y > V6 - 16 AND Y < V6 + 16 AND INV$ = "OFF" THEN EP = 3: GOSUB HIT
IF X > U7 - 20 AND X < U7 + 20 AND Y > V7 - 20 AND Y < V7 + 20 AND INV$ = "OFF" THEN EP = 2: GOSUB HIT
IF X > U8 - 20 AND X < U8 + 20 AND Y > V8 - 20 AND Y < V8 + 20 AND INV$ = "OFF" THEN EP = 2: GOSUB HIT
UU = UU - 5
U2 = U2 - 5: V2 = V2 + 4
U3 = U3 + 5
U4 = U4 + 5: V4 = V4 + 4
V5 = V5 - 5: V7 = V7 + 6
V6 = V6 + 5: V8 = V8 + 6
U7 = U7 + INT(15 * RND)
U8 = U8 - INT(15 * RND)
IF U7 < 20 OR U7 > 600 OR V7 < 20 OR V7 > 330 THEN U7 = U: V7 = V
IF U8 < 20 OR U8 > 600 OR V8 < 20 OR V8 > 330 THEN U8 = U: V8 = V
IF UU < 20 OR VV < 20 THEN UU = U - 15: VV = V - 15
IF U2 < 20 OR V2 > 330 THEN U2 = U - 15: V2 = V + 15
IF U3 > 600 OR V3 < 20 THEN U3 = U + 15: V3 = V - 15
IF U4 > 600 OR V4 > 330 THEN U4 = U + 15: V4 = V + 15
IF U5 < 20 OR V5 < 20 THEN U5 = U: V5 = V
IF U6 > 600 OR V6 > 330 THEN U6 = U: V6 = V
CIRCLE (UU, VV), 8, 2: PAINT (UU, VV), 2
CIRCLE (U2, V2), 8, 6: PAINT (U2, V2), 6
CIRCLE (U3, V3), 8, 4: PAINT (U3, V3), 4
CIRCLE (U4, V4), 8, 14: PAINT (U4, V4), 14
CIRCLE (U5, V5), 8, 12: PAINT (U5, V5), 12
CIRCLE (U6, V6), 8, 1: PAINT (U6, V6), 1
CIRCLE (U7, V7), 10, 3: PAINT (U7, V7), 3
CIRCLE (U8, V8), 10, 5: PAINT (U8, V8), 5
IF Q < 12 THEN CIRCLE (U, V - 20), 2, H: PAINT (U, V - 20), H
IF Q < 20 THEN CIRCLE (U - 20, V + 10), 5, H: PAINT (U - 20, V + 10), H
IF Q < 25 THEN CIRCLE (U + 10, V - 3), 1, H
IF Q < 8 THEN CIRCLE (U - 10, V + 15), 10, H: PAINT (U - 10, V + 15), H
IF Q < 90 THEN GOSUB CHSRND
IF Q < 90 AND RNDM = 5 THEN CIRCLE (U + INT(30 * RND), V + INT(30 * RND)), 4, 4
RETURN

STAGE19:
COLOR 15, H
CIRCLE (U, V), 25, H: PAINT (U, V), H
GOSUB CHSRND: IF RNDM = 15 AND H = 10 THEN U = INT(520 * RND): V = INT(350 * RND): IF X > U - 25 AND X < U + 25 THEN U = X + 50
GOSUB MOV
IF X > U - 25 AND X < U + 25 AND Y > V - 25 AND Y < V + 25 AND INV$ = "OFF" THEN EP = 3: GOSUB HIT
H = INT(14 * RND) + 1
GG = INT(14 * RND) + 1
CIRCLE (U, V), 25, GG: PAINT (U, V), GG
66 RH = RH + 1: UV = INT(14 * RND) + 1
CIRCLE (U, V), RH, UV
IF RH < 25 THEN 66
RH = 0
IF Q < 12 THEN CIRCLE (U, V - 20), 2, H: PAINT (U, V - 20), H
IF Q < 20 THEN CIRCLE (U - 20, V + 10), 5, H: PAINT (U - 20, V + 10), H
IF Q < 25 THEN CIRCLE (U + 10, V - 3), 1, H
IF Q < 8 THEN CIRCLE (U - 10, V + 15), 10, H: PAINT (U - 10, V + 15), H
RETURN

STAGE21:
GOSUB ERASHIP: Y = Y - 3: GOSUB DRAWSHIP: RH = INT(20 * RND) + 1: U = INT(620 * RND): V = INT(310 * RND): CIRCLE (U, V), RH, 4: PAINT (U, V), 4
IF Y <= -10 THEN Q = 0
RH = INT(20 * RND) + 1: U = INT(620 * RND): V = INT(350 * RND): CIRCLE (U, V), RH, 12: PAINT (U, V), 12
RETURN

STAGE22:
X = 320: Y = 175
LOCATE 2, 37: PRINT "THE END?"
LINE (4, 4)-(220, 125), G: LINE (4, 4)-(616, 346), G, B: LINE (616, 4)-(420, 125), G
LINE (616, 346)-(420, 225), G: LINE (4, 346)-(220, 225), G: GOSUB DRAWSHIP: LINE (220, 225)-(420, 125), 15, BF
LOCATE 4, 37: PRINT SHIP$
GOSUB DRAWSHIP
CHO$ = INKEY$
IF CHO$ = CHR$(13) THEN Q = 0: STAGE = 0
RETURN

MOVSHIP:
GOSUB CHSRND
IF RNDM = 7 AND V > 30 THEN V$ = "UP"
IF RNDM = 8 AND V < 330 THEN V$ = "DOWN"
IF RNDM > 5 AND X < U AND U > 20 THEN U$ = "LEFT": V$ = ""
IF RNDM > 5 AND X > U AND U < 600 THEN U$ = "RIGHT": V$ = ""
GOSUB ERASHIP
GOSUB MOV
RETURN

CHSRND:
RNDM = INT(30 * RND)
IF Y > VV THEN VV$ = "DOWN"
IF Y < VV THEN VV$ = "UP"
IF RNDM > 15 THEN UU$ = "LEFT"
IF RNDM < 15 THEN UU$ = "RIGHT"
RETURN

MOV:
IF U$ = "RIGHT" THEN U = U + ESP
IF U$ = "LEFT" THEN U = U - ESP
IF STAGE = 5 THEN ESP = INT(8 * RND)
IF STAGE = 10 AND V$ = "UP" THEN V = V - 5
IF STAGE = 10 AND V$ = "DOWN" THEN V = V + 5
IF V$ = "UP" THEN V = V - ESP
IF V$ = "DOWN" THEN V = V + ESP
IF V$ = "UP" AND ENEMY$ = "DOWNFALL" THEN VV = VV - ESP
IF V$ = "DOWN" AND ENEMY$ = "DOWNFALL" THEN VV = VV + ESP
IF STAGE = 14 THEN GOSUB CHSRND
IF STAGE = 14 AND ESP = 5 AND Y > V AND RNDM > 15 THEN V$ = "DOWN"
IF U > 600 AND ENEMY$ <> "DOWNFALL" THEN U$ = "LEFT"
IF U < 50 AND ENEMY$ <> "DOWNFALL" THEN U$ = "RIGHT"
IF V < 50 AND ENEMY$ <> "DOWNFALL" THEN V$ = "DOWN"
IF V > 320 AND ENEMY$ <> "DOWNFALL" THEN V$ = "UP"
IF V < -30 AND ENEMY$ = "DOWNFALL" THEN U = X: V$ = "DOWN": UU = INT(600 * RND) + 20
IF V > 390 AND ENEMY$ = "DOWNFALL" THEN U = X: V$ = "UP": UU = INT(600 * RND) + 20
IF U > 600 AND ENEMY$ = "DOWNFALL" THEN U$ = "LEFT"
IF U < 20 AND ENEMY$ = "DOWNFALL" THEN U$ = "RIGHT"
IF U$ = "RIGHT" AND ENEMY$ = "DOWNFALL" THEN U = U + 5
IF U$ = "LEFT" AND ENEMY$ = "DOWNFALL" THEN U = U + 5
RETURN

HIT:
SOUND 100, 1: SOUND 1000, 1: SOUND 5000, 1: SOUND 100, 1
CLS
IF GUN$ = "Kamikaze" AND X > U - HPA AND X < U + HPB AND Y < V + HPC AND Y > V - HPD THEN GOSUB EHIT
INV$ = "ON": INV = 90
LINE (62, 17)-(ENERGY + 62, 24), H, BF
ENERGY = ENERGY - EP
LINE (62, 17)-(ENERGY + 62, 24), EK, BF
RETURN

WEP1:
IF FIREA$ = "ON" OR FIREB$ = "ON" OR FIREC$ = "ON" OR FIRED$ = "ON" OR FIREE$ = "ON" THEN WEP$ = "WEP1": RETURN
IF GUN$ = "Shrink" THEN GOSUB ERASHIP: FOR JE = 1 TO 100: T(JE) = JE * 2: NEXT JE
IF SHIP$ = "Star Base" OR SHIP$ = "Phantom" OR SHIP$ = "Star Tank" OR SHIP$ = "Dark Spire" OR SHIP$ = "Zodiac" OR SHIP$ = "Crusade" THEN GUN$ = "Pellet": POWER = 6
IF SHIP$ = "Oval" THEN GUN$ = "Triple Shot": POWER = 4
IF SHIP$ = "Paladon" THEN GUN$ = "Laser": POWER = 1
IF SHIP$ = "Ediion" THEN GUN$ = "Laser": POWER = 1
RETURN

WEP2:
IF FIREA$ = "ON" OR FIREB$ = "ON" OR FIREC$ = "ON" OR FIRED$ = "ON" OR FIREE$ = "ON" THEN WEP$ = "WEP2": RETURN
IF GUN$ = "Shrink" THEN GOSUB ERASHIP: FOR JE = 1 TO 100: T(JE) = JE * 2: NEXT JE
IF SHIP$ = "Dark Spire" THEN GUN$ = "Side Charge": POWER = 8
IF SHIP$ = "Star Base" OR SHIP$ = "Oval" THEN GUN$ = "Spread": POWER = 2
IF SHIP$ = "Phantom" THEN GUN$ = "Double": POWER = 4
IF SHIP$ = "Paladon" THEN GUN$ = "Triple Shot": POWER = 4
IF SHIP$ = "Star Tank" THEN GUN$ = "Spread": POWER = 2
IF SHIP$ = "Zodiac" THEN GUN$ = "Laser": POWER = 1
IF SHIP$ = "Crusade" THEN GUN$ = "Double": POWER = 4
IF SHIP$ = "Ediion" THEN GUN$ = "Triple Shot": POWER = 4
RETURN

WEP3:
IF FIREA$ = "ON" OR FIREB$ = "ON" OR FIREC$ = "ON" OR FIRED$ = "ON" OR FIREE$ = "ON" THEN WEP$ = "WEP3": RETURN
IF SHIP$ = "Dark Spire" OR SHIP$ = "Ediion" THEN GUN$ = "Flare": POWER = 12
IF SHIP$ = "Star Base" OR SHIP$ = "Oval" THEN GUN$ = "Side Shot": POWER = 6
IF SHIP$ = "Phantom" THEN GUN$ = "Teleport": POWER = 0
IF SHIP$ = "Star Tank" THEN GUN$ = "Triple Shot": POWER = 4
IF SHIP$ = "Paladon" THEN GUN$ = "Quark": POWER = 2
IF SHIP$ = "Zodiac" THEN GUN$ = "Triple Shot": POWER = 4
IF SHIP$ = "Crusade" THEN GUN$ = "Laser": POWER = 1
RETURN

WEP4:
IF FIREA$ = "ON" OR FIREB$ = "ON" OR FIREC$ = "ON" OR FIRED$ = "ON" OR FIREE$ = "ON" THEN WEP$ = "WEP4": RETURN
IF GUN$ = "Shrink" THEN GOSUB ERASHIP: FOR JE = 1 TO 100: T(JE) = JE * 2: NEXT JE
IF SHIP$ = "Star Base" THEN GUN$ = "Charge": POWER = 8
IF SHIP$ = "Phantom" OR SHIP$ = "Oval" THEN GUN$ = "Double Charge": POWER = 8
IF SHIP$ = "Star Tank" THEN GUN$ = "Quark": POWER = 6
IF SHIP$ = "Paladon" THEN GUN$ = "Teleport": POWER = 0
IF SHIP$ = "Dark Spire" THEN GUN$ = "Laser": POWER = 1
IF SHIP$ = "Zodiac" OR SHIP$ = "Ediion" THEN GUN$ = "Spread": POWER = 2
IF SHIP$ = "Crusade" THEN GUN$ = "Triple Shot": POWER = 4
RETURN

WEP5:
IF FIREA$ = "ON" OR FIREB$ = "ON" OR FIREC$ = "ON" OR FIRED$ = "ON" OR FIREE$ = "ON" THEN WEP$ = "WEP5": RETURN
IF GUN$ = "Shrink" THEN GOSUB ERASHIP: FOR JE = 1 TO 100: T(JE) = JE * 2: NEXT JE
IF SHIP$ = "Star Base" THEN GUN$ = "Quark": POWER = 6
IF SHIP$ = "Phantom" THEN GUN$ = "Laser": POWER = 1
IF SHIP$ = "Oval" OR SHIP$ = "Ediion" THEN GUN$ = "Heats": POWER = 1
IF SHIP$ = "Star Tank" THEN GUN$ = "Triple Down": POWER = 5
IF SHIP$ = "Paladon" THEN GUN$ = "Charge": POWER = 8
IF SHIP$ = "Dark Spire" THEN GUN$ = "Teleport": POWER = 0
IF SHIP$ = "Zodiac" THEN GUN$ = "Triple Down": POWER = 5
IF SHIP$ = "Crusade" THEN GUN$ = "Double Charge": POWER = 8
RETURN

WEP6:
IF SHIP$ = "Zodiac" OR SHIP$ = "Crusade" THEN GUN$ = "Flare": POWER = 12
IF SHIP$ = "Ediion" THEN GUN$ = "Triple Down": POWER = 5
RETURN

WEP7:
IF SHIP$ = "Zodiac" THEN GUN$ = "Double Charge": POWER = 8
IF SHIP$ = "Crusade" THEN GUN$ = "Heats": POWER = 1
IF SHIP$ = "Ediion" THEN GUN$ = "Side Charge": POWER = 8
RETURN

WEP8:
IF SHIP$ = "Zodiac" THEN GUN$ = "Teleport": POWER = 0
IF SHIP$ = "Crusade" THEN GUN$ = "Spread": POWER = 2
RETURN

WEP9:
IF SHIP$ = "Zodiac" THEN GUN$ = "Heats": POWER = 1
IF SHIP$ = "Crusade" THEN GUN$ = "Side Charge": POWER = 8
RETURN

SHOTA:
IF GUN$ = "Side Charge" THEN CIRCLE (A, AA), 6, H: PAINT (A, AA), H
IF GUN$ = "Flare" THEN CIRCLE (A, AA), HH, H: PAINT (A, AA), H: HH = HH + 1
IF GUN$ = "Triple Shot" OR GUN$ = "Heats" OR GUN$ = "Triple Down" THEN LINE (A - 2, AA)-(A + 2, AA - 4), H, BF
IF GUN$ = "Laser" THEN LINE (A - 15, Y)-(A + 15, 0), H, BF
IF GUN$ = "Charge" OR GUN$ = "Double Charge" THEN CIRCLE (A, AA), 6, H: PAINT (A, AA), H
IF GUN$ = "Pellet" OR GUN$ = "Spread" OR GUN$ = "Quark" THEN CIRCLE (A, AA), 4, H: PAINT (A, AA), H: AA = AA - 2
IF GUN$ = "Side Shot" THEN CIRCLE (A, AA), 4, H: PAINT (A, AA), H: A = A - 2
IF GUN$ = "Double" THEN CIRCLE (A, AA), 3, H: PAINT (A, AA), H: AA = AA - 6
IF GUN$ = "Spread" THEN A = A - 2
IF AA < 10 AND GUN$ = "Laser" THEN FIREA$ = "OFF": AA = Y - T(1): A = X: LINE (A - 25, Y)-(A + 25, 0), H, BF: RETURN
IF AA < 10 OR AA > 360 OR A < 5 OR A > 615 OR HH > 50 THEN NN = .5: FIREA$ = "OFF": AA = Y - T(1): A = X: HH = 1: RETURN
IF GUN$ = "Pellet" OR GUN$ = "Spread" OR GUN$ = "Side Shot" OR GUN$ = "Quark" THEN CIRCLE (A, AA), 4, 4: PAINT (A, AA), 4
IF GUN$ = "Charge" OR GUN$ = "Double Charge" THEN AA = AA - 3: CIRCLE (A, AA), 6, 9: PAINT (A, AA), 9
IF GUN$ = "Side Charge" THEN A = A - 3: CIRCLE (A, AA), 6, 9: PAINT (A, AA), 9
IF GUN$ = "Double" THEN CIRCLE (A, AA), 3, 14: PAINT (A, AA), 14
IF GUN$ = "Laser" THEN AA = AA - 75: LINE (X - T(1), Y - T(6))-(X + T(1), 0), 14, BF: LINE (X - T(1), Y - T(6))-(X + T(1), 0), 4, BF: LINE (X - T(1), Y - T(6))-(X + T(1), 0), 12, BF
IF GUN$ = "Laser" THEN LINE (A - 15, Y)-(A + 15, 0), H, BF
IF GUN$ = "Heats" AND V > AA THEN AA = AA + 5
IF GUN$ = "Heats" AND V < AA THEN AA = AA - 5
IF GUN$ = "Heats" AND U > A THEN A = A + 5
IF GUN$ = "Heats" AND U < A THEN A = A - 5
IF GUN$ = "Triple Shot" THEN AA = AA - 4
IF GUN$ = "Triple Down" THEN AA = AA + 4
IF GUN$ = "Triple Shot" OR GUN$ = "Triple Down" THEN LINE (A - 2, AA)-(A + 2, AA - 4), 14, BF
IF GUN$ = "Heats" THEN LINE (A - 2, AA)-(A + 2, AA - 4), 12, BF
IF GUN$ = "Flare" THEN CIRCLE (A, AA), HH, 4: PAINT (A, AA), 4: CIRCLE (A, AA), HH, 12: PAINT (A, AA), 12
RETURN

SHOTB:
IF GUN$ = "Side Charge" THEN CIRCLE (B, BB), 6, H: PAINT (B, BB), H
IF GUN$ = "Triple Shot" OR GUN$ = "Heats" OR GUN$ = "Triple Down" THEN LINE (B - 2, BB)-(B + 2, BB - 4), H, BF
IF GUN$ = "Double Charge" THEN CIRCLE (B, BB), 6, H: PAINT (B, BB), H
IF GUN$ = "Pellet" OR GUN$ = "Spread" THEN CIRCLE (B, BB), 4, H: PAINT (B, BB), H: BB = BB - 2
IF GUN$ = "Quark" THEN CIRCLE (B, BB), 4, H: PAINT (B, BB), H: BB = BB + 2
IF GUN$ = "Side Shot" THEN CIRCLE (B, BB), 4, H: PAINT (B, BB), H: B = B + 2
IF GUN$ = "Double" THEN CIRCLE (B, BB), 3, H: PAINT (B, BB), H: BB = BB - 6
IF GUN$ = "Spread" THEN B = B - 1
IF BB < 10 OR BB > 360 OR B < 5 OR B > 615 THEN NN = .5: FIREB$ = "OFF": BB = Y - T(1): B = X: RETURN
IF GUN$ = "Heats" AND V > BB THEN BB = BB + 4
IF GUN$ = "Heats" AND V < BB THEN BB = BB - 4
IF GUN$ = "Heats" AND U > B THEN B = B + 4
IF GUN$ = "Heats" AND U < B THEN B = B - 4
IF GUN$ = "Pellet" OR GUN$ = "Spread" OR GUN$ = "Side Shot" OR GUN$ = "Quark" THEN CIRCLE (B, BB), 4, 4: PAINT (B, BB), 4
IF GUN$ = "Double" THEN CIRCLE (B, BB), 3, 14: PAINT (B, BB), 14
IF GUN$ = "Double Charge" THEN BB = BB - 3: CIRCLE (B, BB), 6, 9: PAINT (B, BB), 9
IF GUN$ = "Side Charge" THEN B = B + 3: CIRCLE (B, BB), 6, 9: PAINT (B, BB), 9
IF GUN$ = "Triple Down" THEN BB = BB + 5
IF GUN$ = "Triple Down" THEN LINE (B - 2, BB)-(B + 2, BB - 4), 14, BF
IF GUN$ = "Heats" THEN LINE (B - 2, BB)-(B + 2, BB - 4), 4, BF
IF GUN$ = "Triple Shot" THEN BB = BB - 5: LINE (B - 2, BB)-(B + 2, BB - 4), 14, BF
RETURN

SHOTC:
IF GUN$ = "Triple Shot" OR GUN$ = "Heats" OR GUN$ = "Triple Down" THEN LINE (C - 2, CC)-(C + 2, CC - 4), H, BF
IF GUN$ = "Pellet" OR GUN$ = "Spread" THEN CIRCLE (C, CC), 4, H: PAINT (C, CC), H: CC = CC - 2
IF CC < 10 OR CC > 360 OR C < 5 OR C > 615 THEN NN = .5: FIREC$ = "OFF": CC = Y - T(1): C = X: RETURN
IF GUN$ = "Heats" AND V > CC THEN CC = CC + 7
IF GUN$ = "Heats" AND V < CC THEN CC = CC - 7
IF GUN$ = "Heats" AND U > C THEN C = C + 7
IF GUN$ = "Heats" AND U < C THEN C = C - 7
IF GUN$ = "Triple Down" THEN CC = CC + 5
IF GUN$ = "Heats" OR GUN$ = "Triple Down" THEN LINE (C - 2, CC)-(C + 2, CC - 4), 14, BF
IF GUN$ = "Pellet" OR GUN$ = "Spread" THEN CIRCLE (C, CC), 4, 4: PAINT (C, CC), 4
IF GUN$ = "Triple Shot" THEN CC = CC - 5: LINE (C - 2, CC)-(C + 2, CC - 4), 14, BF
RETURN

SHOTD:
IF GUN$ = "Heats" THEN LINE (D - 2, DD)-(D + 2, DD - 4), H, BF
IF GUN$ = "Spread" THEN CIRCLE (D, DD), 4, H: PAINT (D, DD), H: DD = DD - 2
IF GUN$ = "Spread" THEN D = D + 1
IF DD < 10 OR DD > 360 OR D < 5 OR D > 615 THEN NN = .5: FIRED$ = "OFF": DD = Y - T(1): D = X: RETURN
IF GUN$ = "Spread" THEN CIRCLE (D, DD), 4, 4: PAINT (D, DD), 4
IF GUN$ = "Heats" AND V > DD THEN DD = DD + 3
IF GUN$ = "Heats" AND V < DD THEN DD = DD - 3
IF GUN$ = "Heats" AND U > D THEN D = D + 3
IF GUN$ = "Heats" AND U < D THEN D = D - 3
IF GUN$ = "Heats" THEN LINE (D - 2, DD)-(D + 2, DD - 4), 9, BF
RETURN

SHOTE:
IF GUN$ = "Heats" THEN LINE (E - 2, EE)-(E + 2, EE - 4), H, BF
IF GUN$ = "Spread" THEN CIRCLE (E, EE), 4, H: PAINT (E, EE), H: EE = EE - 2
IF GUN$ = "Spread" THEN E = E + 2
IF EE < 10 OR EE > 360 OR E < 5 OR E > 615 THEN NN = .5: FIREE$ = "OFF": EE = Y - T(1): E = X: RETURN
IF GUN$ = "Heats" AND V > EE THEN EE = EE + 6
IF GUN$ = "Heats" AND V < EE THEN EE = EE - 6
IF GUN$ = "Heats" AND U > E THEN E = E + 6
IF GUN$ = "Heats" AND U < E THEN E = E - 6
IF GUN$ = "Heats" THEN LINE (E - 2, EE)-(E + 2, EE - 4), 2, BF
IF GUN$ = "Spread" THEN CIRCLE (E, EE), 4, 4: PAINT (E, EE), 4
RETURN

FIREA:
IF GUN$ = "Kamikaze" THEN RETURN
IF GUN$ = "Teleport" THEN GOSUB ERASHIP: X = INT(570 * RND) + 30: Y = INT(290 * RND) + 30: RETURN
IF GUN$ = "Spread" AND FIREB$ = "ON" OR GUN$ = "Spread" AND FIREC$ = "ON" OR GUN$ = "Spread" AND FIRED$ = "ON" OR GUN$ = "Spread" AND FIREE$ = "ON" THEN RETURN
IF GUN$ = "Heats" AND FIREA$ = "ON" OR GUN$ = "Heats" AND FIREB$ = "ON" OR GUN$ = "Heats" AND FIREC$ = "ON" OR GUN$ = "Heats" AND FIRED$ = "ON" OR GUN$ = "Heats" AND FIREE$ = "ON" THEN RETURN
IF GUN$ = "Side Shot" AND FIREB$ = "ON" THEN RETURN
IF GUN$ = "Double" AND FIREB$ = "ON" THEN RETURN
IF GUN$ = "Quark" AND FIREB$ = "ON" THEN RETURN
IF GUN$ = "Double Charge" AND FIREB$ = "ON" THEN RETURN
IF GUN$ = "Triple Shot" AND FIREB$ = "ON" OR GUN$ = "Triple Shot" AND FIREC$ = "ON" THEN RETURN
IF GUN$ = "Triple Down" AND FIREB$ = "ON" OR GUN$ = "Triple Down" AND FIREC$ = "ON" THEN RETURN
IF GUN$ = "Side Charge" AND FIREB$ = "ON" THEN RETURN
FIREA$ = "ON"
IF GUN$ = "Triple Shot" THEN GOSUB FIREB: GOSUB FIREC: AA = Y - T(5): BB = Y + T(5): CC = Y + T(5): A = X: B = X - T(13): C = X + T(13): RETURN
IF GUN$ = "Triple Down" THEN GOSUB FIREB: GOSUB FIREC: AA = Y + T(5): BB = Y + T(10): CC = Y + T(10): A = X: B = X - T(13): C = X + T(13): RETURN
IF GUN$ = "Quark" THEN GOSUB FIREB
IF GUN$ = "Side Charge" THEN GOSUB FIREB: AA = Y: BB = Y: A = X - T(4): B = X + T(4): RETURN
IF GUN$ = "Side Shot" THEN GOSUB FIREB: AA = Y - T(1): A = X - T(3): BB = Y - T(1): B = X + T(3): RETURN
IF GUN$ = "Spread" THEN GOSUB FIREB: GOSUB FIREC: GOSUB FIRED: GOSUB FIREE: A = X - T(4): E = X + T(4): B = X - T(2): D = X + T(2)
IF GUN$ = "Heats" THEN TT = 200: GOSUB FIREB: GOSUB FIREC: GOSUB FIRED: GOSUB FIREE: A = X - T(7): B = X + T(5): D = X - T(5): C = X: CC = Y - T(2): E = X + T(7): AA = Y: BB = Y + T(2): DD = Y + T(2): EE = Y: RETURN
IF GUN$ = "Double" OR GUN$ = "Double Charge" THEN GOSUB FIREB: AA = Y - T(6): A = X - T(10): B = X + T(10): BB = Y - T(6): RETURN
AA = Y: A = X
RETURN

FIREB:
IF GUN$ = "Charge" OR GUN$ = "Laser" OR GUN$ = "Teleport" THEN RETURN
IF GUN$ = "Flare" THEN RETURN
FIREB$ = "ON"
BB = Y: B = X
RETURN

FIREC:
IF GUN$ = "Side Shot" OR GUN$ = "Charge" OR GUN$ = "Quark" OR GUN$ = "Double" THEN RETURN
IF GUN$ = "Double Charge" OR GUN$ = "Teleport" OR GUN$ = "Flare" THEN RETURN
FIREC$ = "ON"
CC = Y: C = X
RETURN

FIRED:
IF GUN$ = "Pellet" OR GUN$ = "Side Shot" OR GUN$ = "Charge" OR GUN$ = "Quark" THEN RETURN
IF GUN$ = "Double" OR GUN$ = "Triple Down" OR GUN$ = "Teleport" THEN RETURN
IF GUN$ = "Triple Shot" OR GUN$ = "Flare" THEN RETURN
FIRED$ = "ON"
DD = Y: D = X
RETURN

FIREE:
IF GUN$ = "Pellet" OR GUN$ = "Side Shot" OR GUN$ = "Charge" OR GUN$ = "Quark" THEN RETURN
IF GUN$ = "Double" OR GUN$ = "Triple Shot" OR GUN$ = "Triple Down" THEN RETURN
IF GUN$ = "Teleport" OR GUN$ = "Flare" THEN RETURN
FIREE$ = "ON"
EE = Y: E = X
RETURN

MLEFT:
IF X < 30 AND SHIP$ = "Phantom" THEN GOSUB ERASHIP: X = 590
IF X < 30 THEN RETURN
GOSUB ERASHIP
X = X - SPEED
RETURN

MUP:
IF Y < 50 AND SHIP$ = "Phantom" THEN GOSUB ERASHIP: Y = 330
IF Y < 50 THEN RETURN
GOSUB ERASHIP
Y = Y - SPEED
RETURN

MDOWN:
IF Y > 330 AND SHIP$ = "Phantom" THEN GOSUB ERASHIP: Y = 50
IF Y > 330 THEN RETURN
GOSUB ERASHIP
Y = Y + SPEED
RETURN

MRIGHT:
IF X > 590 AND SHIP$ = "Phantom" THEN GOSUB ERASHIP: X = 30
IF X > 590 THEN RETURN
GOSUB ERASHIP
X = X + SPEED
RETURN

DRAWSHIP:
IF SHIP$ = "Ediion" THEN G = INT(15 * RND): F = F + 1: LA = INT(15 * RND): LB = INT(15 * RND): IF F > 3 THEN F = 0
IF SHIP$ = "Star Tank" THEN G = 4: F = 1: LA = 12
IF SHIP$ = "Phantom" THEN G = 4: F = 14
IF SHIP$ = "Star Base" THEN G = 1: F = 1
IF SHIP$ = "Oval" THEN G = 9: F = 2
IF SHIP$ = "Paladon" THEN G = 2: F = 4: LA = 12: LB = 14: LC = 1
IF SHIP$ = "Dark Spire" THEN G = 1: F = 4
IF SHIP$ = "Zodiac" THEN G = 4: F = 15
IF SHIP$ = "Crusade" THEN G = 14: F = 1
IF INV$ = "ON" THEN G = INT(13 * RND) + 2
IF INV$ = "ON" THEN F = INT(13 * RND) + 2
IF SHIP$ = "Crusade" THEN GOSUB CRUSADE: RETURN
IF SHIP$ = "Star Base" THEN GOSUB STARBASE: RETURN
IF SHIP$ = "Phantom" THEN GOSUB PHANTOM: RETURN
IF SHIP$ = "Oval" THEN GOSUB OVAL: RETURN
IF SHIP$ = "Paladon" OR SHIP$ = "Ediion" THEN GOSUB SIR: RETURN
IF SHIP$ = "Star Tank" THEN GOSUB TANK: RETURN
IF SHIP$ = "Dark Spire" OR SHIP$ = "Zodiac" THEN GOSUB SPIRE: RETURN
RETURN

ERASHIP:
G = H: F = H
IF SHIP$ = "Paladon" THEN LA = H: LB = H: LC = H
IF SHIP$ = "Star Base" THEN GOSUB STARBASE: RETURN
IF SHIP$ = "Phantom" THEN GOSUB PHANTOM: RETURN
IF SHIP$ = "Oval" THEN GOSUB OVAL: RETURN
IF SHIP$ = "Star Tank" THEN GOSUB TANK: RETURN
IF SHIP$ = "Zodiac" OR SHIP$ = "Ediion" OR SHIP$ = "Paladon" OR SHIP$ = "Dark Spire" THEN GOSUB BOXOR: RETURN
IF SHIP$ = "Crusade" THEN GOSUB CRUSADE: RETURN
RETURN

STARBASE:
LINE (X - T(15), Y + T(6))-(X - T(15), Y + T(8)), G
LINE (X + T(15), Y + T(6))-(X + T(15), Y + T(8)), G
LINE (X - T(15), Y + T(6))-(X + T(15), Y + T(6)), G
LINE (X - T(15), Y + T(8))-(X - T(10), Y + T(4)), G
LINE (X - T(10), Y + T(4))-(X - T(5), Y + T(2)), G
LINE (X - T(5), Y + T(2))-(X, Y), G
LINE (X, Y)-(X + T(5), Y + T(2)), G
LINE (X + T(5), Y + T(2))-(X + T(10), Y + T(4)), G
LINE (X + T(10), Y + T(4))-(X + T(15), Y + T(8)), G
PAINT (X, Y + T(2)), G
CIRCLE (X, Y), T(3), F: PAINT (X, Y - T(1)), F
RETURN

PHANTOM:
LINE (X - T(10), Y + T(6))-(X + T(10), Y + T(5)), F, BF: LINE (X, Y - T(6))-(X - T(10), Y + T(6)), F: LINE (X, Y - T(6))-(X + T(10), Y + T(6)), F
PAINT (X, Y), F
CIRCLE (X, Y), T(1), G: PAINT (X, Y), G
CIRCLE (X, Y + T(3)), T(2), G: PAINT (X, Y + T(3)), G
LINE (X - T(10), Y + T(6))-(X - T(8), Y), F, BF: LINE (X + T(10), Y + T(6))-(X + T(8), Y), F, BF
LINE (X - T(8), Y + T(6))-(X - T(7), Y + T(3)), G, BF: LINE (X + T(8), Y + T(6))-(X + T(7), Y + T(3)), G, BF
CIRCLE (X - T(9), Y + T(1)), T(1), G: PAINT (X - T(9), Y + T(1)), G
CIRCLE (X + T(9), Y + T(1)), T(1), G: PAINT (X + T(9), Y + T(1)), G
RETURN

OVAL:
LINE (X - T(13), Y + T(5))-(X + T(13), Y + T(6)), G, BF
LINE (X - T(13), Y + T(5))-(X, Y - T(6)), G: LINE (X + T(13), Y + T(5))-(X, Y - T(6)), G
PAINT (X, Y + T(1)), G
CIRCLE (X - T(13), Y + T(5)), T(5), F: CIRCLE (X + T(13), Y + T(5)), T(5), F: CIRCLE (X, Y - T(5)), T(5), F
PAINT (X - T(14), Y + T(6)), F: PAINT (X + T(14), Y + T(6)), F: PAINT (X, Y - T(7)), F
RETURN

SIR:
sx = X: sy = Y
LINE (sx - T(10), sy)-(sx + T(10), sy), G
LINE (sx - T(10), sy)-(sx, sy - T(15)), G
LINE (sx + T(10), sy)-(sx, sy - T(15)), G
PAINT (sx, sy - T(5)), G
LINE (sx - T(4), sy)-(sx - T(4), sy - T(11)), H
LINE (sx + T(4), sy)-(sx + T(4), sy - T(11)), H
LINE (sx - T(4), sy - T(9))-(sx - T(6), sy - T(9)), F
LINE (sx + T(5), sy - T(9))-(sx + T(7), sy - T(9)), F
LINE (sx - T(6), sy - T(9))-(sx - T(6), sy - T(7)), F
LINE (sx + T(7), sy - T(9))-(sx + T(7), sy - T(7)), F
PSET (sx - T(5), sy - T(8)), F
PSET (sx + T(6), sy - T(8)), F
CIRCLE (sx, sy - T(8)), T(2), LC
PAINT (sx, sy - T(8)), LC, LC
LINE (sx - T(2), sy + T(1))-(sx, sy + T(3)), LA
LINE (sx + T(2), sy + T(1))-(sx, sy + T(3)), LA
PSET (sx, sy + T(2)), LB
PSET (sx, sy + T(1)), LB
PSET (sx - T(1), sy + T(1)), LB
PSET (sx + T(1), sy + T(1)), LB
RETURN

BOXOR:
LINE (X - T(12), Y + T(7))-(X + T(12), Y - T(15)), H, BF
RETURN

TANK:
LINE (X - T(13), Y + T(9))-(X - T(5), Y - T(8)), G, BF
LINE (X + T(13), Y + T(9))-(X + T(5), Y - T(8)), G, BF
LINE (X - T(5), Y + T(7))-(X + T(5), Y - T(7)), F, BF
CIRCLE (X, Y), T(2), LA: PAINT (X, Y), LA
RETURN

SPIRE:
sx = X: sy = Y
LINE (sx - T(10), sy + T(1))-(sx + T(10), sy + T(1)), G
LINE (sx - T(10), sy + T(1))-(sx, sy - T(15)), G
LINE (sx + T(10), sy + T(1))-(sx, sy - T(15)), G
PAINT (sx, sy - T(5)), G
LINE (sx - T(4), sy + T(1))-(sx - T(3), sy - T(11)), H, BF
LINE (sx + T(4), sy + T(1))-(sx + T(3), sy - T(11)), H, BF
LINE (sx - T(10), sy + T(1))-(sx - T(4), sy - T(5)), F
LINE (sx + T(10), sy + T(1))-(sx + T(4), sy - T(5)), F
LINE (sx - T(1), sy + T(1))-(sx + T(1), sy - T(1)), F, BF
CIRCLE (sx, sy - T(8)), T(2), F
PAINT (sx, sy - T(8)), F, F
RETURN

CRUSADE:
sx = X: sy = Y
LINE (sx - T(10), sy + T(1))-(sx + T(10), sy + T(1)), G
LINE (sx - T(10), sy + T(1))-(sx, sy - T(15)), G
LINE (sx + T(10), sy + T(1))-(sx, sy - T(15)), G
PAINT (sx, sy - T(5)), G
LINE (sx - T(10), sy - T(10))-(sx - T(11), sy - T(8)), F
LINE (sx - T(10), sy - T(5))-(sx - T(11), sy - T(11)), F
LINE (sx + T(10), sy - T(10))-(sx + T(11), sy - T(8)), F
LINE (sx + T(10), sy - T(5))-(sx + T(11), sy - T(11)), F
LINE (sx + T(10), sy + T(10))-(sx + T(11), sy + T(8)), F
LINE (sx + T(10), sy + T(5))-(sx + T(11), sy + T(11)), F
LINE (sx - T(10), sy + T(10))-(sx - T(11), sy + T(8)), F
LINE (sx - T(10), sy + T(5))-(sx - T(11), sy + T(11)), F
CIRCLE (sx, sy - T(2)), T(3), F: PAINT (sx, sy - T(2)), F
CIRCLE (sx, sy - T(8)), T(2), F
PAINT (sx, sy - T(8)), F, F
RETURN

GAMEOVER:
A = 0
GOSUB ERASHIP
FOR JE = 1 TO 100
TE(JE) = Y: TF(JE) = X: T(JE) = X: Stary(JE) = Y
NEXT JE

19 A = A + 1
FOR JE = 1 TO 100
PRESET (T(JE), TE(JE))
T(JE) = T(JE) - 5
IF TE(JE) > 5 AND TE(JE) < 30 THEN TE(JE) = TE(JE) + INT(5 * RND): GOTO 18
TE(JE) = TE(JE) - INT(5 * RND)
18 PSET (T(JE), TE(JE)), 15
NEXT JE
FOR J = 1 TO 100
PRESET (TF(J), Stary(J))
TF(J) = TF(J) + 5
IF Stary(J) > 5 AND Stary(J) < 30 THEN Stary(J) = Stary(J) - INT(5 * RND): GOTO 28
Stary(J) = Stary(J) + INT(5 * RND)
28 PSET (TF(J), Stary(J)), 15
NEXT J
IF A > 75 THEN RUN "SPIRITS.BAS"
GOTO 19

