- Home /
Reset a timer?
I have a timer which counts down to 0 before an explosion happens. What im basically using it for is to keep the enemy on screen for a short amount of time and then get rid of them. I have this working but it only works once. Here is my code:
function BlowyUppyThing()
{
if( --BlowyUppyTimer == 0 )
{
CancelInvoke( "BlowyUppyThing" );
if ( BlowyUppyTimer == 0 )
{
Instantiate( explosion, transform.position, transform.rotation );
audio.Play();
var position = Vector3 (Random.Range(-6,6),Random.Range(-4,4),0);
RespawnDelay();
transform.position = position;
renderer.enabled = false;
}
}
}
But, as said before, i need some way to reset the timer so that it constantly works, rather than only working once.
Comment
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Score Help!!!! 2 Answers
Rotation help! 1 Answer
stop song and play song 0 Answers
i need help trying to build game 0 Answers