private void UpdateScreen(object sender, EventArgs e) { // Check for GameOver if (Settings.GameOver) { // Check if 'Enter' is pressed if (Input.KeyPressed(Keys.Enter)) { StartGame(); } } else { if (Input.KeyPressed(Keys.Right) && Settings.Direction != Directions.LEFT) Settings.Direction = Directions.RIGHT; if (Input.KeyPressed(Keys.Left) && Settings.Direction != Directions.RIGHT) Settings.Direction = Directions.LEFT; if (Input.KeyPressed(Keys.Up) && Settings.Direction != Directions.DOWN) Settings.Direction = Directions.UP; if (Input.KeyPressed(Keys.Down) && Settings.Direction != Directions.UP) Settings.Direction = Directions.DOWN; MovePlayer(); } // Close the game if 'Escape' is pressed if (Input.KeyPressed(Keys.Escape)) this.Close(); PlayArea.Invalidate(); }