Change Attribute Self.Color to Self.Health
Homebrew_Kid
Member Posts: 21
Trying to change the green tint of an actor from 175 down to 50 relative to the health pool; something like this:
If self.health is max at 25,
self.heath{25}(5) + 50 =self.color.green{175}
If self.health is minimal at 0,
self.heath{0}(5) + 50 =self.color.green{50}
Also, displaying text as self.color.green shows it as the number 1 on scene (shouldn't it be 175?). The colors from the color swatch are:
R:0
G:175
B:50
A:255
Decreasing self.health is accomplished by:
No changes in color so far.
Comments
The Mac version of GameSalad Creator uses numbers between 0 and 1 for self.color. It is probably the same for the PC version.
RGB values are displayed in a range from 0 to 255. To convert, you divide by 255. So a self.color.green value of 175 should actually be 175/255.
To vary a color attribute based on another attribute such as health -- and in the ranges you mentioned -- try this:
constrain attribute self.color.green to ((self.health/25)*(175-50)+50)/255
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Right, I remember seeing a fraction one time when adjusting the constrains...
This worked Going to add some red tint too...