Jump to content

Help!| DxDrawCircle


scolen

Recommended Posts

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?

Link to comment

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
Link to comment
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
Link to comment

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...