I am making a game and I am trying to decide what is the best practice for exchanging damage between two objects on the screen. Should the damage be passed directly between the two objects or should it be pass through a central game engine that decides the damage and different criteria’s such as hit or miss or amount dealt.
So overall what is the best practice.
It depends in large part on the rules of the game. However, it’s not unusual for multiple objects to need to get involved. However, I would advise against putting game-rules code into the MovieClip instance that displays the object; keeping them as peers allows game state to be separated and saved/relayed more easily.
Here’s an example: