I'm making a game that uses a countdown. I have the countdown working but I want to change the countdown based on the room the player is in. For example, in the first room, the countdown is 60 seconds, in the next room the timer is 30 seconds.
I'm not sure how to set this variable in my current setup, I've tried to create a custom event but then the timer decreases too fast. Any help is appreciated.
Here's the timer code so far
on load do
restore
// clock
startTime = datetime.timestamp
// score
score = 0
// player orientation
jumped = 0
ground = 0
end
// does not work because loop occurs at each frame. Happens too fast.
// on loop do
// clock--
// if clock == 0 then
// fin "game over"
// end
// end
// timer loop
on loop do
// Get The Current Time
currentTime = datetime.timestamp
// Set the Clock Time
clock = 60
// Calculate how much time has passed since the game started
elapsedTime = currentTime
elapsedTime -= startTime
clock -= elapsedTime
// Finish Game when time ends
if clock==-1 then
fin "Game Over! Score: {score}"
end
// If more than 60sec have passed, increase the minute counter
// And reset the seconds counter to 0
end