Skip to main content
added 304 characters in body
Source Link
David Gouveia
  • 25k
  • 5
  • 88
  • 127

I think you kinda just answered you own question. The number needs to appear not only on damage but also on heals, i.e. it appears whenever your health changes. And your Damage component has no connection with heals. So they don't really use the same functionality equally.

Because of that I think I would make it a part of your HealthBar. Make it react automatically to any variation in the health bar, and show that variation as a number in green or red depending on whether it increased or decreased. Besides, the HealthBar is by nature a GUI component, and so is the damage number you want to show. On the other hand Damage is conceptual.

But your HealthBar seems to be only holding a percent value at the moment. This would make it harder to know which number to show since there's no absolute range. Because of that I would also change it into a value + max pair instead, and keep it synced with the player's health.

Nonetheless, you might still want to generalize your Damage component a bit further too, to enable applying any sort of stat variation like you mentioned.

The bottomline is...

If and when both options really provide the samesame amount of coupling, then it doesn't matter where you add the functionality. Just pick the one and move on, since none of them will have a benefit over the other. Try to choose the one at the closest level of abstraction though.

I think you kinda just answered you own question. The number needs to appear not only on damage but also on heals, i.e. it appears whenever your health changes. And your Damage component has no connection with heals. So they don't really use the same functionality equally.

Because of that I think I would make it a part of your HealthBar. Make it react automatically to any variation in the health bar, and show that variation as a number in green or red depending on whether it increased or decreased.

But your HealthBar seems to be only holding a percent value at the moment. This would make it harder to know which number to show since there's no absolute range. Because of that I would also change it into a value + max pair instead, and keep it synced with the player's health.

If and when both options really provide the same amount of coupling, then it doesn't matter where add the functionality. Just pick the one and move on.

I think you kinda just answered you own question. The number needs to appear not only on damage but also on heals, i.e. it appears whenever your health changes. And your Damage component has no connection with heals. So they don't really use the same functionality equally.

Because of that I think I would make it a part of your HealthBar. Make it react automatically to any variation in the health bar, and show that variation as a number in green or red depending on whether it increased or decreased. Besides, the HealthBar is by nature a GUI component, and so is the damage number you want to show. On the other hand Damage is conceptual.

But your HealthBar seems to be only holding a percent value at the moment. This would make it harder to know which number to show since there's no absolute range. Because of that I would also change it into a value + max pair instead, and keep it synced with the player's health.

Nonetheless, you might still want to generalize your Damage component a bit further too, to enable applying any sort of stat variation like you mentioned.

The bottomline is...

If and when both options really provide the same amount of coupling, then it doesn't matter where you add the functionality. Just pick the one and move on, since none of them will have a benefit over the other. Try to choose the one at the closest level of abstraction though.

Source Link
David Gouveia
  • 25k
  • 5
  • 88
  • 127

I think you kinda just answered you own question. The number needs to appear not only on damage but also on heals, i.e. it appears whenever your health changes. And your Damage component has no connection with heals. So they don't really use the same functionality equally.

Because of that I think I would make it a part of your HealthBar. Make it react automatically to any variation in the health bar, and show that variation as a number in green or red depending on whether it increased or decreased.

But your HealthBar seems to be only holding a percent value at the moment. This would make it harder to know which number to show since there's no absolute range. Because of that I would also change it into a value + max pair instead, and keep it synced with the player's health.

If and when both options really provide the same amount of coupling, then it doesn't matter where add the functionality. Just pick the one and move on.