Max Value for an Attribute

921creative921creative Member, PRO Posts: 140
edited December 2011 in Working with GS (Mac)
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

  • PaxtonPaxton Member Posts: 89

    I'll bump this thread as I would also like to know the answer to this. Anyone?

  • -Timo--Timo- Member Posts: 2,313

    constrain self.size.width to min(200,self.size.width)
    200 is just an example. change to your max width

  • PaxtonPaxton Member Posts: 89
    edited June 2014

    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.

Sign In or Register to comment.