I would create a state machine. At its simplest it’s a game variable 'state' which indicates what the game is doing right now. Changes of states can be due to user actions (pressing a button), game events (level finished loading) or game logic such as a timer.
It tells the game what it’s doing at any time. So what functions to run, what to display, what inputs to accept. You might also have code that runs only at state transitions, so e.g. going from 'game playing' to 'game paused' runs code to generate the pause screen.