Guidance
指路人
g.yi.org
software / rapidq / Examples / Game / spaceballs / spaceballs.bas

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
' MicroHof Construct Icon Data--C:\BASIC\spaceballs.ico

     Application.Title = "MH Space Balls v1.0"

     $RESOURCE SBLogo AS "spaceballs.bmp" ' Logo
     $RESOURCE HitE AS "hit.wav" ' .Wav sounds
     $RESOURCE BoingE AS "boing.wav"
     $RESOURCE EngineE AS "engine.wav"
     $RESOURCE ClickE AS "click.wav"
     $RESOURCE ByeE AS "bye.wav"
     $RESOURCE LoseE AS "lose.wav"
     $RESOURCE ShootE AS "shoot.wav"
     $RESOURCE WinE AS "win.wav"

     IF NOT FILEEXISTS("hit.wav") THEN EXTRACTRESOURCE Resource(1), "hit.wav" ' Extract .wav resources if not present
     IF NOT FILEEXISTS("boing.wav") THEN EXTRACTRESOURCE Resource(2), "boing.wav"
     IF NOT FILEEXISTS("engine.wav") THEN EXTRACTRESOURCE Resource(3), "engine.wav"
     IF NOT FILEEXISTS("click.wav") THEN EXTRACTRESOURCE Resource(4), "click.wav"
     IF NOT FILEEXISTS("bye.wav") THEN EXTRACTRESOURCE Resource(5), "bye.wav"
     IF NOT FILEEXISTS("lose.wav") THEN EXTRACTRESOURCE Resource(6), "lose.wav"
     IF NOT FILEEXISTS("shoot.wav") THEN EXTRACTRESOURCE Resource(7), "shoot.wav"
     IF NOT FILEEXISTS("win.wav") THEN EXTRACTRESOURCE Resource(8), "win.wav"

     RANDOMIZE

     DECLARE SUB DXTimerExpired ' Main sub
     DECLARE SUB KeyDown (Key AS BYTE, Shift AS BYTE) ' Updates keyboard buffer array when key goes down
     DECLARE SUB KeyUp (Key AS BYTE, Shift AS BYTE) ' Updates keyboard buffer array when key goes up
     DECLARE SUB RandomMove () ' Randomly stuffs keyboard buffer to modify ship velocity angle
     DECLARE SUB RandomMove2 () ' Randomly stuffs keyboard buffer to allocate engine energy
     DECLARE SUB Time () ' Updates TimeLeft variable
     DECLARE FUNCTION LeetSpeak (TNG$) AS STRING ' Converts to 1337 5P3@K
     DECLARE SUB Closed () ' Cleanup

     TYPE Gun: X AS SINGLE: Y AS SINGLE: VX AS SINGLE: VY AS SINGLE: S AS INTEGER: END TYPE ' Used to store position, velocity, and radius for everything but the ship

     DIM From AS QRECT ' Logo placement
     From.Top = 0: From.Left = 0: From.Right = 450: From.Bottom = 450
     DIM TO AS QRECT ' Logo placement
     TO.Top = 14: TO.Left = 94: TO.Right = 554: TO.Bottom = 464
     DIM InvX AS SINGLE: InvX = 319 ' Ship X Position
     DIM InvY AS SINGLE: InvY = 400 ' Ship Y Position
     DIM Test AS INTEGER: Test = 270 ' Ship velocity angle in degrees
     DIM Power AS INTEGER: Power = 0 ' Weapon energy allocation
     DIM Fire AS INTEGER: Fire = 0 ' Initiates shot if = 1
     DIM Move AS INTEGER: Move = -204 ' Engine energy allocation
     DIM Energy AS INTEGER: Energy = 1000 ' Shield/battery power
     DIM Score AS SINGLE: Score = 0 ' Score
     DIM Leet AS INTEGER: Leet = 0 ' Third level toggle
     DIM LeetMode AS INTEGER ' Language mode
     DIM AllGone AS INTEGER: AllGone = 10 ' Number of enemies left
     DIM TimeLeft AS INTEGER: TimeLeft = 60 ' Time left
     DIM CosFast(1 TO 360) AS SINGLE ' COSINE table
     DIM SinFast(1 TO 360) AS SINGLE ' SINE table
     FOR I = 1 TO 360: CosFast(I) = COS(I*3.14/180): SinFast(I) = SIN(I*3.14/180): NEXT I
     DIM Star(1 TO 10) AS Gun ' Background stars array
     FOR I = 1 TO 10: Star(I).X = INT(RND(640)): Star(I).Y = INT(RND(480)): Star(I).S = INT(RND(5)): NEXT I
     DIM En(1 TO 10) AS Gun ' Enemy array
     En(1).X = 280: En(3).X = 246: En(5).X = 217:   En(7).X = 194: En(9).X = 175
     En(1).Y = 400: En(3).Y = 410: En(5).Y = 425:   En(7).Y = 445: En(9).Y = 465
     En(1).VX = -1: En(3).VX = -2: En(5).VX = -2.6: En(7).VX = -3: En(9).VX = -3
     En(1).VY = -3: En(3).VY = -3: En(5).VY = -2.6: En(7).VY = -2: En(9).VY = -1
     En(1).S = 6:   En(3).S = 7:   En(5).S = 8:     En(7).S = 9:   En(9).S = 10
     En(2).X = 358: En(4).X = 392: En(6).X = 421:   En(8).X = 444: En(10).X = 463
     En(2).Y = 400: En(4).Y = 410: En(6).Y = 425:   En(8).Y = 445: En(10).Y = 465
     En(2).VX = 1:  En(4).VX = 2:  En(6).VX = 2.6:  En(8).VX = 3:  En(10).VX = 3
     En(2).VY = -3: En(4).VY = -3: En(6).VY = -2.6: En(8).VY = -2: En(10).VY = -1
     En(2).S = 6:   En(4).S = 7:   En(6).S = 8:     En(8).S = 9:   En(10).S = 10
     DIM Pel(1 TO 10) AS Gun ' Weapon balls array
     DIM KeyM(0 TO 256) AS INTEGER ' Keyboard buffer array

     DIM Form AS QFORM ' Main form
     Form.BorderStyle = 0: Form.KeyPreview = 1: Form.OnKeyDown = KeyDown: Form.OnKeyUp = KeyUp: Form.OnClose = Closed
     DIM DXScreen AS QDXSCREEN ' DirectX area on main form
     DXScreen.PARENT = Form: DXScreen.BitCount = 8: DXScreen.Align = 5: DXScreen.Cursor = -1: DXScreen.Init(640, 480): DXScreen.FullScreen = 1
     DIM DXTimer AS QDXTIMER ' Graphics timer
     DXTimer.Interval = 0: DXTimer.OnTimer = DXTimerExpired: DXTimer.Enabled = 1
     DIM Shoot AS QDXSound ' Fire sound
     Shoot.PARENT = Form: Shoot.FileName = "shoot.wav": Shoot.Volume = 80
     DIM Hit AS QDXSound ' Hit sound
     Hit.PARENT = Form: Hit.FileName = "hit.wav": Hit.Volume = 90
     DIM Bye AS QDXSound ' Destroy sound
     Bye.PARENT = Form: Bye.FileName = "bye.wav"
     DIM Lose AS QDXSound ' Lose sound
     Lose.PARENT = Form: Lose.FileName = "lose.wav"
     DIM Win AS QDXSound ' Win sound
     Win.PARENT = Form: Win.FileName = "win.wav"
     DIM Click AS QDXSound ' Timer sound
     Click.PARENT = Form: Click.FileName = "click.wav"
     DIM Boing AS QDXSound ' Ship bounce sound
     Boing.PARENT = Form: Boing.FileName = "boing.wav": Boing.Volume = 80
     DIM Timer2 AS QTIMER ' TimeLeft variable timer
     Timer2.Interval = 1000: Timer2.OnTimer = Time
     DIM Font AS QFONT ' Font data
     Font.Name="Fixedsys": Font.Size=8
     DIM Logo AS QBITMAP
     Logo.BMPHandle = SBLogo
     DIM Registry AS QREGISTRY ' Get registered user's name from registry
     Registry.RootKey = &H80000002: Registry.OpenKey("SOFTWARE\Microsoft\Windows\CurrentVersion", 0)
     DIM Registry2 AS QREGISTRY ' Get LeetMode from registry
     Registry2.OpenKey("SOFTWARE\MicroHof\SpaceBalls", 1)
     IF NOT Registry2.ReadString("Installed") = "Yes" THEN
      Registry2.WriteString("Installed", "Yes")
      Registry2.WriteInteger("LeetMode", 0)
     END IF
     LeetMode = Registry2.ReadInteger("LeetMode")

     IF LeetMode > 0 THEN ' Speed up for Arriba Mode
      FOR I = 1 TO 10
       En(I).VX = En(I).VX * 1.5
       En(I).VY = En(I).VY * 1.5
      NEXT I
     END IF

     Form.SHOWMODAL

