Ok, my second thread… I will delete the other. I have a Exp bar that is cord(158,653,ExpBarLength(= 470),20). Ok? When i get Exp it adds to variable curExp; So i want this Exp bar to follow the curExp til 100% when i get exp. code:
public var curExp : int = 1;
public var curLevel : int = 1;
public var ExpToLevel = 100;
public var ExpPerLevel : int = 1;
public var ExpBarLength = 470;
public var ExpBarMaxLength = 470;
public var curExp2 : int = 50;
var expTexture : Texture;
curExp2 = curExp * 4.7;
ExpBarLength = ExpBarMaxLength * curExp;
ExpPerLevel = ExpPerLevel * curLevel;
function OnGUI () {
(GUI.DrawTexture(Rect(158,653,ExpBarLength,15), expTexture));
(GUI.Box(Rect(100, 120, 50, 25), "lvl " + curLevel));
if (curExp > ExpToLevel) {
curExp = 0;
curLevel = curLevel + 1;
ExpBarLength = 1;
}
if(ExpBarLength > ExpBarMaxLength)
ExpBarLength = 0;
}
So when i lvl up(curLevel) i need more exp to get to the next level(can fix that by
if (curExp > ExpToLevel) {
curExp = 0;
curLevel = curLevel + 1;
ExpBarLength = 1;
ExpToLevel += 50;
}
But I cant make the ExpBar go no further than ExpBarMaxLength;(what i mean is that when i lvl up and need more exp to lvl up, the expbar goes out of the screen.)
Nice if u help me with small code or tutorial
Thanks