xXMADEXx Posted January 12, 2014 Share Posted January 12, 2014 Hi guys. Im writing a script, but I ran into a problem. I can't figure out the math for this (i know its easy, but kinda bad with math) So, I have two rectangles and im trying to get it so that one of the rectangles is on a scale of 0-100 based on the other rectangles width. So for example, rec1 (The back rectangle) has a width of 335... Now I want rec2 (The front rectangle) to fill up 50% of rec1. If you understand this, it's kinda hard to explain, please reply. Thanks - xXMADEXx Link to comment
arezu Posted January 12, 2014 Share Posted January 12, 2014 local rectWidth1 = 355 local rectWidth2 = rectWidth1 * 0.5 -- 0.5 is 50%, 0.0 is 0% and 1.0 is 100% Link to comment
xXMADEXx Posted January 12, 2014 Author Share Posted January 12, 2014 Thank you for the help, but it seems to be a tad bit off. This is what it's doing for 100%: and here is the code ( w = width) dxDrawRectangle ( x+2, y+2, w* 0. .. progress, h-4, tocolor ( 255, 255, 255, 255 ) ) Link to comment
xXMADEXx Posted January 12, 2014 Author Share Posted January 12, 2014 Oh nevermind, I found how to fix it. Thank you for your help. 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