'-SUPPORT SUBS------------------------------------------------------------------------------------------------------------------

     SUB KeyDown (Key AS BYTE, Shift AS BYTE) ' Updates keyboard buffer array when key goes down
      KeyM(Key) = 1
     END SUB

     SUB KeyUp (Key AS BYTE, Shift AS BYTE) ' Updates keyboard buffer array when key goes up
      KeyM(Key) = 0
     END SUB

     SUB RandomMove () ' Randomly stuffs keyboard buffer to modify ship velocity angle
      IF RND(25) = 0 THEN KeyM(37) = 1: KeyM(39) = 0
      IF RND(25) = 0 THEN KeyM(39) = 1: KeyM(37) = 0
     END SUB

     SUB RandomMove2 () ' Randomly stuffs keyboard buffer to allocate engine energy
      IF RND(1) = 0 THEN
       IF Move < 200 THEN Move = Move + 3
      END IF
     END SUB

     SUB Time () ' Updates TimeLeft variable
      IF AllGone > 0 AND TimeLeft > 0 AND Move > -1 THEN TimeLeft = TimeLeft - 1: Click.Play: Click.Position = 0
     END SUB

     FUNCTION LeetSpeak (TNG$) AS STRING ' Converts to 1337 5P3@K
      FOR I = 1 TO LEN(TNG$)
       TNG$ = UCASE$(LTRIM$(RTRIM$(TNG$)))
       IF MID$(TNG$, I, 1) = "E" THEN TNG$ = REPLACE$(TNG$, "3", I)
       IF MID$(TNG$, I, 1) = "L" THEN TNG$ = REPLACE$(TNG$, "1", I)
       IF MID$(TNG$, I, 1) = "T" THEN TNG$ = REPLACE$(TNG$, "7", I)
       IF MID$(TNG$, I, 1) = "A" THEN TNG$ = REPLACE$(TNG$, "@", I)
       IF MID$(TNG$, I, 1) = "C" THEN TNG$ = REPLACE$(TNG$, "(", I)
       IF MID$(TNG$, I, 1) = "O" THEN TNG$ = REPLACE$(TNG$, "0", I)
       IF MID$(TNG$, I, 1) = "B" THEN TNG$ = REPLACE$(TNG$, "8", I)
       IF MID$(TNG$, I, 1) = "S" THEN TNG$ = REPLACE$(TNG$, "5", I)
       IF MID$(TNG$, I, 1) = "G" THEN TNG$ = REPLACE$(TNG$, "&", I)
      NEXT I
      LeetSpeak = TNG$
     END FUNCTION

     SUB Closed () ' Cleanup
      Registry2.WriteInteger("LeetMode", LeetMode)
     END SUB

'-MAIN SUB----------------------------------------------------------------------------------------------------------------------

     SUB DXTimerExpired
      DXScreen.Font = Font
'-KEY PRESS PROCESSOR-----
      IF KeyM(49) = 1 OR KeyM(50) = 1 OR KeyM(51) = 1 OR KeyM(52) = 1 OR KeyM(53) = 1 OR KeyM(54) = 1 OR KeyM(55) = 1 OR KeyM(56) = 1 OR KeyM(13) = 1 THEN ' Reset
       IF Leet = 0 AND Move > -1 THEN
        InvX = 319: InvY = 400: Test = 270: Power = 0: Fire = 0: Move = -204: Energy = 1000: Score = 0: AllGone = 10: TimeLeft = 60
        En(1).X = 280: En(3).X = 246: En(5).X = 217:   En(7).X = 194: En(9).X = 175
        En(1).Y = 400: En(3).Y = 410: En(5).Y = 425:   En(7).Y = 445: En(9).Y = 465
        En(1).VX = -1: En(3).VX = -2: En(5).VX = -2.6: En(7).VX = -3: En(9).VX = -3
        En(1).VY = -3: En(3).VY = -3: En(5).VY = -2.6: En(7).VY = -2: En(9).VY = -1
        En(1).S = 6:   En(3).S = 7:   En(5).S = 8:     En(7).S = 9:   En(9).S = 10
        En(2).X = 358: En(4).X = 392: En(6).X = 421:   En(8).X = 444: En(10).X = 463
        En(2).Y = 400: En(4).Y = 410: En(6).Y = 425:   En(8).Y = 445: En(10).Y = 465
        En(2).VX = 1:  En(4).VX = 2:  En(6).VX = 2.6:  En(8).VX = 3:  En(10).VX = 3
        En(2).VY = -3: En(4).VY = -3: En(6).VY = -2.6: En(8).VY = -2: En(10).VY = -1
        En(2).S = 6:   En(4).S = 7:   En(6).S = 8:     En(8).S = 9:   En(10).S = 10
        FOR I = 1 TO 10: Star(I).X = INT(RND(640)): Star(I).Y = INT(RND(480)): Star(I).S = INT(RND(5)): Pel(I).X = 0: Pel(I).Y = 0: Pel(I).VX = 0: Pel(I).VY = 0: Pel(I).S = 0: NEXT I
        FOR I = 11 TO 256: KeyM(I) = 0: NEXT I: KeyM(0) = 0
         IF Lose.Playing = 1 THEN Lose.Stop
         Lose.Position = 0: Win.Position = 0
        END IF
        IF Leet > 0 AND Move > -1 THEN
         InvX = 319: InvY = 239: Test = 0: Power = 0: Fire = 0: Energy = 1000: Score = 0: AllGone = 8: TimeLeft = 60: Move = 200
         Leet = 1
         En(3).X = 319:  En(5).X = 519:   En(7).X = 319:  En(9).X = 119
         En(3).Y = 39:   En(5).Y = 239:   En(7).Y = 439:  En(9).Y = 239
         En(3).VX = 0:  En(5).VX = 10:  En(7).VX = 0:   En(9).VX = -10
         En(3).VY = -10: En(5).VY = 0:    En(7).VY = 10: En(9).VY = 0
         En(1).S = 0:   En(3).S = 15:   En(5).S = 15:    En(7).S = 15:   En(9).S = 15
         En(4).X = 460:  En(6).X = 460:   En(8).X = 178:  En(10).X = 178
         En(4).Y = 98:   En(6).Y = 380:   En(8).Y = 380:  En(10).Y = 98
         En(4).VX = 5:  En(6).VX = 5:   En(8).VX = -5:   En(10).VX = -5
         En(4).VY = -5:   En(6).VY = 5:   En(8).VY = 5:  En(10).VY = -5
         En(2).S = 0:   En(4).S = 15:   En(6).S = 15:    En(8).S = 15:   En(10).S = 15
         FOR I = 0 TO 256: KeyM(I) = 0: NEXT I
         IF Lose.Playing = 1 THEN Lose.Stop
         Lose.Position = 0: Win.Position = 0
        END IF
        IF LeetMode > 0 THEN
         FOR I = 1 TO 10
          En(I).VX = En(I).VX * 1.5
          En(I).VY = En(I).VY * 1.5
         NEXT I
        END IF
       END IF
       IF KeyM(27) = 1 THEN  Registry2.WriteInteger("LeetMode", LeetMode): Application.Terminate 'Exit
       IF KeyM(37) = 1 THEN 'Left
        IF Move < 0 THEN Move = 0
        IF Leet = 0 THEN Test = Test - 5
        IF Leet > 0 THEN Test = Test - 7
        IF Test < 1 THEN Test = Test + 360
       END IF
       IF KeyM(39) = 1 THEN 'Right
        IF Move < 0 THEN Move = 0
        IF Leet = 0 THEN Test = Test + 5
        IF Leet > 0 THEN Test = Test + 7
        IF Test > 360 THEN Test = Test - 360
       END IF
       IF (KeyM(18) = 1 OR KeyM(38) = 1) AND Move < 200 THEN ' Power up engine
        IF Move < 0 THEN Move = 0
        IF Energy > 0 AND AllGone > 0 THEN Move = Move + 3: Energy = Energy - 1
       END IF
       IF KeyM(17) = 1 AND Power < 100 THEN ' Power up weapon
        IF Energy > 0 AND AllGone > 0 THEN Power = Power + 5: Energy = Energy - 1: Fire = 1
        IF AllGone < 1 THEN Power = Power + 5: Fire = 1
       END IF
       IF KeyM(17) = 0 AND Fire = 1 THEN 'Fire
        IF Move < 0 THEN Move = 0
        FOR I = 1 TO 10
         IF Pel(I).S = 0 THEN
          Shoot.Play
          Shoot.Position = 0
          Pel(I).X = InvX + COSFAST(Test)*15: Pel(I).Y=InvY+SINFAST(Test)*15
          IF LeetMode = 0 THEN Pel(I).VX = COSFAST(Test)*5: Pel(I).VY = SINFAST(Test)*5
          IF LeetMode > 0 THEN Pel(I).VX = COSFAST(Test)*7.5: Pel(I).VY = SINFAST(Test)*7.5
          Pel(I).S = 75 + Power
          EXIT FOR
         END IF
        NEXT I
        Power = 0
        Fire = 0
       END IF
