   Code structure for arcade games
  Hi, I've developed a few arcade games so far and have the following structure in almost all of them: I have 1 file which contains a class called kernel with the following functions:init() welcome_screen() menu_screen() help_Screen() play_game() end_screen()And another file, called Game, which basically calls all these functions and controls the flow of the game. Also, I have classes for different characters, whenever required.Is this a good code structure, or should I try having different files(classes) for different functions like welcome screen, playing, help screen, etc? As in, instead of including all the code for these things in 1 file, should I be having different classes for each one of them? The only problem I think it might cause is that I would need certain variables like score, characters, etc which are common to all of them, that's why I have all these functions in a Kernel class so that all these functions can use these variables.   
  If it works and is easily maintainable it's good structure.I find most game apps look somewhat similar most of the time. The entry point file typically has some C-style garbage to control game state flow and maintain some high level objects.  You could wrap it all up in a class if you feel that's cleaner.  Personally, I find a c-style main that controls a C++-style game more intuitive for my personal projects.-me   ;  What I usually do is make a base class called GameMode, and then derive all my other classes from there. All these classes have an Init(), Update(Delta), and Draw() function.I have a class called Game which stores all the shared data and has a pointer to a GameMode^. I just create and destroy a game mode as needed, pointing to any of the derived classeseg:CurrentMode = new GameModeCredits;orCurrentMode = new GameModeNormal;CurrentMode.Init(whatever, usually a pointer to Game)then in the main loop of Game,CurrentMode.Update(dt);CurrentMode.Draw();Game has a function called SwitchModes(enum Mode), called from the CurrentModeParent.SwitchModes(mode enum) which just deletes the CurrentMode pointer, and allocated a new one.   