How can I set a countdown timer for my game and also end the game when the time runs out. Please help.
There are timer actions and conditions. See Timers [GDevelop wiki]
You can find an example here at the bottom:
Hopefully this will help a little bit:
At the beginning of each scene, I start a scene timer called “Time”. I also have a variable called “Time” that you can set to whatever you want the timer to start at.
Then, there’s a condition that every time the timer gets to 1 second, an action subtracts 1 from the variable. To display the timer on the screen, I have a text object with the following action:
As seen above, another condition of when the variable gets to 0, then it sets off a whole bunch of actions to end the scene/game (the player dies, sounds, “game over” text appears, whatever you want).
Hope that’s enough to get you started!