'-FILL SCREEN/TEXT DISPLAY
       IF Energy > 0 THEN
        DXScreen.FillRect(0, 0, 640, 480, &H220000)
        DXScreen.Rectangle(0,0,639,479,&H00FFFF)
       ELSE
        TimeLeft = 0
        DXScreen.FillRect(0, 0, 640, 480, &H000022)
        DXScreen.Rectangle(0,0,639,479,&H00FFFF)
        Lose.Play
       END IF
       IF AllGone < 1 AND Leet = 0 THEN DXScreen.FillRect(0, 0, 640, 480, &H002200): DXScreen.Rectangle(0,0,639,479,&H777777): Win.Play
       IF Move < 0 AND AllGone > 0 AND LeetMode = 0 THEN DXScreen.CopyRect(TO, Logo, From): DXScreen.TextOut(215, 460, "Press any button to start.", &HFFFFFF, &H220000): DXScreen.TextOut(187, 425, "The Thinking Man's Asteroids (TM)", &H00FFFF, &H220000): DXScreen.TextOut(287, 33, "Micro", &H4040FF, &H220000): DXScreen.TextOut(327, 33, "Hof", &HFFFF40, &H220000)
       IF Move < 0 AND AllGone > 0 AND LeetMode = 1 THEN DXScreen.CopyRect(TO, Logo, From): DXScreen.TextOut(199, 460, "Pulsa cualquier botón empezar.", &HFFFFFF, &H220000): DXScreen.TextOut(159, 425, "El Asteroids del Hombre Pensamiento (MR)", &H00FFFF, &H220000): DXScreen.TextOut(287, 33, "Micro", &H4040FF, &H220000): DXScreen.TextOut(327, 33, "Hof", &HFFFF40, &H220000): DXScreen.TextOut(263, 220, "La Moda Arriba", &H00FF00, &HAAFFAA)
       IF Move < 0 AND AllGone > 0 AND LeetMode = 2 THEN
        FOR I = 1 TO 25
         IF I = 1 THEN  DXScreen.TextOut(109, 34 + (I * 15),  "                    ;.   ##.    ;;", &H00FF00, &H220000)
         IF I = 2 THEN  DXScreen.TextOut(109, 34 + (I * 15),  "                 ##x+## ####  ###X##.", &H00FF00, &H220000)
         IF I = 3 THEN  DXScreen.TextOut(109, 34 + (I * 15),  "           ####  ,###x  ##.## ##      ####=", &H00FF00, &H220000)
         IF I = 4 THEN  DXScreen.TextOut(109, 34 + (I * 15),  "          ##x#### ## -X##+=######### ###;,##", &H00FF00, &H220000)
         IF I = 5 THEN  DXScreen.TextOut(109, 34 + (I * 15),  "            ;- ##-X+--,   .    .-+=;##x", &H00FF00, &H220000)
         IF I = 6 THEN  DXScreen.TextOut(109, 34 + (I * 15),  "            .##+.,,..,........,,,,;;,;##", &H00FF00, &H220000)
         IF I = 7 THEN  DXScreen.TextOut(109, 34 + (I * 15), "            +=,,;,................,;;;,-", &H00FF00, &H220000)
         IF I = 8 THEN  DXScreen.TextOut(109, 34 + (I * 15), "           #x-;,....................,;-=#+", &H00FF00, &H220000)
         IF I = 9 THEN  DXScreen.TextOut(109, 34 + (I * 15), "          #+-;,......................,,;=#+", &H00FF00, &H220000)
         IF I = 10 THEN DXScreen.TextOut(109, 34 + (I * 15), "         #+-;,........         .......,;;=#", &H00FF00, &H220000)
         IF I = 11 THEN DXScreen.TextOut(109, 34 + (I * 15), "        .#-;,,......            .......,;-+#", &H00FF00, &H220000)
         IF I = 12 THEN DXScreen.TextOut(109, 34 + (I * 15), "        xx-;,...1337 U83R H@X0R M0D3...,,--#", &H00FF00, &H220000)
         IF I = 13 THEN DXScreen.TextOut(109, 34 + (I * 15), "        #+-;,......              ......,;;-#", &H00FF00, &H220000)
         IF I = 14 THEN DXScreen.TextOut(109, 34 + (I * 15), "        +x-;,......              ......,;-=#", &H00FF00, &H220000)
         IF I = 15 THEN DXScreen.TextOut(109, 34 + (I * 15), "         #--;,.......           .......,;-xx", &H00FF00, &H220000)
         IF I = 16 THEN DXScreen.TextOut(109, 34 + (I * 15), "         ++-;,........       .........,;-=#", &H00FF00, &H220000)
         IF I = 17 THEN DXScreen.TextOut(109, 34 + (I * 15), "     ,##- ,,,;,......................,;-=#    ;xx-", &H00FF00, &H220000)
         IF I = 18 THEN DXScreen.TextOut(109, 34 + (I * 15), "    +######X-.,,.    .............  .,-+#  ;#####+", &H00FF00, &H220000)
         IF I = 19 THEN DXScreen.TextOut(109, 34 + (I * 15), "   ###X   X###;;.x-..         ..   .=-##  ###    -##+", &H00FF00, &H220000)
         IF I = 20 THEN DXScreen.TextOut(109, 34 + (I * 15), "  ####### #### +#####-  X###..,,.#####    ############", &H00FF00, &H220000)
         IF I = 21 THEN DXScreen.TextOut(109, 34 + (I * 15), "-####   ###-.  #######..+#x#;-+xXx#XX#     +##,    ###", &H00FF00, &H220000)
         IF I = 22 THEN DXScreen.TextOut(109, 34 + (I * 15), " .####+ XX#-  ###  #x#.+##x#xxx-  x#x#        -#=x###", &H00FF00, &H220000)
         IF I = 23 THEN DXScreen.TextOut(109, 34 + (I * 15), "     ######  ####-.#x#   #x#       #x#=    + #####X", &H00FF00, &H220000)
         IF I = 24 THEN DXScreen.TextOut(109, 34 + (I * 15), "           =###X####X##  #x#,  ,;= ##########", &H00FF00, &H220000)
         IF I = 25 THEN DXScreen.TextOut(109, 34 + (I * 15), "           ,.,=    ####  ######### =###X-.", &H00FF00, &H220000)
        NEXT I
        DXScreen.TextOut(287, 33, "M!(R0", &H4040FF, &H220000): DXScreen.TextOut(327, 33, "H0F", &HFFFF40, &H220000)
        DXScreen.TextOut(215, 460, "PR355 @NV 8U770N 70 57@RT.", &HFFFFFF, &H220000)
        DXScreen.TextOut(319 - (LEN(Registry.ReadString("RegisteredOwner") + "'5 @573R0!D5 (7M)")*4), 425, LeetSpeak(Registry.ReadString("RegisteredOwner")) + "'5 @573R0!D5 (7M)", &H00FFFF, &H220000)
       END IF
       IF LeetMode = 0 THEN
        DXScreen.TextOut(5, 5, "|_______Engine_______|", &H555555, &H000000): DXScreen.TextOut(13, 5, LEFT$("       Engine       ", Move/10), &H000000, &H777777)
        DXScreen.TextOut(5, 25,"|_______Weapon_______|", &H555555, &H000000): DXScreen.TextOut(13, 25, LEFT$("       Weapon       ", Power/5), &H000000, &H777777)
        DXScreen.TextOut(5, 45,"|___Shield/Battery___|", &H555555, &H000000): DXScreen.TextOut(13, 45, LEFT$("   Shield/Battery   ", Energy/50), &H000000, &H777777)
        DXScreen.TextOut(5, 65, "|_______Score________|", &H555555, &H000000): DXScreen.TextOut(13, 65, LEFT$("       Score        ", CINT(Score)/4), &H000000, &H777777)
        DXScreen.TextOut(5, 85, "|_____Time_Left______|", &H555555, &H000000): DXScreen.TextOut(13, 85, LEFT$("     Time Left      ", TimeLeft/3), &H000000, &H777777)
       END IF
       IF LeetMode = 1 THEN
        DXScreen.TextOut(5, 5, "|_______Motor________|", &H555555, &H000000): DXScreen.TextOut(13, 5, LEFT$("       Motor        ", Move/10), &H000000, &H777777)
        DXScreen.TextOut(5, 25,"|________Arma________|", &H555555, &H000000): DXScreen.TextOut(13, 25, LEFT$("        Arma        ", Power/5), &H000000, &H777777)
        DXScreen.TextOut(5, 45,"|__Pantalla/Batería__|", &H555555, &H000000): DXScreen.TextOut(13, 45, LEFT$("  Pantalla/Batería  ", Energy/50), &H000000, &H777777)
        DXScreen.TextOut(5, 65, "|______Puntaje_______|", &H555555, &H000000): DXScreen.TextOut(13, 65, LEFT$("      Puntaje       ", CINT(Score)/4), &H000000, &H777777)
        DXScreen.TextOut(5, 85, "|_______Tiempo_______|", &H555555, &H000000): DXScreen.TextOut(13, 85, LEFT$("       Tiempo       ", TimeLeft/3), &H000000, &H777777)
       END IF
       IF LeetMode = 2 THEN
        DXScreen.TextOut(5, 5, "|_______3N&!N3_______|", &H555555, &H000000): DXScreen.TextOut(13, 5, LEFT$("       3N&!N3       ", Move/10), &H000000, &H777777)
        DXScreen.TextOut(5, 25,"|_______W3@P0N_______|", &H555555, &H000000): DXScreen.TextOut(13, 25, LEFT$("       W3@P0N       ", Power/5), &H000000, &H777777)
        DXScreen.TextOut(5, 45,"|___5H!31D/8@773RY___|", &H555555, &H000000): DXScreen.TextOut(13, 45, LEFT$("   5H!31D/8@773RY   ", Energy/50), &H000000, &H777777)
        DXScreen.TextOut(5, 65, "|_______FR@&Z________|", &H555555, &H000000): DXScreen.TextOut(13, 65, LEFT$("       FR@&Z        ", CINT(Score)/4), &H000000, &H777777)
        DXScreen.TextOut(5, 85, "|_____7!M3_13F7______|", &H555555, &H000000): DXScreen.TextOut(13, 85, LEFT$("     7!M3 13F7      ", TimeLeft/3), &H000000, &H777777)
       END IF
