Skip to end of metadata
Go to start of metadata

 

For this sample we will be looking at how we can create a countdown timer in order to limit a round and communicate the remaining time to the player. The concept is simple to understand in that we need to start at a set number and then subtract a single value each second. Some things we will have to manage are the counting and also the pausing of the number decremented when it hits the value of zero.

How to Make a Clock Ticking Down

You need to follow these below mentioned steps to test your animations in a scene:

  1. Add a Math:SetNumber node and setting the value to 99. This will be the length of our round.
  2. Add a Game:Start node at the beginning and then hook the number value out of SetNumber into the Show and Message slots of a Debug:DisplayMessage node.
  3. Jump into your level (Ctrl+G) and test to see that the value is printed on the top left of the screen.
  4. With the value now printed at 99 we will begin to add a countdown by first adding a Time:Timer node to update each frame (1) and a Math:Counter node in order to increment the count of a value.
  5. In order to connect the SetNumber and the Math:Counter we need to add a Math:Sub node and then subtract the SetNumber of 99 in the A slot and the Math:Counter subtracting in the B slot.
  6. Complete the checking to see if the counter has reached 0 by checking the Counter through a Math:Equal node set to 99 and it connecting to the Time:Timer Pause slot when the counter of 99 outputs true.
  7. The last step is simply connecting the output of the Math:Sub node into the DisplayMessage node in the Show and Message slots.

Step 1-2

 

 

Step 3

 

 

Step 4

 

 

Step 5

 

 

Step 6

 

 

Step 7

 

 

 

  • No labels