Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. var hearfive : Texture2D;
  2. var hearfour : Texture2D;
  3. var heartre : Texture2D;
  4. var heartwo : Texture2D;
  5. var hearone : Texture2D;
  6. var health : float = 5;
  7.  
  8. function Update() {
  9. if(Input.GetButtonUp("Jump")) {
  10. health -= 1;
  11. }
  12. if (health >= 5) {
  13. guiTexture.texture = hearfive;
  14. }
  15. if (health >= 4) {
  16. guiTexture.texture = hearfour;
  17. }
  18. if (health >= 3) {
  19. guiTexture.texture = heartre;
  20. }
  21. if (health >= 2) {
  22. guiTexture.texture = heartwo;
  23. }
  24. if (health >= 1) {
  25. guiTexture.texture = hearone;
  26. }
  27. }
  28.  
  29. function OnMouseDown(){
  30. Debug.Log("clicked");
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement