Rem ***** Mental Maths Blaster *****
Rem DBC Brain Teaser Challenge Entry By TDK_Man
 
Gosub Setup
Gosub OptionsMenu
T = Timer()
 
Rem Main Game Loop
Do
  If LeftKey()=1 Then Dec BasePosX,4: Gosub MoveBase
  If RightKey()=1 Then Inc BasePosX,4: Gosub MoveBase
  If Spacekey()=1 and FiredBullet=0
    FiredBullet=1
    BulletPosX = BasePosX + 22
    BulletPosY = BasePosY-4
  Endif
  If FiredBullet=1 Then Gosub MoveBullet
  Elapsed = Timer()-T
  If Elapsed >= DropTime
    Gosub MoveNumbers
    T = Timer()
  Endif
  If Message = 1 Then Gosub WellDoneAnim
  If Message = 2 Then Gosub OopsAnim
  If Scancode()=16
    Rem Q Key Pressed To Quit So Return To Options Screen After Checking For HiScore
    Gosub CheckHiScore
    Gosub OptionsMenu
  Endif
  Sync
  Gosub ScreenUpdate
Loop
End
 
Rem **********************************************************************
Rem ***                          PROCEDURES                            ***
Rem **********************************************************************
 
AttractMode:
  Inc BasePosX,BaseDir
  If BasePosX < 0 Then BasePosX = 0: BaseDir=2
  If BasePosX > 752 Then BasePosX = 752: BaseDir=-2
  Sprite 1,BasePosX,BasePosY,110
  R = Rnd(100)
  If R=0 and FiredBullet=0
    FiredBullet=1
    BulletPosX = BasePosX + 22
    BulletPosY = BasePosY-4
  Endif
  If FiredBullet=1 Then Gosub MoveBullet
  For N=0 To 10
    Select NumPos(N,2)
      Case 1: Rem Right
        NumPos(N,0) = NumPos(N,0) + 4
        If NumPos(N,0) > 732 Then NumPos(N,0) = 732: NumPos(N,2)=2
      EndCase
      Case 2: Rem Down
        NumPos(N,1) = NumPos(N,1) + 4
        If NumPos(N,1) > 400 Then NumPos(N,1) = 400: NumPos(N,2)=3
      EndCase
      Case 3: Rem Left
        NumPos(N,0) = NumPos(N,0) - 4
        If NumPos(N,0) < 10 Then NumPos(N,0) = 10: NumPos(N,2)=4
      EndCase
      Case 4: Rem Up
        NumPos(N,1) = NumPos(N,1) - 4
        If NumPos(N,1) < 40 Then NumPos(N,1) = 40: NumPos(N,2)=1
      EndCase
    EndSelect
    Sprite 99+N,NumPos(N,0),NumPos(N,1),99+N
  Next N
Return
 
CheckHiScore:
  N=11
  Repeat
    Dec N
    ArrayScore = HScore(N)
  Until ArrayScore > Score or N=0
  Rem N is now the slot above the one we actually want (which is N+1)
  Rem so we shuffle all it and all below it down to make room
  For I=10 To N+2 Step -1
    HSName$(I) = HSName$(I-1)
    HScore(I) = HScore(I-1)
  Next I
  Rem Slot N+1 is now free so fill it
  HSName$(N+1) = PlayerName$
  HScore(N+1) = Score
  Rem Now Save It
  If File Exist("Hiscores.dat") Then Delete File "Hiscores.dat"
  Open To Write 1,"Hiscores.dat"
    For N=1 To 10
      Write String 1,HSName$(N)
      Write String 1,Str$(HScore(N))
    Next N
  Close File 1
  Repeat
  Until ScanCode()=0
Return
 
