‫Hey, welcome back.
‫We are ready to show our countdown time in the actual widget.
‫So far, we're only using print string nodes so that we know how much time is left.
‫But we need to actually set the text in the widget.
‫So we're going to show the countdown time in the widget in this video.
‫Now I'm back here in WP Start Game Widget and we saw that we added some text to this widget.
‫And there are a couple of things we need to change with this text widget so that we can edit the text
‫dynamically.
‫The first thing I'd like to do is with the text widget selected here.
‫Here in the details panel, there is a name for this text and it's set to a default name, which is
‫not very descriptive.
‫So I'd like to rename this and let's call this display text now right next to this text block, we can
‫see this checkbox that says is variable.
‫Now it's not checked.
‫And if we go back to the event graph section, we don't see this text widget as a variable here.
‫But if we go back to designer and check this text box is variable, then once we go back to the graph,
‫we'll see that display text is now visible in the variables section and we can click and drag off and
‫click get display text here and now we have access to this node, which means we can change the text.
‫Now I'd like to drag this down to Case three in our switch statement where we're printing the string.
‫Get ready to the screen now instead of using a print string, I'd like to set the text for our text
‫widget and I can do that by dragging off of its output pen and typing set text.
‫And here we see a set text in parentheses text node.
‫If I click that, then I get a set text node and here is an input called in text.
‫Now it takes an input value of type text, but we can also click the text box here and hard code the
‫value we'd like to set the text to.
‫So I'm going to type get ready.
‫And rather than using this print string, I'm going to remove that print string and drag the case three
‫execution wire into the input execution pin for the set text node.
‫Now if I compile and hit play, I'll see that it says Get ready, which is the same text that it was
‫before.
‫So it doesn't look any different, but we can prove that it is using the text in the set text node.
‫By changing this, I'll add a couple of exclamation points.
‫So there are three of them.
‫And now if I hit play, I see three exclamation points.
‫So this node is in fact setting the text for our text widget.
‫So I'm going to challenge you to set the text so that we can print a different message for each of the
‫cases in our switch statement for three, you can leave it at get ready for to print the text to to
‫the screen for one, print one and for zero.
‫I'd like you to print go now for the default case, which is when we've run out of time, just print
‫an empty string, which means you can leave that input text box blank.
‫So pause the video and remove those print strings and replace them with a set text node.
‫And don't forget to plug in the input to the set text node.
‫The value from our text widget.
‫Pause the video and do this now.
‫So I'd like to use this set text node and I'm going to highlight both of these nodes so they're both
‫selected and hit control.
‫D To copy that and I'm going to use the zero case.
‫I'm going to just hook it straight up to the set text node.
‫And rather than printing go with a print string, I'm going to print go by setting the text to go and
‫now I can remove this print string.
‫Now I need to set the text for cases one and two.
‫So I'm going to copy this set text node and hook up the one case and simply print one and remove that
‫print string.
‫Now, I'm going to move these nodes out of the way so that I can add another set text node and hook
‫up two to this one and use two as the text.
‫And I can remove that print string and finally I can replace the start game with an empty string.
‫So I'm going to hook up the default to another set text and simply use no text so that we're setting
‫the text to nothing.
‫Now I'm going to remove that print string, compile and play and there is the countdown timer and it
‫goes away as soon as the game starts.
‫So that's exactly what we were after.
‫Now, a couple of things.
‫One is I'm going to go back to the designer tab and scroll down with the text selected.
‫I'm going to scroll down to the appearance and you'll see that we have this justification and it's justified
‫to the left, which is why the two and one get printed slightly to the left.
‫But if I select a line text center now, if I hit play, I'll see that my text is aligned to the middle.
‫Now we can give our text a shadow.
‫Here we see shadow color.
‫We can select that and we can give the text its own shadow.
‫The alpha is set to zero, but if I drag it up to one now I have a shadow and now our text will have
‫a black shadow.
‫If I click play, then I can see that my text is a little bit more visible thanks to that shadow.
‫So this is great.
‫Let's go back into the Graph Tab and we now know that we're setting the text based on our countdown
‫time.
‫Now, this is all still happening, every single frame of the game since this is hooked up to the TIC
‫event.
‫But the truth is, we really don't need this widget to even exist after the 3 seconds are up.
‫If there were a way to get rid of this entire widget and remove it, that would be more ideal than simply
‫setting the text to an empty string.
‫So to do that, what we can do instead of setting the text is we can remove this widget from the viewport.
‫And to do that we use a node called remove from parent.
‫So creating a remove from parent node and deleting the set text node.
‫Then when we hit the default case, which is when that 3 seconds is up, then this node will result
‫in the widget being removed and none of this tick functionality will be happening anymore because the
‫widget will be gone.
‫So this takes care of removing the widget once the timer is up and the player is able to start playing
‫the game.
‫So we have now showed the countdown time in our widget, which means that it's very clear when the game
‫is starting and how much time has to pass before the player can start moving the tank around.
‫This is great.
‫So back to our section plan.
‫We see that we've created our tank that can move throughout the world and handle input.
‫We've created an enemy turret class called Tower in C++ and we've added fire functionality with projectiles.
‫We have health and damage as well as destruction in our game.
‫Now we still need to add special effects and we need to show when we win or lose the game using HUD
‫displays, we've now seen how to use HUD displays.
‫So this should be a relatively simple task.
‫So we're almost done with this game.
‫Congratulations.
‫I'll see you in the next video.