'-WIN/LOSE TESTER---------
       IF TimeLeft < 1 THEN Energy = 0
       IF Energy < 1 AND Power < 1 AND Move < 1 AND AllGone > 0 THEN
        Energy = 0
        TimeLeft = 0
        RandomMove
        IF LeetMode = 0 THEN
         DXScreen.TextOut(279, 384, "It's over.", &H00FFFF, &H000022)
         DXScreen.TextOut(271, 401, "You're done.", &H00FFFF, &H000022)
         DXScreen.TextOut(167, 460, "Insert coin/press enter to play again.", &HFFFFFF, &H000022)
        END IF
        IF LeetMode = 1 THEN
         DXScreen.TextOut(255, 384, "Estás terminado.", &H00FFFF, &H000022)
         DXScreen.TextOut(291, 401, "El fin.", &H00FFFF, &H000022)
         DXScreen.TextOut(147, 460, "Inserta moneda/pulsa entrar jugar otra vez.", &HFFFFFF, &H000022)
        END IF
        IF LeetMode = 2 THEN
         DXScreen.TextOut(279, 384, "17'S 0Y3R!", &H00FFFF, &H000022)
         DXScreen.TextOut(271, 401, "V0V'R3 D0N3!", &H00FFFF, &H000022)
         DXScreen.TextOut(167, 460, "!N53R7 (0!N/PR355 3N73R 70 P1@V @&@!N.", &HFFFFFF, &H000022)
        END IF
       END IF
       IF AllGone < 1 AND Leet = 1 THEN
        IF LeetMode < 2 THEN LeetMode = LeetMode + 1
        Leet = 0: InvX = 319: InvY = 400: Test = 270: Power = 0: Fire = 0: Move = -204: Energy = 1000: Score = 0: AllGone = 10: TimeLeft = 60
        En(1).X = 280: En(3).X = 246: En(5).X = 217:   En(7).X = 194: En(9).X = 175
        En(1).Y = 400: En(3).Y = 410: En(5).Y = 425:   En(7).Y = 445: En(9).Y = 465
        En(1).VX = -1: En(3).VX = -2: En(5).VX = -2.6: En(7).VX = -3: En(9).VX = -3
        En(1).VY = -3: En(3).VY = -3: En(5).VY = -2.6: En(7).VY = -2: En(9).VY = -1
        En(1).S = 6:   En(3).S = 7:   En(5).S = 8:     En(7).S = 9:   En(9).S = 10
        En(2).X = 358: En(4).X = 392: En(6).X = 421:   En(8).X = 444: En(10).X = 463
        En(2).Y = 400: En(4).Y = 410: En(6).Y = 425:   En(8).Y = 445: En(10).Y = 465
        En(2).VX = 1:  En(4).VX = 2:  En(6).VX = 2.6:  En(8).VX = 3:  En(10).VX = 3
        En(2).VY = -3: En(4).VY = -3: En(6).VY = -2.6: En(8).VY = -2: En(10).VY = -1
        En(2).S = 6:   En(4).S = 7:   En(6).S = 8:     En(8).S = 9:   En(10).S = 10
        FOR I = 1 TO 10: Star(I).X = INT(RND(640)): Star(I).Y = INT(RND(480)): Star(I).S = INT(RND(5)): Pel(I).X = 0: Pel(I).Y = 0: Pel(I).VX = 0: Pel(I).VY = 0: Pel(I).S = 0: NEXT I
        FOR I = 11 TO 256: KeyM(I) = 0: NEXT I: KeyM(0) = 0
         Lose.Position = 0: Win.Position = 0
        END IF
        IF AllGone < 1 AND Leet = 0 THEN
         TimeLeft = 60: Energy = 1000: RandomMove: RandomMove2
         IF LeetMode = 0 THEN DXScreen.TextOut(288, 393, "You won!", &H777777, &H002200)
         IF LeetMode = 1 THEN DXScreen.TextOut(271, 393, "¡Tu ganaste!", &H777777, &H002200)
         IF LeetMode = 2 THEN DXScreen.TextOut(288, 393, "V0V W0N!", &H777777, &H002200)
        END IF
        IF AllGone = 0 THEN En(1).S = 6: En(3).S = 7: En(5).S = 8: En(7).S = 9: En(9).S = 10: En(2).S = 6: En(4).S = 7: En(6).S = 8: En(8).S = 9: En(10).S = 10
        IF AllGone = -10 THEN
         Leet = 1: InvX = 319: InvY = 239: Test = 0: Power = 0: Fire = 0: Move = 200: Energy = 1000: Score = 0: AllGone = 8: TimeLeft = 60
         En(3).X = 319:  En(5).X = 519:   En(7).X = 319:  En(9).X = 119
         En(3).Y = 39:   En(5).Y = 239:   En(7).Y = 439:  En(9).Y = 239
         En(3).VX = 0:  En(5).VX = 10:  En(7).VX = 0:   En(9).VX = -10
         En(3).VY = -10: En(5).VY = 0:    En(7).VY = 10: En(9).VY = 0
         En(1).S = 0:   En(3).S = 15:   En(5).S = 15:    En(7).S = 15:   En(9).S = 15
         En(4).X = 460:  En(6).X = 460:   En(8).X = 178:  En(10).X = 178
         En(4).Y = 98:   En(6).Y = 380:   En(8).Y = 380:  En(10).Y = 98
         En(4).VX = 5:  En(6).VX = 5:   En(8).VX = -5:   En(10).VX = -5
         En(4).VY = -5:   En(6).VY = 5:   En(8).VY = 5:  En(10).VY = -5
         En(2).S = 0:   En(4).S = 15:   En(6).S = 15:    En(8).S = 15:   En(10).S = 15
         FOR I = 0 TO 256: KeyM(I) = 0: NEXT I
         Lose.Position = 0: Win.Position = 0
        END IF


