- Home /
Question by
Silverriolu295 · Sep 07, 2015 at 03:46 AM ·
javascriptmultipleupdate function
Lifes draining multiple times.
So I'm trying to make the player's lives go down by one when he gets killed but it takes 3 lives instead of just one. Here is the code when the player gets killed
function Update () {
if(playerHealth <= 0 && !isDead) {
playerHealth = 0;
levelManager.RespawnPlayer();
lifeSystem.TakeLife();
isDead = true;
// player.GetComponent(PlayerMove).doDeathAnimation = true;
//player.GetComponent(Rigidbody2D).isKinematic = true;
}
//other code here
}
here is the function it calls to drain lives
function TakeLife() {
lifeCounter --;
print(lifeCounter);
}
Why is it taking lives multiple times!?
Comment
Your answer
Follow this Question
Related Questions
Is it possible to sort arrays based upon a previous sort? 2 Answers
An Array within array 2 Answers
Setting Scroll View Width GUILayout 1 Answer
Multiple conected bodies for joint? 0 Answers
Multiple Colliders Issue 3 Answers