Okay, the truth is that overlays are not any different from menus except for the fact that they tend to give feedback to the player rather than provide the player with a means to choose between a set of options. Overlays are also built from components and use actions to interact with the game. Our overlays will simply be a health bar and a button for launching the in-game menu. Let's start with the button since it is the easiest and most familiar.
Create a custom event handler named
MainAI. The code will be as follows:
this.MenuState ( )
We've seen this format before—we are just using a button to trigger a transition between game states. In this case, we are loading
MenuState. What should happen when we load