DECLARE SUB gifload (A$)
DECLARE SUB createbulletsetup (px1%, py1%, bsx1%, bsx2%, bombalert%, readkey$)
DECLARE SUB animatebullet (px1%, py1%, bsx1%, bsx2%, bombalert%, bulletbuffer, brunfirst%)
DECLARE SUB clearupbullet (bombalert%, brunfirst%, bsx1%, bsx2%, bulletbuffer)
DECLARE SUB animatebulletb (px1%, py1%, bsx1b%, bsx2b%, bombalertb%, bulletbufferb, brunfirstb%)
DECLARE SUB clearupbulletb (bombalertb%, brunfirstb%, bsx1b%, bsx2b%, bulletbuffer)
DECLARE SUB createbulletsetupb (px1%, py1%, bsx1b%, bsx2b%, bombalertb%, readkey$)
DECLARE SUB ranmove (bsx1%, bsy1%, bsx1b%, bsy1b%)
DECLARE SUB setupenemy (esx1%, esx2%, enemyalert%, id%, currentenemytotal%, enemyslowdown%)
DECLARE SUB animateenemy (esx1%, esy1%, enemyalert%, enemybuffer, px1%, py1%, efirstrun%, score%, id%, currentenemytotal%)
DECLARE SUB clearupenemy (efirstrun%, enemyalert%, id%, currentenemytotal%, esx1%, esy1%, enemybuffer)
DECLARE SUB fade ()
DIM SHARED playerbuffer(1 TO 3000)
DIM SHARED bulletbuffer(1 TO 2000)
DIM SHARED enemybuffer(1 TO 4000)
DIM SHARED bangbuffer(1 TO 700)
DIM SHARED psx1%
DIM SHARED psx2%
DIM SHARED psy1%
DIM SHARED psy2%
DIM SHARED bsx1%
DIM SHARED bsx2%
DIM SHARED bsy1%
DIM SHARED bsy2%
DIM SHARED bsx1b%
DIM SHARED bsx2b%
DIM SHARED bsy1b%
DIM SHARED bsy2b%
DIM SHARED esx1%(10)
DIM SHARED esy1%(10)
DIM SHARED esx2%
DIM SHARED esy2%
DIM SHARED id%
DIM SHARED currentenemytotal%
DIM SHARED enemyalert%(10)
DIM SHARED efirstrun%(10)
'DIM SHARED colfad(255, 3), col2(255, 3)
'FOR i = 0 TO 255        ' Making a b&w palette to fade to
'FOR j = 1 TO 3          '
'colfad(i, j) = i / 4       '
'NEXT j                  '
'NEXT i                  '
PRINT "Space Invaders the Perpendicular Dimension v1.2 BETA 201202"
gifload "main.gif"
DO
LOOP WHILE INKEY$ = ""
'------------
'ok this variable has to be set before the cheats!
readyforenemy% = 60
'fade
CLS                                     'cheat menu
cheatmenu:
PRINT "+-----------------------------+"
PRINT "| Enter (another) Cheat (y/n) |"
PRINT "+-----------------------------+"
INPUT ":", yesnocheat$
IF yesnocheat$ = "y" THEN GOTO cheat
IF yesnocheat$ = "n" THEN GOTO nocheat
cheat:
INPUT ":", cheat$
IF cheat$ = "rainbowfred89" THEN rcheat$ = "r"
IF cheat$ = "moneyfornothing" THEN scoreinc$ = "s"
IF cheat$ = "kamikazeeattack" THEN kamattack$ = "k"
'IF cheat$ = "colorshift" THEN GOTO colorshiftinput
LOCATE 1, 1
GOTO cheatmenu
'colorshiftinput:    'color shift
'INPUT ":", shift%
'LOCATE 1, 1
'GOTO cheatmenu
nocheat:
PRINT "Loading Variables... "
RANDOMIZE TIMER
psx1% = 1
psx2% = 100
psy1% = 1
psy2% = 60
bsx1% = 1
bsx2% = 40
bsy1% = 1
bsy2% = 50
esx1%(1) = 1
esx2% = 130 'check this one
esy1%(1) = 1
esy2% = 100 'check this one too
noenemiesx% = 10
noenemiesy% = 5
'enemyalert% = 0    'leave this one out of it
PRINT "Done."
PRINT "Press anykey to load graphics... "
'PRINT "note:- you will see the graphics appear as they are loaded.... "
DO
LOOP WHILE INKEY$ = ""
CLS
gifload "player.gif"
GET (psx1%, psy1%)-(psx2%, psy2%), playerbuffer
CLS
'COLOR 0 + shift%
gifload "bang.gif"
GET (1, 1)-(40, 40), bangbuffer
CLS
'COLOR 0 + shift%
gifload "evilbomb.gif"
GET (esx1%(1), esy1%(1))-(esx2%, esy2%), enemybuffer
CLS
'COLOR 0 + shift%
gifload "bullet.gif"
GET (bsx1%, bsy1%)-(bsx2%, bsy2%), bulletbuffer
CLS
'PRINT "graphics loaded... "
PRINT "+---------------+"
PRINT "| Controls....  |"
PRINT "| A.....up      |"
PRINT "| Z.....down    |"
PRINT "| X.....Shoot   |"
PRINT "| Q.....Quit    |"
PRINT "+---------------+"
'PRINT "at time of writing no other keypresses are required to operate the game"
'PRINT "the screenshots on the box are from a game you definitely haven't purchased"
'PRINT "BTW this game was a production made possible by Illuminate"
'PRINT "Still puzzled? http://www.geocities.com/god_save_the_queen77/index.htm"
DO
LOOP WHILE INKEY$ = ""
'PRINT "okl-e-dokl-e!"
'PRINT "configuring initial positions... "
px1% = 30
py1% = 100
col% = 15
esx1%(1) = 0          'HAHA no more zombie enemies
esy1%(1) = 0
enemyslowdown% = 0
am$ = "d"               'Is this just random or is it here for a reason???
'PRINT "just incase ure not there already i'm changing screen mode now!"
CLS
DO
  IF scoreinc$ = "s" THEN score% = score% + 1
  LINE (1, 4)-(320, 4), col%   'more of these
  LINE (1, 190)-(320, 190), col%   'more of these
  LINE (1, 155)-(320, 155), col%   'more of these
  IF rcheat$ = "r" THEN col% = col% + 1'rainbowfredcheat
  IF col% >= 65000 THEN col% = 0
  RANDOMIZE TIMER
  readkey$ = INKEY$
  IF runtime% = 0 THEN GOTO noxorthistime
  '-----------------------------
  'major edit for no flickers drawingstuff here
    PUT (px1%, py1%), playerbuffer, XOR
  '-----------------------------
