- Home /
Problem ProgressBar with health + Time the poison
Hi, I have a problem with Progress Bar with health + Time the poison, Player get marker (gameobject) no poison and up health... and my code is error
var health : int = 100;
var healthTexture1 : Texture2D;
var healthTexture2 : Texture2D;
function OnGUI () {
GUI.DrawTexture(Rect(55,Screen.height - 55,100,5), healthTexture2);
var boor : int = health * hePoison;
GUI.BeginGroup(Rect(55,Screen.height - 55,boor,15));
GUI.DrawTexture(Rect(0,0,100,5), healthTexture1);
}
function Update(){
hePoison = Time.time * -0.01;
heMarker = Time.time * 0.15;
}
Hi, Sorry i long not type to comment, This Is bad my script, I idea... Player has 60 second to die, Player must move to marker (gameobject) here and give you up time, do you know? How not understand it type comment.
I have problem script, Script's can't up the bar, and time it 0.05 bar is 1 it's can't. My code:
var progress : float = 1;
var progressmin : float = 1;
var pos : Vector2 = new Vector2(20,40);
var size : Vector2 = new Vector2(60,20);
var progressBarEmpty : Texture2D;
var progressBarFull : Texture2D;
var Point : Transform;
var Player : Transform;
function OnGUI()
{
GUI.DrawTexture(Rect(125,Screen.height - 75,135,20), progressBarEmpty);
GUI.DrawTexture(Rect(125,Screen.height - 75,135 * progress * progressmin,20), progressBarFull);
}
function Update()
{
progress = (Mathf.Clamp( Time.time, 0, 1))* -0.05;
}
function Download()
{
Point.parent = Player.transform;
progressmin = (Mathf.Clamp( Time.time, 0, 1))* 1;
}
Answer by Berenger · Jun 17, 2012 at 06:34 PM
hePoison and heMarker are not declared. Plus, you need to call GUI.EndGroup at the end of your OnGUI, as you called GUI.BeginGroup before.
Could you rephrase your question ? Or post it in your own language, I'm sure someone can help with the translation.
Do it just only need one GUI.EndGroup?
GUI.DrawTexture(Rect(55,Screen.height - 55,100,5), healthTexture2); var boor : int = health * hePoison; GUI.BeginGroup(Rect(55,Screen.height - 55,boor,15)); GUI.DrawTexture(Rect(0,0,100,5), healthTexture1); GUI.EndGroup (); } And I need be ready to does work. $$anonymous$$ust be does work! Please.function OnGUI () {
Close enough.
function OnGUI () {
var lifePercentage : float = health / maxHealth;
GUI.BeginGroup(Rect(55,Screen.height - 55, lifePercentage * 100,15));
GUI.DrawTexture(Rect(0,0,100,5), healthTexture1);
GUI.EndGroup ();
}
Script hasn't poison... go down health, get point (gameobject) got up health with time. I need help!
Not increase, smaller with time in health, and Player move to point position get higher with time in health, Please help me!
Your answer
Follow this Question
Related Questions
How to add texture in onGUI() 0 Answers
Health Help D: 2 Answers
Far Cry 3 Health Bar System 2 Answers
Progress Bar 2 Answers
Enemy Health Bar 1 Answer