How to make Health bar Change a color and Have a Limit
lidoazul
Member Posts: 31
Hi , this is my first post
I have 2 Question:
First I crate a Health Bar with attributes 9 integer , the image is green color .How change the bar in red color when running out life.
Second how to make do when the actor lost life and retrieving the life back , in the heath bar the life have a limite( the width bar not expand.
Would appreciate any help
I have 2 Question:
First I crate a Health Bar with attributes 9 integer , the image is green color .How change the bar in red color when running out life.
Second how to make do when the actor lost life and retrieving the life back , in the heath bar the life have a limite( the width bar not expand.
Would appreciate any help
Best Answers
-
quantumsheep Posts: 8,188For your first question, I would make the image white - you can use something like pixelmator (which is ace and cheap) to replace the green with white.
Then use the change attribute behaviour three times.
First change attribute should be self.colour Red to 0
Second change attribute should be self.colour Green to 1
Third change attribute should be self.colour Blue to 0
This will colour the white bar to Green in-game.
To change the colour to red when you are low on health, you could make a rule that says:
If player health is less than or equal to 2
First change attribute should be self.colour Red to 1
Second change attribute should be self.colour Green to 0
Third change attribute should be self.colour Blue to 0
Then in the OTHERWISE section of the rule, put in the original changes e.g.
First change attribute should be self.colour Red to 0
Second change attribute should be self.colour Green to 1
Third change attribute should be self.colour Blue to 0
This way, if your life is less than or equal to 2, the colour will be red. If it's above 2, then it'll display as green.
Hope that helps!
QS =DDr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io -
quantumsheep Posts: 8,188No worries.
To the second question, you could use fancy floor command thingies, but I never got used to them.
Instead, I'd have this:
Rule:
If player picks up object
AND
if player life is less than 10
change attribute life to life +1
That should do it.
QSDr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
Answers
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page