noxorthistime:
  IF readkey$ = "a" THEN py1% = py1% - 2                        '2 lines down about here just noticed an amazingly stupid error but I can't change it now!!
  IF readkey$ = "z" THEN py1% = py1% + 2
  'other drawingstuff here
  '-----------------------------
  PUT (px1%, py1%), playerbuffer
  '-----------------------------
   runtime% = 1
  IF readkey$ = "x" AND bombalert% = 0 THEN createbulletsetup px1%, py1%, bsx1%, bsx2%, bombalert%, readkey$
  IF bombalert% = 1 THEN animatebullet px1%, py1%, bsx1%, bsx2%, bombalert%, bulletbuffer, brunfirst%
  IF bombalert% = 1 AND bsx1% >= 215 THEN clearupbullet bombalert%, brunfirst%, bsx1%, bsx2%, bulletbuffer
  IF readkey$ = "x" AND bombalert% = 1 AND bombalertb% = 0 AND nowshoot% = 1 THEN createbulletsetupb px1%, py1%, bsx1b%, bsx2b%, bombalertb%, readkey$
  IF bombalertb% = 1 THEN animatebulletb px1%, py1%, bsx1b%, bsx2b%, bombalertb%, bulletbufferb, brunfirstb%
  IF bombalertb% = 1 AND bsx1b% >= 215 THEN clearupbulletb bombalertb%, brunfirstb%, bsx1b%, bsx2b%, bulletbuffer
  IF ranmoveok% = 1 THEN ranmove bsx1%, bsy1%, bsx1b%, bsy1b%
  IF readkey$ = "r" AND ranmoveok% = 1 THEN GOTO setranmoveoff
  IF readkey$ = "r" THEN ranmoveok% = 1
  GOTO skipagain
setranmoveoff:
  ranmoveok% = 0
skipagain:
  IF py1% <= 3 THEN py1% = py1% + 2
  IF py1% >= 130 THEN py1% = py1% - 2
  IF bombalert% = 1 THEN shootok% = shootok% + 1
  IF shootok% >= 15 THEN nowshoot% = 1
  IF bombalert% = 0 THEN shootok% = 0      'edit... put in and bombalertb
  '-----------------------------------------------
  'some code for randomly creating enemies here
  RANDOMIZE TIMER
  enemyorno% = INT(RND * 25)                'Love the psychadelic colors
  enemyslowdown% = enemyslowdown% + 1
  IF kamattack$ = "k" THEN enemyslowdown% = 90
 'LOCATE 1, 1: PRINT esx1%, esy1%          'debugging
  id% = 1
  IF enemyorno% = 20 AND currentenemytotal% < 10 AND enemyslowdown% >= readyforenemy% THEN setupenemy esx1%, esx2%, enemyalert%, id%, currentenemytotal%, enemyslowdown%
  id% = 1
  animateenemy esx1%, esy1%, enemyalert%, enemybuffer, px1%, py1%, efirstrun%, score%, id%, currentenemytotal%
  id% = 1
    DO
    IF enemyalert%(id%) = 1 AND esx1%(id%) < 6 THEN clearupenemy efirstrun%, enemyalert%, id%, currentenemytotal%, esx1%, esy1%, enemybuffer
    id% = id% + 1
    LOOP WHILE id% <= 10
  'end code
  '-----------------------------------------------
  'cheatcode
  IF rcheat$ = "r" AND enemyalert% = 1 THEN LINE (esx1%, 4)-(esx1%, 190), col%
  '-----------------------------------------------
  'collision detect code
  id% = 1
  DO
  cdetx% = bsx1% + 20   'get centre of bombs
  cdety% = bsy1% + 25
  esx2% = esx1%(id%) + 130
  esy2% = esy1%(id%) + 100
  IF cdetx% > esx1%(id%) AND cdetx% < esx2% AND bombalert% = 1 AND enemyalert%(id%) = 1 AND cdety% > esy1%(id%) AND cdety% < esy2% THEN GOTO bigexplosion
  id% = id% + 1
  LOOP UNTIL id% = 11     'ok somet here please
  GOTO noexplosion  'I should really do this in subs but whatever....
bigexplosion:
  'massive explosion code starts here!
  expnum% = 0
  DO
  drawexpranx% = (esx1%(id%) + INT(RND * 90)) - 20
  drawexprany% = (esy1%(id%) + INT(RND * 60)) - 20
  waitforawhile% = 0
  DO
  waitforawhile% = waitforawhile% + 1
  LOOP UNTIL waitforawhile% = 3000
  PUT (drawexpranx%, drawexprany%), bangbuffer
  expnum% = expnum% + 1
  LOOP UNTIL expnum% = 20
  IF bombalert% = 1 THEN clearupbullet bombalert%, brunfirst%, bsx1%, bsx2%, bulletbuffer
  IF bombalertb% = 1 THEN clearupbulletb bombalertb%, brunfirstb%, bsx1b%, bsx2b%, bulletbuffer
  clearupenemy efirstrun%, enemyalert%, id%, currentenemytotal%, esx1%, esy1%, enemybuffer
  score% = score% + 10
  'explosion code ends here
  '---------------------------------
noexplosion:
  LOCATE 21, 1: PRINT "Your Score", score%
  LOOP UNTIL readkey$ = "q"
PRINT "BAH Humbug"                         'its over peeps...
PRINT "Everyone sits around doing nothing while"
PRINT "I re-write a few thousand lines of code"
PRINT "====================================="
PRINT "Written by LAX Studios 2002"
PRINT "====================================="
PRINT "This program is OPEN SOURCE"
PRINT "just quote the website... "
PRINT "http://illuminate.no-ip.com/"
PRINT "If you enjoy e-mail:"
PRINT "god_save_the_queen77@yahoo.co.uk"
PRINT "Cheers,"
PRINT "Enjoy the nu-dimension"
DO
LOOP WHILE INKEY$ = ""

SUB animatebullet (px1%, py1%, bsx1%, bsx2%, bombalert%, bulletbuffer, brunfirst%)
    IF brunfirst% = 0 THEN GOTO skipbulletxor
    PUT (bsx1%, bsy1%), bulletbuffer, XOR
