SCREEN 1,320,200,5,1

WINDOW 1,"saucer",(0,0)-(305,185),20,1

CLS



DIM saucer%(138)

DIM bas%(103)

DIM shot%(53),eshot%(53)

DIM per%(20)

DIM SHARED ClrReg(31,2)



CALL rgb (0,0,0,0):black=0

CALL rgb (3,0,5,5):CALL rgb (4,0,10,10):CALL rgb (5,15,15,0)

CALL rgb (6,5,0,0)

CALL rgb (7,0,4,0):CALL rgb (8,0,8,0):CALL rgb (9,0,12,0):CALL rgb (10,10,10,10)

CALL rgb (11,10,0,10):CALL rgb (12,15,0,0)



c=3:COLOR c



NextLine:

  READ oxx,oyy   



NextPoint:

  READ xx,yy

  IF xx<0 THEN NextColor ELSE LINE (oxx,oyy)-(xx,yy): oxx=xx: oyy=yy    

  GOTO NextPoint



NextColor: 

  c=c+1

  COLOR c

  IF c<7 THEN NextLine



GET (82,100)-(121,108),saucer%

COLOR black

FOR y=100 TO 108

  LINE (80,y)-(120,y)

NEXT



COLOR 7

 LINE (95, 185)-(105, 185)

 LINE (104, 184)-(96, 184)



COLOR 8

 LINE (97, 183)-(103, 183)

 LINE (102, 182)-(98, 182)



COLOR 9

 LINE (99,181)-(101,181)



COLOR 10

 LINE (99,180)-(101,180)

 LINE (101,180)-(101,178)

 LINE (101,178)-(99,178)

 LINE (99,178)-(99,179)

 LINE (99,179)-(100,179)



GET (92,177)-(108,186),bas%



COLOR 11

 LINE (1, 1)-(1, 4)

 LINE (2, 5)-(3, 4) 

 LINE (3, 4)-(3, 1)

 LINE (3, 1)-(2, 0)



COLOR 12

 LINE (2,1)-(2,4)



GET (0,0)-(4,9),shot%



COLOR black

 FOR y=0 TO 5

   LINE (0,y)-(4,y)

 NEXT



GET (0,0)-(4,9),eshot%



saucx=20

spx=3

px%=92



'GOSUB SetupExp               'set up explosion



MainLoop:

  GOSUB SaucMove               'saucer

  GOSUB PlayerMove             'player

  GOSUB ShotMove               'shot

GOTO MainLoop



PlayerMove:                    '** player movement **

  b%=MOUSE(0)

  mx%=MOUSE(1)



  IF mx%=px% THEN IF b%<>0 THEN GOTO NewShot ELSE RETURN

  IF mx%>px% THEN px%=px%+2 ELSE px%=px%-2

  IF px%<0 THEN

    px%=0 

  ELSEIF px%>300 THEN

    px%=300

  END IF

  PUT (px%,177),bas%,PSET

  IF b%=0 THEN RETURN



NewShot:                                          '** new shot **

  IF shstat=1 THEN PUT (sx,sy),eshot%,PSET

  sx=px%+6

  sy=169

  PUT (sx,sy),shot%,PSET

  shstat=1

  RETURN

ShotMove:                                         '** handle shot **

  IF shstat=0 THEN RETURN

  IF sy=0 THEN PUT (sx,sy),eshot%: shstat=0: RETURN

  IF sx>=saucx AND sx-saucx<35 AND sy<saucy AND saucy-sy<7 THEN GOTO HitSaucer

  sy=sy-3

  PUT (sx,sy),shot%,PSET

  RETURN

HitSaucer:                                        '** hit saucer **

  CALL rgb (20,15,7,0)

  CALL rgb (21,13,5,0)

  CALL rgb (22,11,3,0)

  CALL rgb (23,9,1,0)

  FOR y=saucy TO saucy+8

    FOR x=saucx TO saucx+35

      COLOR CINT(3*RND(1))+20

      PSET (x,y)

    NEXT x

  NEXT y

  FOR a=1 TO 25

    FOR b%=20 TO 23

      CALL AskRGB (b%,r%,g%,bl%)

      IF b%=20 THEN CALL rgb (23,r%,g%,bl%) ELSE CALL rgb (b%-1,r%,g%,bl%)

      FOR c=1 TO 100:NEXT

    NEXT b%

  NEXT a

  FOR expl=1 TO 254

    SOUND INT(RND*300)+50,.1,255-INT(expl),0

    SOUND INT(RND*200)+50,.1,255-INT(expl),1

    SOUND INT(RND*100)+100,.1,255-INT(expl),2     

    SOUND INT(RND*200)+100,.1,255-INT(expl),3

  NEXT expl

  t$="you won. oh boy  how exciting."

  SAY TRANSLATE$(t$)

END



SaucMove:                                        '** move saucer **

  blinkc=blinkc+1:IF blinkc<20 THEN GOTO RealMove

  blinkc=0

  CALL AskRGB(6,r%,g%,b%)

  IF r%=5 THEN rgb 6,15,g%,b% ELSE rgb 6,5,g%,b%

RealMove:

  saucx=saucx+spx

  IF saucx>268 OR saucx<5 THEN spx=-spx:GOSUB EraseSaucer:saucy=saucy+8

  IF saucy>178 THEN GOTO TheEnd

  PUT (saucx,saucy),saucer%,PSET

  RETURN



EraseSaucer:

  COLOR black

  FOR y=saucy TO saucy+10

    LINE (saucx,y)-(saucx+40,y)

  NEXT

  saucx=saucx+spx*2

  RETURN



DATA 100,100,102,100,103,101,103,102

DATA 104,103,109,103,110,104,116,104

DATA 117,105,116,106,110,106,109,107

DATA 93,107,92,106,86,106,85,105,86,104,92,104

DATA 93,103,98,103,99,102,99,101

DATA -1,0

DATA 99,103,103,103,103,104,109,104,93,104

DATA 93,105,86,105,116,105

DATA -1,0

DATA 109,106,93,106

DATA -1,0

DATA 100,101,102,101,102,102,100,102
DATA -1,0

 

TheEnd:

  PRINT "you lost."

END

      

SUB rgb(register%, red%, green%, blue%) STATIC

  PALETTE register%, red%*(1/15), green%*(1/15), blue%*(1/15)

  ClrReg(register%,0)=red%

  ClrReg(register%,1)=green%

  ClrReg(register%,2)=blue%

END SUB



SUB AskRGB(register%, red%, green%, blue%) STATIC

  red%=ClrReg(register%,0)

  green%=ClrReg(register%,1)

  blue%=ClrReg(register%,2)

END SUB

     

