samedi 4 janvier 2020

is there a way to loop an if statement

im trying to make it so that if my character continues to touch a gameobject with a damage script the player continuesly gets damaged. instead of this result i only get damaged once when touching the gameobject. there are no error messages. ive tried to replace the if with a while loop and it ended up crashing my game. is there any way to loop a if statement preferably with a way to time it.

if (other.tag == "Player")
       {
           healthScript.healthPoints -= damage;

       }

this is the if statement im trying to loop.

Aucun commentaire:

Enregistrer un commentaire