In my game, a general HUD object is the same for all NPCs. However, this object has 3 different animations/frames and each NPC has its own instance variable (with the same function) to be associated with these animations. This variable and object expresses the NPC's relationship with the player and, as a state, will vary throughout the game.
To be practical, it is currently programmed as follows:
- All NPCs are in the same family
- There is a single HUD object for all NPCs, which only appears when the player presses UP on the NPC
- Each NPC has its own variable associated with the 3 animations of the HUD object
Do you think that each NPC should have its own HUD object or is there a way to keep one for everyone, discriminating in the programming in some way?
Follow the images of the events below for you to understand better: