Timer Bar

Hi,

I’m looking to implement a graphical bar that ‘counts down’ the remaining time available and then takes the user to the ‘game_over’ function if time has ran out:









Any tips on how to do this efficiently? I guess I need a series of timers (one for each step of the bar, and one overriding timer) but just I’m just trying to plan the best way to do it.

Also, trying figuring out how to make the ‘timer bar’ look good - rather than just using a series of images that ‘animate’ this effect.

Thanks for any experiences shared,
Paul [import]uid: 26027 topic_id: 11156 reply_id: 311156[/import]

You could use one timer and either change the .xScale (depending on if the bar is a plain color or not, it wouldn’t look right if it were patterned or textured) or use a sprite.

I can’t think of a reason you’d need more than one timer although I could be confused; what was your reasoning in using more than one? (I might be missing something?)

Peach :slight_smile: [import]uid: 52491 topic_id: 11156 reply_id: 40501[/import]

Some really good ideas on the graphics for the timer bar. Thanks Peach!

This is what I’m trying to implement with the timer:
A) Screen 1: Show Screen 2 after three seconds
B) Screen 2: If user completes actions within 10 seconds then go back to screen 1. If 10 seconds elapse, then game over.

A) is easy, I just use performWithDelay(3000, screen2)

I can’t quite get B) yet. I guess I need to set a 10 second timer going and then cancel it if the action is complete. I also need to x.Scale the timer bar smoothly through the 10 seconds so the user can see ‘time running out’ from:

to

This is the bit I need some ideas for: How best to implement the 10 second timer and how to trigger the xScale smoothly decreasing son the bar (a few different timers?).

Thanks for any insight,
Paul

[import]uid: 26027 topic_id: 11156 reply_id: 40515[/import]