'-MOVE STARS/ENEMY/SHOTS; COLLISION DETECTION
        FOR I = 1 TO 10

         IF Move <> 0 THEN 'Move stars
          IF Star(I).S = 0 THEN Star(I).X = Star(I).X - COSFAST(Test)*1.6: Star(I).Y = Star(I).Y - SINFAST(Test)*1.6
          IF Star(I).S = 1 THEN Star(I).X = Star(I).X - COSFAST(Test)*1.5: Star(I).Y = Star(I).Y - SINFAST(Test)*1.5
          IF Star(I).S = 2 THEN Star(I).X = Star(I).X - COSFAST(Test)*1.4: Star(I).Y = Star(I).Y - SINFAST(Test)*1.4
          IF Star(I).S = 3 THEN Star(I).X = Star(I).X - COSFAST(Test)*1.3: Star(I).Y = Star(I).Y - SINFAST(Test)*1.3
          IF Star(I).S = 4 THEN Star(I).X = Star(I).X - COSFAST(Test)*1.2: Star(I).Y = Star(I).Y - SINFAST(Test)*1.2
          IF Star(I).X < 0 THEN Star(I).X = Star(I).X + 639
          IF Star(I).X > 639 THEN Star(I).X = Star(I).X - 639
          IF Star(I).Y < 0 THEN Star(I).Y = Star(I).Y + 479
          IF Star(I).Y > 479 THEN Star(I).Y = Star(I).Y - 479
         END IF
         DXScreen.Circle(Star(I).X, Star(I).Y, Star(I).X+2, Star(I).Y+2, &HFFFFFF, &HFFFFFF)

