Countdown timer: Creating one

1
  • 16 favourites

Stats

8,972 visits, 13,009 views

Translations

This tutorial hasn't been translated.

Tools

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Hey users! This is how to create countdown timers.

Creating User Interface

To start, add a "UI" layer. To make objects in this layer "float" set the properties scale rate and parallax to 0.

Adding a global variable

It is easy! Add a variable named Timer. Set value to any number (60 for me) and click the OK button.

Exception:Do not place 0.

Adding an object

To see the timer, add a text object and place it in the topmost layer.

Text must be set to Time.

Events: Adding event

To make it work, add en event.

Condition:

System>Every Tick

Actions:

System>Subtract from(Subtract dt from Timer)

Text>Set text(Set text to Timer)

Another condition:

System>Compare to variable(Timer=0)

Another action:

System>Restart layout

Testing

Run the game. Do you see it work?

  • 3 Comments

  • Order by
Want to leave a comment? Login or Register an account!
  • I followed the tutorial but when I do Every thik subtract 1 from Time it starts at 60 and then numbers with a comma appear ... 59.000005 can you help me?

  • I am attempting this on the free version. My event sheet looks like this ....

    Timer is static.

    Global Timer =45

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

    | Text | Set Text to Text.Timer

    | Text | Subtract 1 from Timer

    System | Timer = 0 | System | Restart layout

    This worked but only reset once. On the second countdown it kept going into negative numbers and didn't reset. Without the second Text subtract it wont work.

    I will make more attempts.

    • i had the same issue and i solved it as below:

      I add:

      + System: On start of layout -> Timer: Set text to Timer

      AND

      + System: Timer = 0 -> System: Reset global variables to default

      Also dont forget to destroy Timer Text at the end of the layout/level.