skipbulletxor:
    brunfirst% = 1
    'otherrandommove% = INT(RND * 3)
    'IF otherrandommove% = 1 THEN bsy1% = bsy1% + 1
    'IF otherrandommove% = 2 THEN bsx1% = bsx1% + 2
    'IF otherrandommove% = 3 THEN bsy1% = bsy1% - 1
    'make sure random stuff doesnt leave screen boundaries
    IF bsy1% <= 10 THEN bsy1% = bsy1% + 3
    IF bsy1% >= 130 THEN bsy1% = bsy1% - 3
    bsx1% = bsx1% + 5
    'LOCATE 1, 1
    'PRINT bsx1%, bsy1%, px1%, py1%, bfirstrun%
    PUT (bsx1%, bsy1%), bulletbuffer
END SUB

SUB animatebulletb (px1%, py1%, bsx1b%, bsx2b%, bombalertb%, bulletbufferb, brunfirstb%)
    IF brunfirstb% = 0 THEN GOTO skipbulletbxor
    PUT (bsx1b%, bsy1b%), bulletbuffer, XOR
skipbulletbxor:
    brunfirstb% = 1
    'otherrandommoveb% = INT(RND * 3)
    'IF otherrandommoveb% = 1 THEN bsy1b% = bsy1b% + 1
    'IF otherrandommoveb% = 2 THEN bsx1b% = bsx1b% + 2
    'IF otherrandommoveb% = 3 THEN bsy1b% = bsy1b% - 1
    IF bsy1b% <= 10 THEN bsy1b% = bsy1b% + 3
    IF bsy1b% >= 130 THEN bsy1b% = bsy1b% - 3
    bsx1b% = bsx1b% + 5
    'LOCATE 1, 1
    PUT (bsx1b%, bsy1b%), bulletbuffer
END SUB

SUB animateenemy (esx1%, esy1%, enemyalert%, enemybuffer, px1%, py1%, efirstrun%, score%, id%, currentenemytotal%)
id% = 1
DO
    IF esy1%(id%) = 0 THEN GOTO deadenemy
    IF esx1%(id%) = 0 THEN GOTO deadenemy
  IF efirstrun%(id%) = 0 THEN GOTO noputtingxor          'ok I reckn I worked this one out but as I can't compile rite now!       
  PUT (esx1%(id%), esy1%(id%)), enemybuffer, XOR
noputtingxor:
  efirstrun%(id%) = 1
  esx1%(id%) = esx1%(id%) - 1
  '--------------------
  'A fantastic opportunity to use
  'my intellimove code...
  'well it's quite simple actually
  IF esy1%(id%) > py1% THEN esy1%(id%) = esy1%(id%) - 1
  IF py1% > esy1%(id%) THEN esy1%(id%) = esy1%(id%) + 1
  'end code                 
  '--------------------
  'oh yeah....
  IF esy1%(id%) > 100 THEN esy1%(id%) = esy1%(id%) - 3
  IF esy1%(id%) < 4 THEN esy1%(id%) = esy1%(id%) + 3
  'make it more exiting!
  IF enemyalert% = 1 AND score% > 100 THEN esx1%(id%) = esx1%(id%) - 1
  IF enemyalert% = 1 AND score% > 200 THEN esx1%(id%) = esx1%(id%) - 2
  IF enemyalert% = 1 AND score% > 400 THEN esx1%(id%) = esx1%(id%) - 3
  PUT (esx1%(id%), esy1%(id%)), enemybuffer
deadenemy:
id% = id% + 1
LOOP WHILE id% <= 10
END SUB

SUB clearupbullet (bombalert%, brunfirst%, bsx1%, bsx2%, bulletbuffer)
PUT (bsx1%, bsy1%), bulletbuffer   'amazingly stupid error carried again!
bombalert% = 0
brunfirst% = 0
END SUB

SUB clearupbulletb (bombalertb%, brunfirstb%, bsx1b%, bsx2b%, bulletbuffer)
PUT (bsx1b%, bsy1b%), bulletbuffer
bombalertb% = 0
brunfirstb% = 0
END SUB


SUB clearupenemy (efirstrun%, enemyalert%, id%, currentenemytotal%, esx1%, esy1%, enemybuffer)
PUT (esx1%(id%), esy1%(id%)), enemybuffer
enemyalert%(id%) = 0
efirstrun%(id%) = 0
currentenemytotal% = currentenemytotal% - 1
esx1%(id%) = 0
esy1%(id%) = 0
END SUB

SUB createbulletsetup (px1%, py1%, bsx1%, bsx2%, bombalert%, readkey$)
    bombalert% = 1
    bsx1% = 100
    bsy1% = py1% + 25
    DO
    bsy1% = bsy1% - 1
    LOOP UNTIL bsy1% < 130
    readkey$ = ""
END SUB