' Collision detection
         Q = 1
         IF (INT(En(I).X) - INT(Pel(Q).X))^2 + (INT(En(I).Y) - INT(Pel(Q).Y))^2 < (En(I).S + Pel(Q).S/20)^2 AND En(I).S > 0 AND Pel(Q).S > 0 AND AllGone > 0 THEN
          En(I).S = En(I).S - Pel(Q).S/50: Pel(Q).S = 0: En(I).VX = (INT(En(I).VX) + INT(Pel(Q).VX))/2: En(I).VY = (INT(En(I).VY) + INT(Pel(Q).VY))/2
          Hit.Play
          Hit.Position = 0
          IF EN(I).S < 1 THEN
           Bye.Play
           Bye.Position = 0
           AllGone = AllGone - 1
           IF I = 1 OR I = 2 THEN Score = Score + 6
           IF I = 3 OR I = 4 THEN Score = Score + 7
           IF I = 5 OR I = 6 THEN Score = Score + 8
           IF I = 7 OR I = 8 THEN Score = Score + 9
           IF I = 9 OR I = 10 THEN Score = Score + 10
          END IF
         END IF
         IF (INT(En(I).X) - INT(Pel(Q).X))^2 + (INT(En(I).Y) - INT(Pel(Q).Y))^2 < (En(I).S + Pel(Q).S/20)^2 AND En(I).S > 0 AND Pel(Q).S > 0 AND AllGone < 1 THEN
          Bye.Play

          Bye.Position = 0
          Pel(Q).S = 0: En(I).S = 0: AllGone = AllGone - 1
          IF I = 1 OR I = 2 THEN Score = Score - 6
          IF I = 3 OR I = 4 THEN Score = Score - 7
          IF I = 5 OR I = 6 THEN Score = Score - 8
          IF I = 7 OR I = 8 THEN Score = Score - 9
          IF I = 9 OR I = 10 THEN Score = Score - 10
         END IF
         IF (INT(En(I).X) - INT(InvX))^2 + (INT(En(I).Y) - INT(InvY))^2 < (En(I).S + 5)^2 AND En(I).S > 0 AND Energy > 0 AND Move > -1 AND AllGone > 0 THEN Energy = 0: En(I).S = En(I).S - 1

         Q = 2
         IF (INT(En(I).X) - INT(Pel(Q).X))^2 + (INT(En(I).Y) - INT(Pel(Q).Y))^2 < (En(I).S + Pel(Q).S/20)^2 AND En(I).S > 0 AND Pel(Q).S > 0 AND AllGone > 0 THEN
          En(I).S = En(I).S - Pel(Q).S/50: Pel(Q).S = 0: En(I).VX = (INT(En(I).VX) + INT(Pel(Q).VX))/2: En(I).VY = (INT(En(I).VY) + INT(Pel(Q).VY))/2
          Hit.Play
          Hit.Position = 0
          IF EN(I).S < 1 THEN
           Bye.Play
           Bye.Position = 0
           AllGone = AllGone - 1
           IF I = 1 OR I = 2 THEN Score = Score + 6
           IF I = 3 OR I = 4 THEN Score = Score + 7
           IF I = 5 OR I = 6 THEN Score = Score + 8
           IF I = 7 OR I = 8 THEN Score = Score + 9
           IF I = 9 OR I = 10 THEN Score = Score + 10
          END IF
         END IF
         IF (INT(En(I).X) - INT(Pel(Q).X))^2 + (INT(En(I).Y) - INT(Pel(Q).Y))^2 < (En(I).S + Pel(Q).S/20)^2 AND En(I).S > 0 AND Pel(Q).S > 0 AND AllGone < 1 THEN
          Bye.Play
          Bye.Position = 0
          Pel(Q).S = 0: En(I).S = 0: AllGone = AllGone - 1
          IF I = 1 OR I = 2 THEN Score = Score - 6
          IF I = 3 OR I = 4 THEN Score = Score - 7
          IF I = 5 OR I = 6 THEN Score = Score - 8
          IF I = 7 OR I = 8 THEN Score = Score - 9
          IF I = 9 OR I = 10 THEN Score = Score - 10
         END IF
         IF (INT(En(I).X) - INT(InvX))^2 + (INT(En(I).Y) - INT(InvY))^2 < (En(I).S + 5)^2 AND En(I).S > 0 AND Energy > 0 AND Move > -1 AND AllGone > 0 THEN Energy = 0: En(I).S = En(I).S - 1

         Q = 3
         IF (INT(En(I).X) - INT(Pel(Q).X))^2 + (INT(En(I).Y) - INT(Pel(Q).Y))^2 < (En(I).S + Pel(Q).S/20)^2 AND En(I).S > 0 AND Pel(Q).S > 0 AND AllGone > 0 THEN
          En(I).S = En(I).S - Pel(Q).S/50: Pel(Q).S = 0: En(I).VX = (INT(En(I).VX) + INT(Pel(Q).VX))/2: En(I).VY = (INT(En(I).VY) + INT(Pel(Q).VY))/2
          Hit.Play
          Hit.Position = 0
          IF EN(I).S < 1 THEN
           Bye.Play
           Bye.Position = 0
           AllGone = AllGone - 1
           IF I = 1 OR I = 2 THEN Score = Score + 6
           IF I = 3 OR I = 4 THEN Score = Score + 7
           IF I = 5 OR I = 6 THEN Score = Score + 8
           IF I = 7 OR I = 8 THEN Score = Score + 9
           IF I = 9 OR I = 10 THEN Score = Score + 10
          END IF
         END IF
         IF (INT(En(I).X) - INT(Pel(Q).X))^2 + (INT(En(I).Y) - INT(Pel(Q).Y))^2 < (En(I).S + Pel(Q).S/20)^2 AND En(I).S > 0 AND Pel(Q).S > 0 AND AllGone < 1 THEN
          Bye.Play
          Bye.Position = 0
          Pel(Q).S = 0: En(I).S = 0: AllGone = AllGone - 1
          IF I = 1 OR I = 2 THEN Score = Score - 6
          IF I = 3 OR I = 4 THEN Score = Score - 7
          IF I = 5 OR I = 6 THEN Score = Score - 8
          IF I = 7 OR I = 8 THEN Score = Score - 9
          IF I = 9 OR I = 10 THEN Score = Score - 10
         END IF
         IF (INT(En(I).X) - INT(InvX))^2 + (INT(En(I).Y) - INT(InvY))^2 < (En(I).S + 5)^2 AND En(I).S > 0 AND Energy > 0 AND Move > -1 AND AllGone > 0 THEN Energy = 0: En(I).S = En(I).S - 1

         Q = 4
         IF (INT(En(I).X) - INT(Pel(Q).X))^2 + (INT(En(I).Y) - INT(Pel(Q).Y))^2 < (En(I).S + Pel(Q).S/20)^2 AND En(I).S > 0 AND Pel(Q).S > 0 AND AllGone > 0 THEN
          En(I).S = En(I).S - Pel(Q).S/50: Pel(Q).S = 0: En(I).VX = (INT(En(I).VX) + INT(Pel(Q).VX))/2: En(I).VY = (INT(En(I).VY) + INT(Pel(Q).VY))/2
          Hit.Play
          Hit.Position = 0
          IF EN(I).S < 1 THEN
           Bye.Play
           Bye.Position = 0
           AllGone = AllGone - 1
           IF I = 1 OR I = 2 THEN Score = Score + 6
           IF I = 3 OR I = 4 THEN Score = Score + 7
           IF I = 5 OR I = 6 THEN Score = Score + 8
           IF I = 7 OR I = 8 THEN Score = Score + 9
           IF I = 9 OR I = 10 THEN Score = Score + 10
          END IF
         END IF
         IF (INT(En(I).X) - INT(Pel(Q).X))^2 + (INT(En(I).Y) - INT(Pel(Q).Y))^2 < (En(I).S + Pel(Q).S/20)^2 AND En(I).S > 0 AND Pel(Q).S > 0 AND AllGone < 1 THEN
          Bye.Play
          Bye.Position = 0
          Pel(Q).S = 0: En(I).S = 0: AllGone = AllGone - 1
          IF I = 1 OR I = 2 THEN Score = Score - 6
          IF I = 3 OR I = 4 THEN Score = Score - 7
          IF I = 5 OR I = 6 THEN Score = Score - 8
          IF I = 7 OR I = 8 THEN Score = Score - 9
          IF I = 9 OR I = 10 THEN Score = Score - 10
         END IF
         IF (INT(En(I).X) - INT(InvX))^2 + (INT(En(I).Y) - INT(InvY))^2 < (En(I).S + 5)^2 AND En(I).S > 0 AND Energy > 0 AND Move > -1 AND AllGone > 0 THEN Energy = 0: En(I).S = En(I).S - 1

         Q = 5
         IF (INT(En(I).X) - INT(Pel(Q).X))^2 + (INT(En(I).Y) - INT(Pel(Q).Y))^2 < (En(I).S + Pel(Q).S/20)^2 AND En(I).S > 0 AND Pel(Q).S > 0 AND AllGone > 0 THEN
          En(I).S = En(I).S - Pel(Q).S/50: Pel(Q).S = 0: En(I).VX = (INT(En(I).VX) + INT(Pel(Q).VX))/2: En(I).VY = (INT(En(I).VY) + INT(Pel(Q).VY))/2
          Hit.Play
          Hit.Position = 0
          IF EN(I).S < 1 THEN
           Bye.Play
           Bye.Position = 0
           AllGone = AllGone - 1
           IF I = 1 OR I = 2 THEN Score = Score + 6
           IF I = 3 OR I = 4 THEN Score = Score + 7
           IF I = 5 OR I = 6 THEN Score = Score + 8
           IF I = 7 OR I = 8 THEN Score = Score + 9
           IF I = 9 OR I = 10 THEN Score = Score + 10
          END IF
         END IF
         IF (INT(En(I).X) - INT(Pel(Q).X))^2 + (INT(En(I).Y) - INT(Pel(Q).Y))^2 < (En(I).S + Pel(Q).S/20)^2 AND En(I).S > 0 AND Pel(Q).S > 0 AND AllGone < 1 THEN
          Bye.Play
          Bye.Position = 0
          Pel(Q).S = 0: En(I).S = 0: AllGone = AllGone - 1
          IF I = 1 OR I = 2 THEN Score = Score - 6
          IF I = 3 OR I = 4 THEN Score = Score - 7
          IF I = 5 OR I = 6 THEN Score = Score - 8
          IF I = 7 OR I = 8 THEN Score = Score - 9
          IF I = 9 OR I = 10 THEN Score = Score - 10
         END IF
         IF (INT(En(I).X) - INT(InvX))^2 + (INT(En(I).Y) - INT(InvY))^2 < (En(I).S + 5)^2 AND En(I).S > 0 AND Energy > 0 AND Move > -1 AND AllGone > 0 THEN Energy = 0: En(I).S = En(I).S - 1

         Q = 6
         IF (INT(En(I).X) - INT(Pel(Q).X))^2 + (INT(En(I).Y) - INT(Pel(Q).Y))^2 < (En(I).S + Pel(Q).S/20)^2 AND En(I).S > 0 AND Pel(Q).S > 0 AND AllGone > 0 THEN
          En(I).S = En(I).S - Pel(Q).S/50: Pel(Q).S = 0: En(I).VX = (INT(En(I).VX) + INT(Pel(Q).VX))/2: En(I).VY = (INT(En(I).VY) + INT(Pel(Q).VY))/2
          Hit.Play
          Hit.Position = 0
          IF EN(I).S < 1 THEN
           Bye.Play
           Bye.Position = 0
           AllGone = AllGone - 1
           IF I = 1 OR I = 2 THEN Score = Score + 6
           IF I = 3 OR I = 4 THEN Score = Score + 7
           IF I = 5 OR I = 6 THEN Score = Score + 8
           IF I = 7 OR I = 8 THEN Score = Score + 9
           IF I = 9 OR I = 10 THEN Score = Score + 10
          END IF
         END IF
         IF (INT(En(I).X) - INT(Pel(Q).X))^2 + (INT(En(I).Y) - INT(Pel(Q).Y))^2 < (En(I).S + Pel(Q).S/20)^2 AND En(I).S > 0 AND Pel(Q).S > 0 AND AllGone < 1 THEN
          Bye.Play
          Bye.Position = 0
          Pel(Q).S = 0: En(I).S = 0: AllGone = AllGone - 1
          IF I = 1 OR I = 2 THEN Score = Score - 6
          IF I = 3 OR I = 4 THEN Score = Score - 7
          IF I = 5 OR I = 6 THEN Score = Score - 8
          IF I = 7 OR I = 8 THEN Score = Score - 9
          IF I = 9 OR I = 10 THEN Score = Score - 10
         END IF
         IF (INT(En(I).X) - INT(InvX))^2 + (INT(En(I).Y) - INT(InvY))^2 < (En(I).S + 5)^2 AND En(I).S > 0 AND Energy > 0 AND Move > -1 AND AllGone > 0 THEN Energy = 0: En(I).S = En(I).S - 1

         Q = 7
         IF (INT(En(I).X) - INT(Pel(Q).X))^2 + (INT(En(I).Y) - INT(Pel(Q).Y))^2 < (En(I).S + Pel(Q).S/20)^2 AND En(I).S > 0 AND Pel(Q).S > 0 AND AllGone > 0 THEN
          En(I).S = En(I).S - Pel(Q).S/50: Pel(Q).S = 0: En(I).VX = (INT(En(I).VX) + INT(Pel(Q).VX))/2: En(I).VY = (INT(En(I).VY) + INT(Pel(Q).VY))/2
          Hit.Play
          Hit.Position = 0
          IF EN(I).S < 1 THEN
           Bye.Play
           Bye.Position = 0
           AllGone = AllGone - 1
           IF I = 1 OR I = 2 THEN Score = Score + 6
           IF I = 3 OR I = 4 THEN Score = Score + 7
           IF I = 5 OR I = 6 THEN Score = Score + 8
           IF I = 7 OR I = 8 THEN Score = Score + 9
           IF I = 9 OR I = 10 THEN Score = Score + 10
          END IF
         END IF
         IF (INT(En(I).X) - INT(Pel(Q).X))^2 + (INT(En(I).Y) - INT(Pel(Q).Y))^2 < (En(I).S + Pel(Q).S/20)^2 AND En(I).S > 0 AND Pel(Q).S > 0 AND AllGone < 1 THEN
          Bye.Play
          Bye.Position = 0
          Pel(Q).S = 0: En(I).S = 0: AllGone = AllGone - 1
          IF I = 1 OR I = 2 THEN Score = Score - 6
          IF I = 3 OR I = 4 THEN Score = Score - 7
          IF I = 5 OR I = 6 THEN Score = Score - 8
          IF I = 7 OR I = 8 THEN Score = Score - 9
          IF I = 9 OR I = 10 THEN Score = Score - 10
         END IF
         IF (INT(En(I).X) - INT(InvX))^2 + (INT(En(I).Y) - INT(InvY))^2 < (En(I).S + 5)^2 AND En(I).S > 0 AND Energy > 0 AND Move > -1 AND AllGone > 0 THEN Energy = 0: En(I).S = En(I).S - 1

         Q = 8
         IF (INT(En(I).X) - INT(Pel(Q).X))^2 + (INT(En(I).Y) - INT(Pel(Q).Y))^2 < (En(I).S + Pel(Q).S/20)^2 AND En(I).S > 0 AND Pel(Q).S > 0 AND AllGone > 0 THEN
          En(I).S = En(I).S - Pel(Q).S/50: Pel(Q).S = 0: En(I).VX = (INT(En(I).VX) + INT(Pel(Q).VX))/2: En(I).VY = (INT(En(I).VY) + INT(Pel(Q).VY))/2
          Hit.Play
          Hit.Position = 0
          IF EN(I).S < 1 THEN
           Bye.Play
           Bye.Position = 0
           AllGone = AllGone - 1
           IF I = 1 OR I = 2 THEN Score = Score + 6
           IF I = 3 OR I = 4 THEN Score = Score + 7
           IF I = 5 OR I = 6 THEN Score = Score + 8
           IF I = 7 OR I = 8 THEN Score = Score + 9
           IF I = 9 OR I = 10 THEN Score = Score + 10
          END IF
         END IF
         IF (INT(En(I).X) - INT(Pel(Q).X))^2 + (INT(En(I).Y) - INT(Pel(Q).Y))^2 < (En(I).S + Pel(Q).S/20)^2 AND En(I).S > 0 AND Pel(Q).S > 0 AND AllGone < 1 THEN
          Bye.Play
          Bye.Position = 0
          Pel(Q).S = 0: En(I).S = 0: AllGone = AllGone - 1
          IF I = 1 OR I = 2 THEN Score = Score - 6
          IF I = 3 OR I = 4 THEN Score = Score - 7
          IF I = 5 OR I = 6 THEN Score = Score - 8
          IF I = 7 OR I = 8 THEN Score = Score - 9
          IF I = 9 OR I = 10 THEN Score = Score - 10
         END IF
         IF (INT(En(I).X) - INT(InvX))^2 + (INT(En(I).Y) - INT(InvY))^2 < (En(I).S + 5)^2 AND En(I).S > 0 AND Energy > 0 AND Move > -1 AND AllGone > 0 THEN Energy = 0: En(I).S = En(I).S - 1

         Q = 9
         IF (INT(En(I).X) - INT(Pel(Q).X))^2 + (INT(En(I).Y) - INT(Pel(Q).Y))^2 < (En(I).S + Pel(Q).S/20)^2 AND En(I).S > 0 AND Pel(Q).S > 0 AND AllGone > 0 THEN
          En(I).S = En(I).S - Pel(Q).S/50: Pel(Q).S = 0: En(I).VX = (INT(En(I).VX) + INT(Pel(Q).VX))/2: En(I).VY = (INT(En(I).VY) + INT(Pel(Q).VY))/2
          Hit.Play
          Hit.Position = 0
          IF EN(I).S < 1 THEN
           Bye.Play
           Bye.Position = 0
           AllGone = AllGone - 1
           IF I = 1 OR I = 2 THEN Score = Score + 6
           IF I = 3 OR I = 4 THEN Score = Score + 7
           IF I = 5 OR I = 6 THEN Score = Score + 8
           IF I = 7 OR I = 8 THEN Score = Score + 9
           IF I = 9 OR I = 10 THEN Score = Score + 10
          END IF
         END IF
         IF (INT(En(I).X) - INT(Pel(Q).X))^2 + (INT(En(I).Y) - INT(Pel(Q).Y))^2 < (En(I).S + Pel(Q).S/20)^2 AND En(I).S > 0 AND Pel(Q).S > 0 AND AllGone < 1 THEN
          Bye.Play
          Bye.Position = 0
          Pel(Q).S = 0: En(I).S = 0: AllGone = AllGone - 1
          IF I = 1 OR I = 2 THEN Score = Score - 6
          IF I = 3 OR I = 4 THEN Score = Score - 7
          IF I = 5 OR I = 6 THEN Score = Score - 8
          IF I = 7 OR I = 8 THEN Score = Score - 9
          IF I = 9 OR I = 10 THEN Score = Score - 10
         END IF
         IF (INT(En(I).X) - INT(InvX))^2 + (INT(En(I).Y) - INT(InvY))^2 < (En(I).S + 5)^2 AND En(I).S > 0 AND Energy > 0 AND Move > -1 AND AllGone > 0 THEN Energy = 0: En(I).S = En(I).S - 1

         Q = 10
         IF (INT(En(I).X) - INT(Pel(Q).X))^2 + (INT(En(I).Y) - INT(Pel(Q).Y))^2 < (En(I).S + Pel(Q).S/20)^2 AND En(I).S > 0 AND Pel(Q).S > 0 AND AllGone > 0 THEN
          En(I).S = En(I).S - Pel(Q).S/50: Pel(Q).S = 0: En(I).VX = (INT(En(I).VX) + INT(Pel(Q).VX))/2: En(I).VY = (INT(En(I).VY) + INT(Pel(Q).VY))/2
          Hit.Play
          Hit.Position = 0
          IF EN(I).S < 1 THEN
           Bye.Play
           Bye.Position = 0
           AllGone = AllGone - 1
           IF I = 1 OR I = 2 THEN Score = Score + 6
           IF I = 3 OR I = 4 THEN Score = Score + 7
           IF I = 5 OR I = 6 THEN Score = Score + 8
           IF I = 7 OR I = 8 THEN Score = Score + 9
           IF I = 9 OR I = 10 THEN Score = Score + 10
          END IF
         END IF
         IF (INT(En(I).X) - INT(Pel(Q).X))^2 + (INT(En(I).Y) - INT(Pel(Q).Y))^2 < (En(I).S + Pel(Q).S/20)^2 AND En(I).S > 0 AND Pel(Q).S > 0 AND AllGone < 1 THEN
          Bye.Play
          Bye.Position = 0
          Pel(Q).S = 0: En(I).S = 0: AllGone = AllGone - 1
          IF I = 1 OR I = 2 THEN Score = Score - 6
          IF I = 3 OR I = 4 THEN Score = Score - 7
          IF I = 5 OR I = 6 THEN Score = Score - 8
          IF I = 7 OR I = 8 THEN Score = Score - 9
          IF I = 9 OR I = 10 THEN Score = Score - 10
         END IF
         IF (INT(En(I).X) - INT(InvX))^2 + (INT(En(I).Y) - INT(InvY))^2 < (En(I).S + 5)^2 AND En(I).S > 0 AND Energy > 0 AND Move > -1 AND AllGone > 0 THEN Energy = 0: En(I).S = En(I).S - 1

         IF En(I).X - En(I).S + En(I).VX < 2 THEN En(I).VX = En(I).VX*-1 ' Move enemy
         IF En(I).X + En(I).S + En(I).VX > 637 THEN En(I).VX = En(I).VX*-1
         IF En(I).Y - En(I).S + EN(I).VY < 2 THEN En(I).VY = En(I).VY*-1
         IF En(I).Y + En(I).S + En(I).VY > 477 THEN En(I).VY = En(I).VY*-1
         En(I).X = En(I).X + En(I).VX: En(I).Y = En(I).Y + En(I).VY
         IF AllGone < 1 THEN DXScreen.Circle(En(I).X - En(I).S, En(I).Y - En(I).S, En(I).X + En(I).S, En(I).Y + En(I).S, &H008400, &H00FF00) ' Draw different colors depending on win/lose
         IF En(I).S > 0 AND AllGone > 0 AND Leet = 0 THEN DXScreen.Circle(En(I).X - En(I).S, En(I).Y - En(I).S, En(I).X + En(I).S, En(I).Y + En(I).S, &H000084, &H0000FF)
         IF En(I).S > 0 AND AllGone > 0 AND Leet = 1 THEN DXScreen.Circle(En(I).X - En(I).S, En(I).Y - En(I).S, En(I).X + En(I).S, En(I).Y + En(I).S, &H008400, &H00FF00)

         IF Pel(I).S > 0 THEN Pel(I).S = Pel(I).S - 1 ' Move shots
         IF Pel(I).X - Pel(I).S/20 + Pel(I).VX < 2 THEN Pel(I).VX = Pel(I).VX*-1
         IF Pel(I).X + Pel(I).S/20 + Pel(I).VX > 637 THEN Pel(I).VX = Pel(I).VX*-1
         IF Pel(I).Y - Pel(I).S/20 + Pel(I).VY < 2 THEN Pel(I).VY = Pel(I).VY*-1
         IF Pel(I).Y + Pel(I).S/20 + Pel(I).VY > 477 THEN Pel(I).VY = Pel(I).VY*-1
         Pel(I).X = Pel(I).X + Pel(I).VX: Pel(I).Y = Pel(I).Y + Pel(I).VY
         IF AllGone < 1 AND Pel(I).S > 0 THEN DXScreen.Circle(Pel(I).X-Pel(I).S/20, Pel(I).Y-Pel(I).S/20, Pel(I).X+Pel(I).S/20, Pel(I).Y+Pel(I).S/20, &H000084, &H0000FF) ' Draw different colors depending on win/lose
         IF AllGone > 0 AND Pel(I).S > 0 AND Leet = 0 THEN DXScreen.Circle(Pel(I).X-Pel(I).S/20, Pel(I).Y-Pel(I).S/20, Pel(I).X+Pel(I).S/20, Pel(I).Y+Pel(I).S/20, &H008400, &H00FF00)
         IF AllGone > 0 AND Pel(I).S > 0 AND Leet = 1 THEN DXScreen.Circle(Pel(I).X-Pel(I).S/20, Pel(I).Y-Pel(I).S/20, Pel(I).X+Pel(I).S/20, Pel(I).Y+Pel(I).S/20, &H000084, &H0000FF)

        NEXT I
