View difference between Paste ID: VfQsRHce and dZNfzYDy
SHOW: | | - or go back to the newest paste.
1
//****** Donations are greatly appreciated.  ******
2-
//****** You can donate directly to Jesse through paypal at  https://www.paypal.me/JEtzler   ******
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
}