Alternatively to skalogryz suggestion, here is a draft of a basic game code structure if you interested to learn:
//...
//...
var
Score: Integer;
isQuit: Boolean;
begin
// Initialize variables
Score := 0;
isQuit := False;
ShowIntroMenu;
case MenuItemSelected of
1: // ...
2: // ...
3: isQuit := True;
end;
// Main loop
while not(isQuit) then begin
UpdateScreen;
GetUserInput;
CalculateMovement;
CalculateScore;
if (ExitClicked) or (ExitKeyPressed) then isQuit := True;
if (Score <= 0) then isQuit := True;
end;
ShowEndingScreen;
end.
Don't simply copy/paste the code. It won't work. It just gives you the idea how to write game. Try to expand each section one-by-one, and you'll get a full working game.
Note:
You may want to add a big loop and move the main_loop into it, so there will be a main menu that will be show up to player when he/she end the game but not quit the program. Doing so is more challenging, I suggest do it only after the basic is working correctly.