'-MOVE SHIP---------------
        IF Move <> 0 THEN
         Multiplier = 0
         IF Leet = 0 AND LeetMode = 0 THEN Multiplier = 2
         IF Leet = 1 AND LeetMode = 0 THEN Multiplier = 3
         IF Leet = 0 AND LeetMode > 0 THEN Multiplier = 3
         IF Leet = 1 AND LeetMode > 0 THEN Multiplier = 4.5
         IF ABS(Move) < 204 THEN Move = Move - 1
         IF InvX - 5 + (COSFAST(Test) * Multiplier) < 2 THEN
          IF Test < 180 THEN Test = Test - 90
          IF Test > 180 THEN Test = Test + 90
          IF Test = 180 THEN Test = Test - 180
          IF Test < 1 THEN Test = Test + 360
          IF Test > 360 THEN Test = Test - 360
          Boing.Play: Boing.Position = 0
         END IF
         IF InvX + 5 + (COSFAST(Test) * Multiplier) > 638 THEN
          IF Test < 360 AND Test > 270 THEN Test = Test - 90
          IF Test > 0 AND Test < 90 THEN Test = Test + 90
          IF Test = 360 THEN Test = Test - 180
          IF Test < 1 THEN Test = Test + 360
          IF Test > 360 THEN Test = Test - 360
          Boing.Play: Boing.Position = 0
         END IF
         IF InvY - 5 + (SINFAST(Test) * Multiplier) < 2 THEN
          IF Test < 270 THEN Test = Test - 90
          IF Test > 270 THEN Test = Test + 90
          IF Test = 270 THEN Test = Test - 180
          IF Test < 1 THEN Test = Test + 360
          IF Test > 360 THEN Test = Test - 360
          Boing.Play: Boing.Position = 0
         END IF
         IF InvY + 5 + (SINFAST(Test) * Multiplier) > 478 THEN
          IF Test < 90 THEN Test = Test - 90
          IF Test > 90 THEN Test = Test + 90
          IF Test = 90 THEN Test = Test - 180
          IF Test < 1 THEN Test = Test + 360
          IF Test > 360 THEN Test = Test - 360
          Boing.Play: Boing.Position = 0
         END IF
         InvX = InvX + COSFAST(Test) * Multiplier: InvY = InvY + SINFAST(Test) * Multiplier
        END IF
        IF Move > 0 AND Leet = 0 THEN DXScreen.Line(InvX, InvY, InvX-COSFAST(Test)*7, InvY-SINFAST(Test)*7, &H008400) ' Draw different colors depending on win/lose
        IF Move > -1 AND Leet = 0 THEN DXScreen.Line(InvX, InvY, InvX+COSFAST(Test)*15, InvY+SINFAST(Test)*15, &H008400): DXScreen.Circle(InvX-5, InvY-5, InvX+5, InvY+5, &H008400, &H00FF00)
        IF Move > 0 AND Leet = 1 THEN DXScreen.Line(InvX, InvY, InvX-COSFAST(Test)*7, InvY-SINFAST(Test)*7, &H000084) ' Draw different colors depending on win/lose
        IF Move > -1 AND Leet = 1 THEN DXScreen.Line(InvX, InvY, InvX+COSFAST(Test)*15, InvY+SINFAST(Test)*15, &H000084): DXScreen.Circle(InvX-5, InvY-5, InvX+5, InvY+5, &H000084, &H0000FF)
        IF Move < 0 THEN DXScreen.Circle(InvX-5, InvY-5, InvX+5, InvY+5, &H000084, &H0000FF)
'-UPDATE DXSCREEN---------
        DXScreen.Flip
       END SUB
掌柜推荐
 
 
¥738.00 ·
 
 
¥1,480.00 ·
 
 
¥397.00 ·
 
 
¥950.00 ·
 
 
¥264.00 ·
 
 
¥1,005.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2013-06-19 07:46:35