Monday, October 17, 2016

actionscript 3 - What is a good approach for making a relationship between the HUD and Environment?


What is an elegant / common way to build a relationship between the game scene / environment / world and the HUD that usually sits on top of it? I have thought about this for a while, and though there are ways to accomplish this that are easy to implement, they always seem to expose too much unrelated information between the two, or end up being too coupled. An example of this that I have used in the past would be to simply pass reference from the HUD to the Environment and vice-versa (which is obviously not a good apporach for many reasons, especially when aiming for low coupling).


What I want to end up with is a clean, uncoupled way to do things like:



  1. From the HUD; reference and manipulate objects within the environment, change the state of the Environment itself.

  2. From the environment; update the HUD to reflect the current state of the environment.



Maybe passing reference between the two is the way to go about this, but I feel like there's some pattern that I am missing for this type of task. Any insights into past experience and implementations concerning this type of problem would be very helpful.




No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...