Here's a layout template that could be applied to ANY DB program:
Program Start
Gosub Setup
Gosub MainMenu
Rem * Main Loop *
Do
Rem Go round this loop playing the game Eg:
Gosub PlayerInput
Gosub EnemyMove
Gosub PlayerMove
If OutOfLives
If Score Big Enough Then Gosub HiScores
Gosub MainMenu
Endif
Loop
End
Rem *** All Procedures Here... ***
Setup:
Rem Set up constant vars, screen mode, create/load images, sounds etc
Return
InitVars:
Rem Set up all variables here to start/restart the game
Return
MainMenu:
Rem Show Main Menu Screen
Repeat
If Player Selects Quit Then End
Until User Selects Play
Gosub InitVars: Rem Set up variables required to start/restart the game
Return
Hiscores:
Rem Show Hiscore Screen
Repeat
Until User Selects Exit
Return
PlayerInput:
Rem Get all keyboard and mouse input
Return
EnemyMove:
Rem Move all computer controlled characters
Return
PlayerMove:
Rem Move player character
Return
Rem *** All Functions Here... ***
It's not real code, it's just a template to show you how to structure your program to make it efficient when it runs and easy to find bugs when it won't!
TDK_Man