// Stop the main game script execution if the form is closed private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { Console.WriteLine("Main game form has been closed"); game.stopGame(); }