SUB createbulletsetupb (px1%, py1%, bsx1b%, bsx2b%, bombalertb%, readkey$)
    bombalertb% = 1
    bsx1b% = 100
    bsy1b% = py1% + 10
    DO
    bsy1b% = bsy1b% - 1
    LOOP UNTIL bsy1b% < 130
    readkey$ = ""
END SUB

SUB fade
'FOR i = 0 TO 255
'OUT &H3C7, i
'col2(i, 1) = INP(&H3C9)
'col2(i, 2) = INP(&H3C9)
'col2(i, 3) = INP(&H3C9)
'NEXT i
'FOR j = 0 TO 63
'FOR i = 0 TO 255
'OUT &H3C8, i
'OUT &H3C9, INT(((63 - j) * col2(i, 1)) / 63 + (j * colfad(i, 1)) / 63)
'OUT &H3C9, INT(((63 - j) * col2(i, 2)) / 63 + (j * colfad(i, 2)) / 63)
'OUT &H3C9, INT(((63 - j) * col2(i, 3)) / 63 + (j * colfad(i, 3)) / 63)
'NEXT i
'NEXT j
END SUB

SUB gifload (A$)
DEFINT A-Z
DIM Prefix(4095), Suffix(4095), OutStack(4095), shiftout%(8)
DIM Ybase AS LONG, powersof2(11) AS LONG, WorkCode AS LONG

FOR A% = 0 TO 7: shiftout%(8 - A%) = 2 ^ A%: NEXT A%
FOR A% = 0 TO 11: powersof2(A%) = 2 ^ A%: NEXT A%
IF A$ = "" THEN INPUT "GIF file"; A$: IF A$ = "" THEN END
IF INSTR(A$, ".") = 0 THEN A$ = A$ + ".gif"
OPEN A$ FOR BINARY AS #1
A$ = "      ": GET #1, , A$
IF A$ <> "GIF87a" THEN PRINT "Not a GIF87a file.": END
GET #1, , TotalX: GET #1, , TotalY: GOSUB GetByte
NumColors = 2 ^ ((A% AND 7) + 1): NoPalette = (A% AND 128) = 0
GOSUB GetByte: Background = A%
GOSUB GetByte: IF A% <> 0 THEN PRINT "Bad screen descriptor.": END
IF NoPalette = 0 THEN P$ = SPACE$(NumColors * 3): GET #1, , P$
DO
    GOSUB GetByte
    IF A% = 44 THEN
        EXIT DO
    ELSEIF A% <> 33 THEN
        PRINT "Unknown extension type.": END
    END IF
    GOSUB GetByte
    DO: GOSUB GetByte: A$ = SPACE$(A%): GET #1, , A$: LOOP UNTIL A% = 0
LOOP
GET #1, , XStart: GET #1, , YStart: GET #1, , XLength: GET #1, , YLength
XEnd = XStart + XLength: YEnd = YStart + YLength: GOSUB GetByte
IF A% AND 128 THEN PRINT "Can't handle local colormaps.": END
Interlaced = A% AND 64: PassNumber = 0: PassStep = 8
GOSUB GetByte
ClearCode = 2 ^ A%
EOSCode = ClearCode + 1
FirstCode = ClearCode + 2: NextCode = FirstCode
StartCodeSize = A% + 1: CodeSize = StartCodeSize
StartMaxCode = 2 ^ (A% + 1) - 1: MaxCode = StartMaxCode

BitsIn = 0: BlockSize = 0: BlockPointer = 1
x% = XStart: y% = YStart: Ybase = y% * 320&

SCREEN 13: DEF SEG = &HA000
IF NoPalette = 0 THEN
    OUT &H3C7, 0: OUT &H3C8, 0
    FOR A% = 1 TO NumColors * 3: OUT &H3C9, ASC(MID$(P$, A%, 1)) \ 4: NEXT A%
