Jump to content

Help!| DxDrawCircle


scolen

Recommended Posts

Posted

I made this so that when a player's health is 0, this circle ends. But why is it not t

function render()
    health = getElementHealth(localPlayer)
    dxDrawCircle(200, 400, 100, -270,(health * 6.3 / 2 - 90), tocolor(0, 255, 0))
    --dxDrawCircle(200, 400, 90, 0, 360, tocolor(0, 0, 0))

end
addEventHandler("onClientRender", root, render)

he same, why is it only reduced by half?

Posted

Your start angle is -270. The stop angle is:

When the health is 100: (100 * 6.3 / 2 - 90) = 225

When the health is 0: (0 * 6.3 / 2 - 90) = -90

So the stop angle is always larger than the start angle, making the arc always visible. You need to choose such numbers that the stop angle would match the start angle when the health is 0.

  • Like 2
Posted
7 minutes ago, DiSaMe said:

Your start angle is -270. The stop angle is:

When the health is 100: (100 * 6.3 / 2 - 90) = 225

When the health is 0: (0 * 6.3 / 2 - 90) = -90

So the stop angle is always larger than the start angle, making the arc always visible. You need to choose such numbers that the stop angle would match the start angle when the health is 0.

Can I include this in my code and show it?
  • Like 1
Posted
41 minutes ago, scolen said:
Can I include this in my code and show it?

I am not good at this like(dxdraw functions), i didnt do math like geometry in a while but this should work!

dxDrawCircle(200, 400, 100,0,((health/100) * 360), tocolor(0, 255, 0))

 

  • Thanks 1
Posted
2 minutes ago, FlorinSzasz said:

I am not good at this like(dxdraw functions), i didnt do math like geometry in a while but this should work!

dxDrawCircle(200, 400, 100,0,((health/100) * 360), tocolor(0, 255, 0))

 

oky ❤️
 
  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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