# Radial experience / life bar modification

0 favourites
• 6 posts
From the Asset Store
Custom animated Health Bar - check youtube video to make it yourself
• Hi all,

Is there a way to modify the math here so that this bar acts like an experience bar? With 0 being fully masked and, as experience increases, it unmasks from the top clockwise. I'd really appreciate your help! I've been fiddling with it for a while and can't quite figure it out. Thanks to oosyrag for the original post a year ago. I've been searching for something like this forever.

I agree with the previous post's suggestion of just making animation frames.

But here is an over engineered solution for fun - dropbox.com/s/o2hi951wzoquaoe/circularcanvasmask.c3p

You can turn off the blend mode on the canvas object to see how it renders. You could also probably draw the circle itself with another canvas if you wanted.

#### Tagged:

• Of course there is. It's just a couple sin and cos functions. To get the circle to start at the top we need to rotate it by 180 degrees so we add 180 to the value inside the functions. To get it to fill clockwise instead of counter clockwise, we just need to invert (multiply by -1) the value inside the function.

sin(-1 * (value + 180))

cos(-1 * (value + 180))

Here is the modified example.

drive.google.com/file/d/12DTzuTArnmAPlzMk6DOdKBqUIbC5Gl92/view

• Of course there is. It's just a couple sin and cos functions. To get the circle to start at the top we need to rotate it by 180 degrees so we add 180 to the value inside the functions. To get it to fill clockwise instead of counter clockwise, we just need to invert (multiply by -1) the value inside the function.

sin(-1 * (value + 180))

cos(-1 * (value + 180))

Here is the modified example.

https://drive.google.com/file/d/12DTzuTArnmAPlzMk6DOdKBqUIbC5Gl92/view?usp=sharing

Thanks a ton InDWrekt!! This is absolutely exactly what I was going for! I'm just getting back into game design two years later to try to finish a game I put a lot of time into a few years back. This radial experience bar has always been a bit of a hurdle so this is huge.

Also thanks again for the original example oosyrag. You guys are awesome

• You're welcome. Good luck with your project.

• So, there was something bothering me about the original example and I couldn't help but mess with it some more. Download the project again. I simplified it. The original example drew the circle in 2 events. 1 split the circle into 8 parts and the other filled the 8 parts again splitting them into 8 parts. I got rid of the second draw event and instead just divided the circle into 100 even parts in the first event. It basically looks the same but reduces some memory use and CPU processing. Plus it's easier to read and upkeep.

drive.google.com/file/d/12DTzuTArnmAPlzMk6DOdKBqUIbC5Gl92/view

• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• Wow this is SUPER clean thank you InDWrekt! Definitely makes things much easier. I'm currently trying to figure out how to lerp the bar to the given number. I basically want to have the experience text increase using lerp and have the radial bar match the text as they both increase together to match the earned amount of experience

Do you know if you can lerp a value the same way you can lerp an object's position?

• 6 posts
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)