The question is answered, right answer was accepted
Health Script
Hello, I’m not really sure what I should do to make a health script. I would like it so that it translates to a in game UI health bar too! If anyone can help me it would be greatly appreciated. Thanks in advanced.
Answer by OutOfRam · Nov 13, 2017 at 10:17 AM
Hey there, using my deductive reasoning and not being pretentious to those who are less experienced than I... Max... i think this can help you. Here are links to two parts of the same tutorial that outline exactly what you are trying to accomplish.
https://unity3d.com/learn/tutorials/projects/survival-shooter/health-hud?playlist=17144
https://unity3d.com/learn/tutorials/projects/survival-shooter/player-health
I hope this helps!
I feel like you mean "condescending" but, giving you the benefit of the doubt, what did you think made my reply pretentious?
pre·ten·tious prəˈten(t)SHəs/Submit adjective attempting to impress by affecting greater importance, talent, culture, etc., than is actually possessed.
Yep. That's what the word means. I didn't question whether or not you knew the definition of the word.
Still, I wonder what it was about my post that struck you as pretentious. Through the years, I've been able to reduce the incidence of incidents like this by careful analysis of people's reasons for feeling the way they do. So, if you can spare a few seconds, I'd love to know...
@OutOfRam Thanks for the links to the tutorials! Helps a lot! :)
Answer by MaxGuernseyIII · Nov 13, 2017 at 04:48 AM
Hello, I’m not really sure what I should do to make a health script.
Okay.
I would like it so that it translates to a in game UI health bar too!
Ending that sentence with "too" implies you've already given us (at least) one requirement and this is an additional requirement. I don't know what the requirement you think you've already told us is, but I can talk about UI health bar thing a little.
There are multiple solutions to this. You can create a game object with a mask behavior and a sprite inside it that what the health bar would look like with 100% health, then use linear interpolation between a zero-width and the full width of the mask. You can use a progress bar UI control. You can use little pieces of pie to form a wheel and change the alpha for the most in-jeopardy piece.
All that said, I'm guessing your best bet is this one: Go to the asset store, look up "health bar" and drop a few dollars on an asset that lets you set up a health bar entirely through the game object editor.
This all presupposes that you already have the model built-out for the actual health of your player. As I'm writing this paragraph, I'm realizing that assumption may not be a valid one. If you don't know how to manage the health of the characters in your game, I would recommend you do some searches for tutorials and follow the one with an end result most like what you want to accomplish. Then you can ask more focused questions to get from there to where you really want to be.
Follow this Question
Related Questions
Need help to put together 2 scripts 0 Answers
How do I make a enter and exit car script? 0 Answers
Could someone translate these to c#? 1 Answer
Clash of clans networking. 1 Answer
How to change numbers in unity 1 Answer