How to make a player lose if they don't reach specific areas quick enough?

Hello, I’m very new to coding and I primarily resort to watching YouTube tutorials step-by-step. The language that I use is C#, and I’m wondering how I would go about having a player die if they don’t reach specific areas in time. The game I’m attempting to make is where a 2D sprite walks down a street and hides from people frequently looking through their windows by being in the darkness between street lamps. Would anyone know how to go about doing this? Thanks.


I’ve attached a picture of the game so far, to possibly help visualize. I’m looking for the “safe zone” to be between the street lamps, where the light doesn’t reach.

Hello. as you are commencing, is normal you ask for this, but this is a very basic thing. You should be able to create your own script. I will give you some idea what you will need…

Find/Learn:

Collider - Trigger (for player detection)

Time.deltaTime (to make a timer)

Whith this 2 elements you should be able to do it.

Bye!