Hi I am very new to all this and have tried to solve most of my problems myself but I’m stuck on how to add in a 2nd condition to this Jscript.
I use 3 scripts.
I have an add time script which adds +10 seconds of time on an item pickup to two other scripts one counts down to 0 and restarts the level and one plays a audio file at 0 seconds but the countdown is 7 so the audio plays with 3 seconds of the level time left.
I want to add a condition into the audio script so the sound is stopped if the timer goes back above 0 (3 seconds level time)
I originally had 1 timer script but again got stuck on how the ‘if’ conditions worked. This solved one problem but created another.
Thanks in advance.
#pragma strict
var countdown : AudioClip;
var timer2 : float = 7.0;
function Update()
{
timer2 -= Time.deltaTime;
if(timer2 <= 0)
{
timer2 = 0;
AudioSource.PlayClipAtPoint(countdown, transform.position);
Destroy(gameObject);
}
}