Started by SwiftDeathSK, February 27, 2010, 08:41:47 am
Quote from: Arceus on February 27, 2010, 07:17:02 pmI don't know if this is too advanced or not, but here goes:Your HUD can be contained within a single class, and it is usually best to do so, unless you want an HUD with different components that can be toggled in game. The class should inherit from Sprite in order to be able to display graphics objects.In this HUD class, you will obviously need a constructor, to set its position on screen and set the positions to draw each item on the HUD (like health bars, etc.). You will also need to make fields to hold the current state of the information to be displayed, such as player health, etc. Then, the main thing that the HUD will need is the update method. In this method, you need to see if the information on any of the displays has changed (using those fields from the constructor). For each field that has changed, you will need to update and redraw that specific display, as well as storing this new state in the fields to keep track of it. It is advisable to have a separate redraw method for each display.At this point, you have an HUD class that is able to update once a frame and display information as it changes. The only step left is to create an instance of the HUD in the Scene_Map class, and update it continuously from Scene_Map's update. If you want to toggle it on and off, you could create a boolean flag in Game_System which would be accessible at any time.