Quantcast
Channel: Questions in topic: "enemy"
Viewing all articles
Browse latest Browse all 1488

losing lives

$
0
0
I have made a code of when you enter the trigger of the enemy, you lose a heart. you have 3 hearts. when i get hit by the enemy, all my hearts go? WHY? #pragma strict var Lives : int = 3; var LivesToDie : int = 0; var Heart1 : GUITexture; var Heart2 : GUITexture; var Heart3 : GUITexture; var DieScene : String; function OnTriggerEnter(other: Collider){ Lives -= 1; if(Lives >= 2){ Heart1.enabled = false; } if(Lives >= 1){ Heart2.enabled = false; } if(Lives >= 0){ Heart3.enabled = false; yield WaitForSeconds(0.5); Application.LoadLevel(DieScene); } } PS: if its a really stupid error i'm only ten so thats probably why :/

Viewing all articles
Browse latest Browse all 1488

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>