END IF
LINE (0, 0)-(319, 199), Background, BF
DO
    GOSUB GetCode
    IF Code <> EOSCode THEN
        IF Code = ClearCode THEN
            NextCode = FirstCode
            CodeSize = StartCodeSize
            MaxCode = StartMaxCode
            GOSUB GetCode
            CurCode = Code: LastCode = Code: LastPixel = Code
            IF x% < 320 THEN POKE x% + Ybase, LastPixel
            x% = x% + 1: IF x% = XEnd THEN GOSUB NextScanLine
        ELSE
            CurCode = Code: StackPointer = 0
            IF Code > NextCode THEN EXIT DO
            IF Code = NextCode THEN
                CurCode = LastCode
                OutStack(StackPointer) = LastPixel
                StackPointer = StackPointer + 1
            END IF

            DO WHILE CurCode >= FirstCode
                OutStack(StackPointer) = Suffix(CurCode)
                StackPointer = StackPointer + 1
                CurCode = Prefix(CurCode)
            LOOP

            LastPixel = CurCode
            IF x% < 320 THEN POKE x% + Ybase, LastPixel
            x% = x% + 1: IF x% = XEnd THEN GOSUB NextScanLine

            FOR A% = StackPointer - 1 TO 0 STEP -1
                IF x% < 320 THEN POKE x% + Ybase, OutStack(A%)
                x% = x% + 1: IF x% = XEnd THEN GOSUB NextScanLine
            NEXT A%

            IF NextCode < 4096 THEN
                Prefix(NextCode) = LastCode
                Suffix(NextCode) = LastPixel
                NextCode = NextCode + 1
                IF NextCode > MaxCode AND CodeSize < 12 THEN
                    CodeSize = CodeSize + 1
                    MaxCode = MaxCode * 2 + 1
                END IF
            END IF
            LastCode = Code
        END IF
    END IF
LOOP UNTIL DoneFlag OR Code = EOSCode
'BEEP
'A$ = INPUT$(1)
CLOSE #1
EXIT SUB

GetByte: A$ = " ": GET #1, , A$: A% = ASC(A$): RETURN

NextScanLine:
    IF Interlaced THEN
        y% = y% + PassStep
        IF y% >= YEnd THEN
            PassNumber = PassNumber + 1
            SELECT CASE PassNumber
            CASE 1: y% = 4: PassStep = 8
            CASE 2: y% = 2: PassStep = 4
            CASE 3: y% = 1: PassStep = 2
            END SELECT
        END IF
    ELSE
        y% = y% + 1
    END IF
    x% = XStart: Ybase = y% * 320&: DoneFlag = y% > 199
RETURN
GetCode:
    IF BitsIn = 0 THEN GOSUB ReadBufferedByte: LastChar = A%: BitsIn = 8
    WorkCode = LastChar \ shiftout%(BitsIn)
    DO WHILE CodeSize > BitsIn
        GOSUB ReadBufferedByte: LastChar = A%
        WorkCode = WorkCode OR LastChar * powersof2(BitsIn)
        BitsIn = BitsIn + 8
    LOOP
    BitsIn = BitsIn - CodeSize
    Code = WorkCode AND MaxCode
RETURN
ReadBufferedByte:
    IF BlockPointer > BlockSize THEN
        GOSUB GetByte: BlockSize = A%
        A$ = SPACE$(BlockSize): GET #1, , A$
        BlockPointer = 1
    END IF
    A% = ASC(MID$(A$, BlockPointer, 1)): BlockPointer = BlockPointer + 1
RETURN


END SUB

DEFSNG A-Z
SUB ranmove (bsx1%, bsy1%, bsx1b%, bsy1b%)
    otherrandommoveb% = INT(RND * 3)
    IF otherrandommoveb% = 1 THEN bsy1b% = bsy1b% + 1
    IF otherrandommoveb% = 2 THEN bsx1b% = bsx1b% + 2
    IF otherrandommoveb% = 3 THEN bsy1b% = bsy1b% - 1
    otherrandommove% = INT(RND * 3)
    IF otherrandommove% = 1 THEN bsy1% = bsy1% + 1
    IF otherrandommove% = 2 THEN bsx1% = bsx1% + 2
    IF otherrandommove% = 3 THEN bsy1% = bsy1% - 1
END SUB

SUB setupenemy (esx1%, esx2%, enemyalert%, id%, currentenemytotal%, enemyslowdown%)
id% = 1
        DO
        IF esx1%(id%) = 0 AND esy1%(id%) = 0 THEN GOTO setupenemynow
        id% = id% + 1
        LOOP UNTIL id% = 11
        GOTO skipsetupenemy
setupenemynow:
enemyalert%(id%) = 1
tryagain:
esy1%(id%) = INT(RND * 100)
IF esy1%(id%) <= 10 GOTO tryagain
esx1%(id%) = 190
currentenemytotal% = currentenemytotal% + 1
enemyslowdown% = 0
'LOCATE 1, 2: PRINT esx1%, esy1% 'debugging stuff
skipsetupenemy:
END SUB

