- Home /
dragable GUI
How would I make this into a dragable window? its a health icon and health score
 var curHealth : int = 100;
 var mySkin : GUISkin;
 
 var t0 : Texture2D;
 var t1 : Texture2D;
 var t2 : Texture2D;
 var t3 : Texture2D;
 var t4 : Texture2D;
 var t5 : Texture2D;
 
 function OnGUI(){
      GUI.skin = mySkin;
     GUI.Box (Rect (10,10,80,100), curHealth.ToString() + " ");
     GUI.DrawTexture(Rect(20,40,60,60),t0);
 }
  
 function Update ()
 {
      if(Input.GetKeyDown(KeyCode.E)) {
          curHealth -= 10;
      }
      
     if(curHealth < 0) {
         curHealth = 0;
     }
     
     if(curHealth > 100) {
          curHealth = 100;
      }
          
      if(curHealth < 1) {
          Application.LoadLevel(0);
      }
          
      //Health Icon Stuff
      if(curHealth <100 && curHealth >79) {
         t0 = t1;
      }
      
       if(curHealth <80 && curHealth >59) {
         t0 = t2;
      }
      
       if(curHealth <60 && curHealth >39) {
         t0 = t3;
      }
      
       if(curHealth <40 && curHealth >19) {
         t0 = t4;
      }
      
      if(curHealth <20 && curHealth >0) {
         t0 = t5;
      }
 }
               Comment
              
 
               
              Your answer
 
 
             Follow this Question
Related Questions
Health bar by percentage? (not drawing a box) 4 Answers
The Game Over creating with audio? 1 Answer
Health system 2d 2 Answers
How do I make a custom health bar? 0 Answers
OnGui Function help 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                