alex17" Posted June 6, 2017 Share Posted June 6, 2017 (edited) Bueno dejo este pequeño aporte que sirve para hacer barras progresivas compuestas por varios dxrectangle function dxMultiProgressBar(tprogreso, progreso, barras, posx, posy, ancho, largo, r, g, b, a, r2, g2, b2 ,a2) local distance = ( (ancho / 10) * 3) / (barras - 1) local bancho = (( ancho / 10) * 7) / barras local pbarra = ( tprogreso / barras) local tbarras = math.ceil( progreso / pbarra) local data1 = pbarra - (( pbarra * tbarras) - progreso) local prbarra = bancho * ( data1 / pbarra) local cache = 0 for i = 1, barras do dxDrawRectangle(posx + cache , posy, bancho, largo, tocolor(r2, g2, b2, a2)) if i < tbarras then dxDrawRectangle(posx + cache , posy, bancho, largo, tocolor(r, g, b,a)) elseif i == tbarras then dxDrawRectangle(posx + cache , posy, prbarra, largo, tocolor(r, g, b,a)) end cache = cache + bancho + distance end end ------------------------------------- -- ejemplo --- local hp = localPlayer:getHealth() dxMultiProgressBar(100, hp, 8, 800, 500, 100, 20, 0, 200, 0, 255, 30, 30, 30 ,255) Edited June 7, 2017 by alex17" Link to comment
aka Blue Posted June 7, 2017 Share Posted June 7, 2017 Gracias @alex17", muy buen aporte 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