ChooseQuestion:
  Rem Temp Question
  Select Level
    Case 1
      Rem Beginner Level Addition
      Sublevel = (QuestionNumber*3) + (Round*4)
      Val1 = Rnd(Sublevel): Val2 = Rnd(Sublevel/2)
      Question$ = Str$(Val1) + " + " + Str$(Val2) + " = "
      Answer$ = Str$(Val1+Val2)
      AnswerLen = Len(Answer$)
    EndCase
    Case 2
      Rem Medium Level Addition & Subtraction
      Sublevel = (QuestionNumber*4) + (Round*5)
      Val1 = Rnd(Sublevel): Val2 = Rnd(Sublevel/2)
      Operator = Rnd(1)
      If Operator = 0
        Question$ = Str$(Val1) + " + " + Str$(Val2) + " = "
        Answer$ = Str$(Val1+Val2)
        AnswerLen = Len(Answer$)
      Else
        Question$ = Str$(Val1) + " - " + Str$(Val2) + " = "
        Answer$ = Str$(Val1-Val2)
        AnswerLen = Len(Answer$)
      Endif
    EndCase
    Case 3
      Rem Hard Level Addition, Subtraction, Multiplication & Division
      Sublevel = QuestionNumber + Round
      Val1 = Rnd(Sublevel)+5: Val2 = Rnd(Sublevel)+5: Val3 = Rnd(Sublevel)+5
      Operator = Rnd(6)
      If Operator = 0
        Question$ = Str$(Val1) + " + " + Str$(Val2) + " + " + Str$(Val3) + " = "
        Answer$ = Str$(Val1+Val2+Val3)
        AnswerLen = Len(Answer$)
      Endif
      If Operator = 1
        Question$ = Str$(Val1) + " + " + Str$(Val2) + " - " + Str$(Val3) + " = "
        Answer$ = Str$(Val1+Val2-Val3)
        AnswerLen = Len(Answer$)
      Endif
      If Operator = 2
        Question$ = Str$(Val1) + " - " + Str$(Val2) + " - " + Str$(Val3) + " = "
        Answer$ = Str$(Val1-Val2-Val3)
        AnswerLen = Len(Answer$)
      Endif
      If Operator = 3
        Question$ = Str$(Val1) + " x " + Str$(Val2) + " + " + Str$(Val3) + " = "
        Answer$ = Str$(Val1*Val2+Val3)
        AnswerLen = Len(Answer$)
      Endif
      If Operator = 4
        Question$ = Str$(Val1) + " x " + Str$(Val2) + " - " + Str$(Val3) + " = "
        Answer$ = Str$(Val1*Val2-Val3)
        AnswerLen = Len(Answer$)
      Endif
      If Operator = 5
        Question$ = Str$(Val1) + " x " + Str$(Val2) + " "+Chr$(247)+" " + Str$(Val3) + " = "
        Answer$ = Str$((Val1*Val2)/Val3)
        AnswerLen = Len(Answer$)
      Endif
      If Operator = 6
        Question$ = Str$(Val1) + " x " + Str$(Val2) + " x " + Str$(Val3) + " = "
        Answer$ = Str$(Val1*Val2*Val3)
        AnswerLen = Len(Answer$)
      Endif
    EndCase
    Case 4
      Rem Genius Level - Hard Level Plus A Bit! - Disabled Cos Out Of Time... :(
      Sublevel = (QuestionNumber*5) + (Round*5)
      Val1 = Rnd(Sublevel)+15: Val2 = Rnd(Sublevel)+15: Val3 = Rnd(Sublevel)+15
      Operator = Rnd(3)
      Question$ = Str$(Val1) + " "+Op$(Rnd(3))+" " + Str$(Val2) + " "+Op$(Rnd(3))+" " + Str$(Val3)
      Answer$ = Str$(Val1-Val2)
      AnswerLen = Len(Answer$)
    EndCase
  EndSelect
  CurrentChar = 1
  ThisNum$ = "*"
Return
 
EndRoundAnim:
  Sprite 8,221,287,118
  Show Sprite 8
  Wait 2000
  Hide Sprite 8
Return
 
GetReadyAnim:
  YPos#=-20: Gravity#=0.7: Velocity#=2.8
  Sprite 6,332,YPos#,116
  Show Sprite 6
  Repeat
    Inc Velocity#,Gravity#: If Velocity# > 8.0 Then Velocity# = 8.0
    Inc YPos#,Velocity#
    Sprite 6,332,YPos#,116
    If YPos# >= 287.0 Then Velocity# = 0.0-Velocity#: Inc Gravity#,.02
    Sync
  Until Gravity# >= 0.88
  Wait 2000
  Hide Sprite 6
  Gosub GoAnim
Return
 
GoAnim:
  Rem Go Anim Sprite #7 38,25
  SPXPos = 400: SPYPos = 300
  Scale Sprite 7,1
  Sprite 7,SPXPos,SPYPos,117
  Show Sprite 7
  N=10: Scaler=20
  Repeat
    Inc N,Scaler
    Inc Scaler,10
    Scale Sprite 7,N
    Sprite 7,SPXPos,SPYPos,117
    Dec SPXPos,Scaler/5: Dec SPYPos,Scaler/6
    Sync
  Until N >= 4000
  Scale Sprite 7,1
  Hide Sprite 7
Return
 
GreatAnim:
  Y = 601
  Sprite 5,252,Y,115
  Show Sprite 5
  Repeat
    Dec Y,4
    Sprite 5,252,Y,115
    Sync
  Until Y <= 287
  Wait 2000
  Hide Sprite 5
Return
 
Hiscores:
  Hide Sprite 1
  Hide Sprite 2
  Set Text Size 28
  Sync
  CLS
  Ink RGB(255,0,0),0:  Center Text 400,100,"Mental Maths Blaster HiScore Table"
  Ink RGB(255,255,0),0:  Center Text 399,99,"Mental Maths Blaster HiScore Table"
  For N=1 To 10
    Ink RGB(0,0,255),0: Text 250,N*24+120,HSName$(N)
    If N=1
      Ink RGB(255,255,255),0
    Else
      Ink RGB(0,255,0),0
    Endif
    Text 249,N*24+119,HSName$(N)
    S$ = Str$(HScore(N))
    While Len(S$)<6
      S$="0"+S$
    EndWhile
    Ink RGB(0,0,255),0: Text 450,N*24+120,S$
    If N=1
      Ink RGB(255,255,255),0
    Else
      Ink RGB(0,255,0),0
    Endif
    Text 449,N*24+119,S$
  Next N
  Ink RGB(170,170,255),0
  Center Text 400,500,"Press Any Key To Exit The HiScore Screen"
  Repeat
  Until Inkey$()=""
  Repeat
    Gosub AttractMode
    Sync
  Until Inkey$()<>""
  Set Text Size 28
  Sync
  Show Sprite 1
  Show Sprite 2
Return
 
InitGame:
  Hide Sprite 1
  Hide Sprite 2
  For N=0 To 10
    Hide Sprite 99+N
    NumPos(N,0) = N*72+8
    NumPos(N,1) = 34
    NumPos(N,2) = 1
    Sprite 99+N,NumPos(N,0),NumPos(N,1),99+N
  Next N
  BasePosX = 376: FiredBullet=0
  Sprite 1,BasePosX,BasePosY,110
  Sprite 2,-100,-100,111
  Score = 0: DropTime = 600: DropDist = 2: Round=0
  TotalQuestions = 10: QuestionNumber = 1: Lives=3
  Gosub ScreenUpdate
  Show Sprite 1
  Show Sprite 2
  For N=0 To 10
    Show Sprite 99+N
  Next N
  Rem Get Ready Anim
  Gosub GetReadyAnim
  Gosub ChooseQuestion
  Set Text Size 28
  Sync
Return
 
Instructions:
  Hide Sprite 1
  Hide Sprite 2
  Set Text Size 20
  Sync
  CLS
  Ink RGB(0,255,0),0:  Center Text 400,100,"Mental Maths Blaster Instructions"
  Ink RGB(255,255,255),0
  Center Text 400,120,"Select your required level by pressing the L key. S to start the game."
  Center Text 400,140,"A maths question of varying difficulty (depending on the level) will appear"
  Center Text 400,160,"at the bottom of the screen. Using the left and right cursor keys and the"
  Center Text 400,180,"space bar to fire, you must shoot the numbers to answer the question."
  Center Text 400,210,"If you hit the wrong number in a sequence you must start the whole answer"
  Center Text 400,230,"again. Numbers move down the screen and speed up in later levels, but when"
  Center Text 400,250,"shot, they return to the top of the screen."
  Center Text 400,280,"If any number gets down to the base, a life is lost. You start with 3 lives."
  Center Text 400,310,"A 'round' consists of 10 questions and at the end of each round the questions"
  Center Text 400,330,"get harder and the numbers move faster."
  Ink RGB(174,174,255),0
  Center Text 400,355,"Right Number = 1 Pt     Correct Answer = 5 Pts     Complete Round = 100 Pts"
  Center Text 400,375,"An Extra Life Is Awarded Every 5,000 Pts"
  Ink RGB(255,255,0),0
  Center Text 400,500,"Press Any Key To Exit The Instruction Screen"
  Repeat
  Until Inkey$()=""
  Repeat
    Gosub AttractMode
    Sync
  Until Inkey$()<>""
  Set Text Size 28
  Sync
  Show Sprite 1
  Show Sprite 2
Return
 
MoveBase:
  If BasePosX < 0 Then BasePosX = 0
  If BasePosX > 752 Then BasePosX = 752
  Sprite 1,BasePosX,BasePosY,110
Return
 
MoveBullet:
  Dec BulletPosY,8
  Sprite 2,BulletPosX,BulletPosY,111
  NumHit = Sprite Collision(2,0)
  If NumHit > 98
    If NumHit > 99
      HitChar$ = Str$(NumHit-100)
    Else
      HitChar$ = "-"
    Endif
    FiredBullet=0
    Sprite 2,-100,-100,111
    If MenuOn=0
      RequiredChar$ = Mid$(Answer$,CurrentChar)
      rem Answer$ = "8"        AnswerLen = Len(Answer$)           CurrentChar = 1
      If HitChar$ = RequiredChar$
        Rem Hit Correct Number
        Message = 1
        Inc Score,5: If Score > Hiscore Then Hiscore=Score
        XPos = -318: YPos# = 10.0: Velocity#=4.0
        Sprite 3,XPos,YPos#,113
        Hide Sprite 4
        Show Sprite 3
        NumPos(NumHit-99,1) = 34
        Sprite NumHit,NumPos(NumHit-99,0),NumPos(NumHit-99,1),NumHit
        If ThisNum$ = "*"
          ThisNum$ = HitChar$
        Else
          ThisNum$ = ThisNum$ + HitChar$
        Endif
        If Len(ThisNum$) < AnswerLen: Rem More Numbers To Go
          Inc CurrentChar
        Else
          Rem **********************
          Rem    Puzzle Completed
          Rem **********************
          NumPos(NumHit-99,1) = 34
          Sprite NumHit,NumPos(NumHit-99,0),NumPos(NumHit-99,1),NumHit
          Inc Score,10: If Score > Hiscore Then Hiscore=Score
          Gosub ScreenUpdate
          Gosub GreatAnim
          Message = 0
          Inc QuestionNumber
          If QuestionNumber = 11
            Rem End Of Round
            Gosub EndRoundAnim
            Inc DropDist
            Inc Score,100
            QuestionNumber = 1
            Inc Round
          Endif
          Rem Reset All Numbers
          Repeat
            MovedNum=0
            For N=0 To 10
              If NumPos(N,1) > 34
                NumPos(N,1) = NumPos(N,1) - 2
                Inc MovedNum
              Endif
              Sprite 99+N,NumPos(N,0),NumPos(N,1),99+N
            Next N
            Sync
          Until MovedNum=0
          BasePosX = 376: FiredBullet=0
          Sprite 1,BasePosX,BasePosY,110
          Sprite 2,-100,-100,111
          Gosub GetReadyAnim
          Gosub ChooseQuestion
          Gosub ScreenUpdate
        Endif
      Else
        Rem Hit WRONG Number
        NumPos(NumHit-99,1) = 34
        Sprite NumHit,NumPos(NumHit-99,0),NumPos(NumHit-99,1),NumHit
        Message = 2
        XPos = -396: YPos# = 10.0: Velocity#=4.0
        Sprite 4,XPos,YPos#,114
        Hide Sprite 3
        Show Sprite 4
        Gosub ScreenUpdate
        ThisNum$ = "*"
        If CurrentChar > 1 Then Dec CurrentChar
      Endif
    Endif
  Endif
  If BulletPosY<=32 Then FiredBullet=0: Sprite 2,-100,-100,111
Return
 
MoveNumbers:
  For N=0 To 10
    NumPos(N,1) = NumPos(N,1) + DropDist
    Sprite 99+N,NumPos(N,0),NumPos(N,1),99+N
  Next N
Return
 
OopsAnim:
  Inc XPos,4: Inc YPos#,Velocity#
  Sprite 4,XPos,YPos#,114
  If YPos# >= 510.0 Then Velocity# = 0.0-Velocity#
  If XPos >= 800
    Hide Sprite 4
    Message = 0
  Endif
Return
 
OptionsMenu:
  Set Text Size 28
  Sync
  For N=0 To 10
    Show Sprite 99+N
  Next N
  ExitMenu=0: MenuOn=1
  Repeat
    CLS
    Ink RGB(255,60,0),0: Center Text 402,2,"Mental Maths Blaster"
    Ink RGB(255,255,0),0: Center Text 400,0,"Mental Maths Blaster"
    Ink RGB(255,255,255),0
    Center Text 400,160,"[I]nstructions"
    Center Text 400,200,"[L]evel: "+Level$(Level)
    Center Text 400,240,"[H]iscore Table"
    Center Text 400,280,"[S]tart Game"
    Center Text 400,320,"[Q]uit (Also Works During Game)"
    If CheatMode=1
      Ink RGB(32,32,32),0: Center Text 400,360,"Cheat Mode On"
    Endif
    Ink RGB(255,255,255),0
    I$ = Upper$(Inkey$())
    Select I$
      Case "I"
        Rem Instructions
        Gosub Instructions
      EndCase
      Case "L"
        Rem Change Level
        If KeyFlag=0 Then Inc Level: If Level=4 Then Level=1
      EndCase
      Case "H"
        Rem Display Hiscore Table
        Gosub Hiscores
      EndCase
      Case "S"
        Rem Start The Game
        ExitMenu=1
      EndCase
      Case "C"
        Rem Cheats (You Ain't Seen This Right?)...
        CheatMode=1
      EndCase
      Case "Q"
        Rem Quit The Game
        End
      EndCase
    EndSelect
    KeyFlag = Scancode()
    Gosub AttractMode
    Sync
  Until ExitMenu=1
  MenuOn=0
  Rem Start Game Here!
  Gosub InitGame
Return
 
ScreenUpdate:
  Paste Image 112,0,0
  Ink RGB(255,255,255),0
  Score$ = Str$(Score)
  While Len(Score$) < 5
    Score$ = "0" + Score$
  EndWhile
  Text 76,4,Score$
  HiScore$ = Str$(HiScore)
  While Len(HiScore$) < 5
    HiScore$ = "0" + HiScore$
  EndWhile
  Text 714,4,HiScore$
  Center Text 400,550,"Current Question: "+Question$+ThisNum$
  Ink RGB(255,155,155),0
  Text 0,550,"Q: "+Str$(QuestionNumber)
  Text 80,550,"L: "+Level$(Level)
  Text 700,550,"Lives: "+Str$(Lives)
  If CheatMode=1 Then Ink RGB(0,210,0),0: Text 5,520,Answer$
Return
 
Setup:
  Input "Please Enter Your Name: ";PlayerName$
  Set Display Mode 800,600,32
  Sync On
  Sync Rate 0
  Hide Mouse
  Set Text Font "Tahoma",1
  Set Text Size 52
  Randomize Timer()
  CLS
  Dim NumPos(10,2)
  Dim Level$(4)
  Dim Op$(6)
  Dim HScore(10)
  Dim HSName$(10)
  If File Exist("Hiscores.dat")=0
    Rem Create It
    Open To Write 1,"Hiscores.dat"
      For N=1 To 10
        If HScore(N) = 0 Then HSName$(N)="*** Unused ***"
        Write String 1,HSName$(N)
        Write String 1,Str$(HScore(N))
      Next N
    Close File 1
  Else
    Rem Already there
    Open To Read 1,"Hiscores.dat"
      For N=1 To 10
        Read String 1,HSName$(N)
        Read String 1,T$: HScore(N)=VAL(T$)
      Next N
    Close File 1
  Endif
  Op$(0) = "+"
  Op$(1) = "-"
  Op$(2) = "x"
  Op$(3) = Chr$(247)
  Level$(1) = "Beginner"
  Level$(2) = "Medium"
  Level$(3) = "Hard"
  Level$(4) = "Genius"
  BasePosX = 376: BasePosY = 515
  BaseDir=2: Level=1
  RemStart
    Sprites
    1 - Base
    2 - Bullet
    3 - Well Done! Correct Number...
    4 - Oops! Wrong Number - Start Again...
    5 - Great! You Got The Answer!
    6 - Get Ready...
    7 - Go!
    8 - End Of Round
    100 - 109 Numbers
    110 - Minus Sign
  Remend
  Create Bitmap 1,800,600
  Rem Create Number Sprites
  Restore ColorData
  For N=0 To 10
    CLS
    Ink RGB(232,232,232),0: Box 0,0,64,48
    Ink RGB(128,128,128),0: Box 1,1,64,48
    Ink RGB(182,182,182),0: Box 1,1,63,47
    Read R,G,B,Char$
    Ink RGB(32,32,32),0: Text 18,-2,Char$
    Ink RGB(R,G,B),0: Text 17,-4,Char$
    Get Image 99+N,0,0,65,49
    NumPos(N,0) = N*72+8
    NumPos(N,1) = 34
    NumPos(N,2) = 1
    Sprite 99+N,NumPos(N,0),NumPos(N,1),99+N
    Hide Sprite 99+N
  Next N
  Rem Base Sprite
  CLS
  Ink RGB(223,0,223),0: Box 0,10,48,32
  Ink RGB(83,0,83),0: Box 2,12,48,32
  Ink RGB(138,0,138),0: Box 2,12,45,29
  Ink RGB(223,0,223),0: Box 18,0,30,11
  Ink RGB(83,0,83),0: Box 20,2,30,9
  Ink RGB(138,0,138),0: Box 20,2,27,12
  Get Image 110,0,0,48,32
  Sprite 1,BasePosX,BasePosY,110
  Rem Bullet Sprite
  CLS
  Ink RGB(255,0,128),0
  Box 0,0,2,8
  Get Image 111,0,0,3,9
  Sprite 2,-100,-100,111
  Rem Screen Background Image
  CLS
  Ink 0,0: Box 0,0,799,31: Box 0,551,799,599
  Colratio# = 255.0/548.0
  C#=0.0
  For N=32 To 550
    Ink RGB(0,C#,255-C#),0
    Line 0,N,799,N
    Inc C#,Colratio#
  Next N
  Set Text Size 32
  Sync
  Ink RGB(255,60,0),0: Center Text 402,2,"Mental Maths Blaster"
  Ink RGB(255,255,0),0: Center Text 400,0,"Mental Maths Blaster"
  Set Text Size 28
  Sync
  Ink RGB(255,255,255),0
  Text 4,4,"Score:"
  Text 620,4,"HiScore:"
  Get Image 112,0,0,799,599
  Rem Message Sprites
  CLS
  Ink RGB(0,200,0),0
  Text 2,2,"Well Done! Nice Shooting...."
  Ink RGB(255,255,255),0
  Text 0,0,"Well Done! Nice Shooting...."
  Get Image 113,0,0,318,28
  Sprite 3,-400,-100,113
  CLS
  Ink RGB(255,0,0),0
  Text 2,2,"Oops! Wrong Number - Start Again..."
  Ink RGB(255,255,255),0
  Text 0,0,"Oops! Wrong Number - Start Again..."
  Get Image 114,0,0,396,28
  Sprite 4,-400,-100,114
  CLS
  Ink RGB(255,150,0),0
  Text 2,2,"Great! You Got The Answer!"
  Ink RGB(255,255,255),0
  Text 0,0,"Great! You Got The Answer!"
  Get Image 115,0,0,296,28
  Sprite 5,-400,-100,115
  CLS
  Ink RGB(128,128,255),0
  Text 2,2,"Get Ready..."
  Ink RGB(255,255,255),0
  Text 0,0,"Get Ready..."
  Get Image 116,0,0,136,28
  Sprite 6,-400,-100,116
  CLS
  Ink RGB(128,128,255),0
  Text 2,2,"Go!"
  Ink RGB(255,255,255),0
  Text 0,0,"Go!"
  Get Image 117,0,0,38,28
  Sprite 7,-400,-100,117
  CLS
  Ink RGB(128,128,255),0
  Text 2,2,"End Of Round - 100 Points Bonus!"
  Ink RGB(255,255,255),0
  Text 0,0,"End Of Round - 100 Points Bonus!"
  Get Image 118,0,0,357,28
  Sprite 8,-400,-100,118
  Set Current Bitmap 0
  Delete Bitmap 1
  Paste Image 112,0,0
  Text 81,4,"00000"
  Text 719,4,"00000"
  Center Text 400,550,"Current Question: "+Question$
Return
 
WellDoneAnim:
  Inc XPos,4: Inc YPos#,Velocity#
  Sprite 3,XPos,YPos#,113
  If YPos# >= 510.0 Then Velocity# = 0.0-Velocity#
  If XPos >= 800
    Hide Sprite 3
    Message = 0
  Endif
Return
 
Rem Data Statements
ColorData:
Data 255,0,0,"-",0,255,0,"0",0,0,255,"1",255,0,255,"2",0,255,255,"3"
Data 255,255,0,"4",128,128,128,"5",255,128,0,"6",128,128,255,"7"
Data 157,157,0,"8",66,160,255,"9"