Creating a countdown timer
In this recipe, we will look at one possible way to create a countdown timer from 60 to 0 seconds that the player will see on-screen.
How to do it...
Begin by placing an AreaTrigger entity onto the map to use as the container for the Flow Graph.
In the RollupBar, click on the Entities button.
Under the Triggers section, select the AreaTrigger.
Right-click the newly placed AreaTrigger and create a new Flow Graph. Name the Flow Graph as
CountDownTimer
.With the Flow Graph open and the new AreaTrigger selected, add in the following nodes:
Game:LocalPlayer
HUD:DisplayDebugMessage
Misc:Start
Math:SetNumber
Math:Sub
Time:Timer
Math:Counter
Math:Equal
Set Time:Timer period=1.
Set Math:SetNumber in=60.
Set Math:Equal B=60.
Link the Flow Graph together as follows:
Game:LocalPlayer entityId out to HUD:DisplayDebugMessage Choose Entity in
Misc:Start output out to Math:SetNumber set in
Math:SetNumber out out to Math:Sub A in
Time:Timer out out to Math:Counter in in
Math:Counter...