Advertisement
Guest User

Untitled

a guest
Aug 1st, 2015
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //****** Donations are greatly appreciated.  ******
  2. //****** You can donate directly to Jesse through paypal at  jesse_etzler@yahoo.com   ******
  3.  
  4. var curHealth : int = 100;
  5. var maxHealth : int = 100;
  6. var healthtext : GUIText;
  7.  
  8. function Start () {
  9.     healthRegen();
  10. }
  11.  
  12. function Update () {
  13.  
  14.     healthtext.text = curHealth + " / " + maxHealth;
  15.  
  16.     if(curHealth < 0 ) {
  17.         curHealth = 0;
  18.     }
  19.  
  20.     if(curHealth > 100) {
  21.         curHealth = 100;
  22.     }
  23.  
  24.     if(Input.GetKeyDown("e")) {
  25.         curHealth -= 10;
  26.     }
  27. }
  28.  
  29. function healthRegen () {
  30.  
  31.     while(regenActive) {
  32.         yield WaitForSeconds(0.5);
  33.  
  34.         if(curHealth < maxHealth) {
  35.             curHealth++;
  36.         }
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement