Max Value for an Attribute
921creative
Member, PRO Posts: 140
I have a health bar that constrains its width to the value of an attribute times 10, but I want to make sure the bar never exceeds 150 in width. How would I give it a max width of 150 as part of the expression?
Comments
I'll bump this thread as I would also like to know the answer to this. Anyone?
constrain self.size.width to min(200,self.size.width)
200 is just an example. change to your max width
✮ FREE templates at GSinvention ✮
✮ Available for hire! support@gsinvention.com ✮
I figured it out in the meantime - in case someone else is looking for this info, here is the formula that worked for me:
If you want to keep an attributes value between a min and max use Constrain Attribute like this, MYATTRIBUTE to min(max(MYATTRIBUTE,0),XYZ) , where XYZ=max value for your attribute.