Advertisement
kasru

Xp and Leveling

Jan 15th, 2013
4,687
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  https://www.paypal.me/JEtzler   ******
  3.  
  4. var curXp : int = 0;
  5. var maxXp : int = 500;
  6. var xptext : GUIText;
  7. var level : int = 1;
  8.  
  9. function Update () {
  10.  
  11.     xptext.text = "Level " + level + " XP " + curXp + " / " + maxXp;
  12.     if(curXp == maxXp) {
  13.         levelUpSystem();
  14.     }
  15.  
  16.     if(Input.GetKeyDown("r")) {
  17.         curXp += 10;
  18.     }
  19. }
  20.  
  21.  
  22. function levelUpSystem () {
  23.  
  24.     curXp = 0;
  25.     maxXp = maxXp + 50;
  26.     level++;
  27.     maxHealth += 100;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement