Rem DBC Menu Challenge Rem TDK_Man December 2007 Rem Sprite Scaling Menu Function Gosub Setup Rem Main Program Loop Do Mx=MouseX(): My=MouseY(): Mc=MouseClick() Sprite 100,Mx-8,My-8,100 CurrentButton = Sprite Collision(100,0) If CurrentButton > 0 Gosub ScaleSprite If ButtonClicked=1 Then Gosub DecodeButton Endif Sync Center Text 400,0,"TDK_Man's Scaled Sprite Menu." Loop End DecodeButton: For N=1 To MenuOptions Delete Sprite N Next N CLS Print "Button Selected: ";ButtonText$(CurrentButton) Wait Key End Return ScaleSprite: For N=0 To 40 Step 4 Scale Sprite CurrentButton,100+N Sprite CurrentButton,ButtonPosX(CurrentButton)-(N/1.5),ButtonPosY(CurrentButton)-(N/4),CurrentButton Sync Next N ButtonClicked=0 Repeat Mx=MouseX(): My=MouseY(): Mc=MouseClick() Sprite 100,Mx-8,My-8,100 If Mc=1 Then ButtonClicked=1 Sync Until Sprite Collision(100,0)=0 Or ButtonClicked=1 If ButtonClicked=0 For N=40 To 0 Step -4 Scale Sprite CurrentButton,100+N Sprite CurrentButton,ButtonPosX(CurrentButton)-(N/1.5),ButtonPosY(CurrentButton)-(N/4),CurrentButton Sync Next N Endif Return Setup: Set Display Mode 800,600,16 Sync On Sync Rate 0 MenuOptions = 7: Rem Number of buttons on menu screen Dim ButtonPosX(MenuOptions) Dim ButtonPosY(MenuOptions) Dim ButtonText$(MenuOptions) Rem Make sure there are the same number of text labels below as there are MenuOptions ButtonText$(0) = "Nothing Selected" ButtonText$(1) = "Start Game" ButtonText$(2) = "Options" ButtonText$(3) = "Help" ButtonText$(4) = "HiScores" ButtonText$(5) = "MultiPlay" ButtonText$(6) = "Exit Game" ButtonText$(7) = "Unused" Rem Set Font Set Text Font "Arial",1 Set Text Size 32 Rem Make Menu Option Textures Create Bitmap 1,800,600 CLS RGB(255,255,255) Get Image 100,0,0,16,16 Sprite 100,Mx,My,100 Hide Sprite 100 For N=1 To MenuOptions CLS 0 Ink RGB(255,180,180),0: Center Text 74,3,ButtonText$(N) Ink RGB(200,0,0),0: Center Text 75,4,ButtonText$(N) Get Image N,0,0,151,51 Next N Set Text Opaque Set Current Bitmap 0 Delete Bitmap 1 VOffset = (600-(MenuOptions*50))/2 For N=0 To MenuOptions-1 Sprite N+1,620,N*50+VOffset,N+1 ButtonPosX(N+1)=620 ButtonPosY(N+1)=N*50+VOffset Next N Rem Reset Font Set Text Font "Arial",1 Set Text Size 16 Ink RGB(255,255,255),0 Return