Jump to content

Drawing a circle health bar around a sprite


MarzSocks
 Share

Recommended Posts

How does one animate the gain or loss in degree's of an arc drawn around a sprite ( based on how much health the spite has. )

E.g. 50% = 180 degree arc. Gain 25% health, grow the arc to 75 degrees. Loose 50% health, reduce ark down to 25 degrees.

Link to comment
Share on other sites

11 hours ago, tokumaru said:

The tween is modifying a property of the "angle" object, and this property is being used to draw the arc and to calculate its color.

I thought that might be the case, so does that mean every arc that is drawn will have the tween? Regardless of if one wants the tween on that arc or not?

Link to comment
Share on other sites

You could simply update the arc's angle and color based on the current health value and it would change instantaneously to that configuration, but if you plan on animating the changes you'll have to modify the color and the angle gradually over time. Tweening is one way to do it (and was probably used in the example for simplicity's sake), but you could just as well use your own logic every frame to make the arc's angle "catch up" with the current health value.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...