scolen Posted September 9, 2023 Share Posted September 9, 2023 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
DiSaMe Posted September 9, 2023 Share Posted September 9, 2023 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. 2 Link to comment
scolen Posted September 9, 2023 Author Share Posted September 9, 2023 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? 1 Link to comment
FlorinSzasz Posted September 9, 2023 Share Posted September 9, 2023 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)) 1 Link to comment
scolen Posted September 9, 2023 Author Share Posted September 9, 2023 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 1 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now