Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //****** Donations are greatly appreciated. ******
- //****** You can donate directly to Jesse through paypal at jesse_etzler@yahoo.com ******
- var curHealth : int = 100;
- var maxHealth : int = 100;
- var healthtext : GUIText;
- function Start () {
- healthRegen();
- }
- function Update () {
- healthtext.text = curHealth + " / " + maxHealth;
- if(curHealth < 0 ) {
- curHealth = 0;
- }
- if(curHealth > 100) {
- curHealth = 100;
- }
- if(Input.GetKeyDown("e")) {
- curHealth -= 10;
- }
- }
- function healthRegen () {
- while(regenActive) {
- yield WaitForSeconds(0.5);
- if(curHealth < maxHealth) {
- curHealth++;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement