Hey there guys, ive gotten alot of help previously from these forums and i appreciate it greatly!
heres my question.
How can i make a “countdown” from a trigger?
i want to make a “speed boost” pickup, so i basically just made this for my trigger
function OnTriggerEnter (col : Collider)
{
var controller : FPSWalker = col.GetComponent(FPSWalker);
controller.speed = 350;
}
@script RequireComponent(BoxCollider)
and then i threw this in my FPSWalker script
while (speed >30){
timeLeft = timeLeft - Time.deltaTime;
if (timeLeft <= 0.0)
{
speed = 30;
} }
is there a way to start the timer from when the trigger is triggered? at the moment it is just subtracting the time since the level started from my variable “timeLeft”
(i found this script on the forums somewhere, credits don’t go to me, thank you Idle_chris and Hogus)
thank you!