Countdown timer bar...

0 favourites
  • 5 posts
From the Asset Store
Tabata timer
$9.99 USD
Template for Tabata timer, fully documented in comments and video
  • I've implemented a timer on my game - just a simple:

    System > Every 1.0 seconds > System > Subtract 1 from Timer

    The timer doesn't start from a fixed time though, I also have events where 5 or 10 seconds are added each round. It all works fine, but I want to replace the countdown text with a bar that decreases in length.

    So each round I'm guessing I have to set the start length of the Timer Bar (1400 pxls) to equal the current start Timer value (whatever it may be) and the end length (0 pxls) to equal the lowest Timer value (0 seconds) and on each tick tween the length of the timer bar.

    In the layout I've given the Timer Bar two variables - one called Full with a value of 100 and one called Empty with a value of 0. Is this the right way to go or is there a way in the events sheet where I can simply tween the length or width from Timer (full time) to Timer 0?

  • You could do:

    timerBar.Width = timer*k

    where k = timerBar.maxWidth/timerStart

    k is a constant and can be calculated once at the start of the layout/round (assuming you're not changing the maximum bar width and the initial timer value on the fly).

  • You could do:

    timerBar.Width = timer*k

    where k = timerBar.maxWidth/timerStart

    k is a constant and can be calculated once at the start of the layout/round (assuming you're not changing the maximum bar width and the initial timer value on the fly).

    Can you expand on this? Not sure what you mean.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Bootfit: something like this:

    https://www.dropbox.com/s/hjg2pc3mnrq1h ... r.c3p?dl=0

    I've included two methods for representing the timer bar:

    1) The red bar's starting length is determined by unitWidthR x timerDuration, i.e. more time = longer bar.

    2) The blue bar's starting length is determined by widthMaxB regardless of timerDuration; instead it changes the rate at which it shrinks, i.e. more time = slower bar. This is useful if you have limited room for the bar or want to maintain sizes and positions of your HUD objects.

    timerDuration = how long you want the timer to run for

    unitWidthR = width of bar per second (only applies to the red bar)

    widthMax = standard length of bar (only applies to blue bar)

    unitwidthB = derived from widthMaxB/timerDuration (only applies to blue bar)

    You can fiddle around with these values to get an idea of how each bar is working.

    Hope that helps <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

  • Absolutley brilliant - thank you.

    The blue bar was exactly what I needed. Dropping the values from my project into it made it make sense.

    Thank you 😀

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)