Count Down Timer for Game Lives

In my game, the player starts out with 5 lives.  Each time they loose a life, I save the time the life was lost and then I give them a new life 30 minutes from the time they lost the life.  I’m using os.time() method.

Now I want to display a count down timer next to the number of game lives that displays the minutes and seconds until the player receives their next life.  I’m not sure of a few of things.

  1. How do I display the timer counting down in minutes and seconds.

  2. How can I display the count down timer for the game life that is next in line to be replenished?  In other words if there is 15 minutes left until game life 5 is replaced and 25 minutes until game life 4 is replaced I want the time to show the 15 minutes left until game life 5 is replaced.

  3. Then when the time for game life 5 is 0, if there is timer on another life, I want the remaining time for that life to be displayed.  No timer if the player has 5 lives.

I’ve been reading so many great articles that I’m starting to boggle my brain…I’m in over load and what I’m reading just ain’t computing anymore. :wink:

I appreciate any and all assistance.

Thanks

Lori

you can display a timer by making a a variable that =  the time number, and then timer.performWithDelay that calls a function to prevent the time, you can do with something like this:

[lua]

local countdowntime = 30
local p = 1

local countdowntimeText = display.newText(countdowntime, display.contentCenterX ,170 ,nil ,60)

function preventTime()

countdowntime = countdowntime - p

end

timer.performWithDelay(1000, preventTime, 30)[/lua]

Thanks for responding.  I’ll give this a try.

Lori

you can display a timer by making a a variable that =  the time number, and then timer.performWithDelay that calls a function to prevent the time, you can do with something like this:

[lua]

local countdowntime = 30
local p = 1

local countdowntimeText = display.newText(countdowntime, display.contentCenterX ,170 ,nil ,60)

function preventTime()

countdowntime = countdowntime - p

end

timer.performWithDelay(1000, preventTime, 30)[/lua]

Thanks for responding.  I’ll give this a try.

Lori

Issue Resolved.  Thanks for the help - working fine now

Issue Resolved.  Thanks for the help - working fine now