Advertisement
Guest User

health control

a guest
May 30th, 2011
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. var health1 : Texture2D;
  2. var health2 : Texture2D;
  3. var health3 : Texture2D;
  4. var bodyPart1 : Transform;
  5. var bodyPart2 : Transform;
  6.  
  7. static var LIVES = 3;
  8. static var HITS = 0;
  9.  
  10. function Update ()
  11. {
  12.  
  13. print("Lives: "+LIVES+" Hits: "+HITS); //lives: 3 hits: 0
  14. switch(LIVES)
  15.  
  16. {
  17. case 3:
  18. guiTexture.texture = health3;
  19. break;
  20.  
  21. case 2:
  22. guiTexture.texture = health2;
  23. break;
  24.  
  25. case 1:
  26. guiTexture.texture = health1;
  27. break;
  28.  
  29. case 0:
  30. //gameover script here
  31. break;
  32. }
  33.  
  34. switch(HITS)
  35. {
  36. case 1:
  37. bodyPart2.renderer.enabled=false;
  38. break;
  39.  
  40. case 2:
  41. bodyPart1.renderer.enabled=false;
  42. break;
  43.  
  44. case 3:
  45. LIVES -= 1;
  46. HITS = 0;
  47. MoveAround.dead = true;
  48. bodyPart2.renderer.enabled=true;
  49. bodyPart1.renderer.enabled=true;
  50. break;
  51.  
  52.  
  53. }
  54.  
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement