Invisible Timer

Hey,

I’ve been using unity for about a year now to make pretty basic 2D platformers and an interactive fiction game based on tutorials. An ios game I am currently designing involves an internal timer where the player taps to start a sprite animation and then taps again at a specific time to successfully complete the levels, if not a different ending will play out. I’d really appreciate any hints on how to achieve this because I really don’t know where to begin…

Just update a timer, stop it when the players is pressing a key and compare it to the target timer you want, with like a little range, for exemple :

void Update()
{
  timer += time.deltaTime;
  if(Input.GetKey(KeyCode.E)
  {
     float difference = Mathf.Abs(timer - targetTimer);
     if(difference < 0.2f)
        //win
     else
        //lose
  }
}
1 Like

This is super helpful! Thank you

1 Like