- Home /
Damage script
This is my health script, how would I apply damage and shorten it?
@script ExecuteInEditMode()
function Awake () {
var health = 100;
var currHealth = 100;
var maxHealth = 100;
health = currHealth/maxHealth;
var healthTexture : Texture2D;
var healthBorder : Texture2D;
// At first we draw border/background texture (with current texture it isn't important) GUI.DrawTexture(Rect(43,Screen.height - 65,314,36), healthBorder);
//Now on top we can put Health Bar texture var adjust : int=currHealth*3; //adjusting texture size (width) / health(100) GUI.BeginGroup(Rect(55,Screen.height - 55,adjust,15)); GUI.DrawTexture(Rect(0,0,health,15), healthTexture); GUI.EndGroup(); }
Comment
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Health Question 1 Answer
Damage/Healing over time 1 Answer