#What is a nice, clean way of passing Player data into a HUD class?

5 messages · Page 1 of 1 (latest)

fair crane
#

I have a World class, which references both Player and GameUI. GameUI references HUD, as well as other stuff like an inventory menu.
What is a good way to get data (like health) from Player into HUD?
Thanks.

elder temple
#

There isn't really a set way of "do this" for that

#

In my case, I would probably pass the data to the HUD everytime I need to update it

#

could be done using a getter-setter function

tiny quail
#

Maybe you can try something like observer/observable or just with an interface that your "HUDManager" work with and your Player implements