Creating a transition screen to be shown between rounds

Currently, when the player defeats enough enemies to meet the requirements displayed by TargetGoal, they are presented with WinMenu. It congratulates them and offers them the opportunity to restart the game or quit the application. Now that we are adopting round-based gameplay, we want to replace this WinMenu screen with a transition screen that will bring the player into the next round of gameplay.

We will start by making substantial modifications to our WinMenu Blueprint Widget. Go to Content Browser and open the UI folder. Rename the WinMenu Blueprint to RoundTransition so that it more accurately reflects its new purpose. Now, open the RoundTransition Blueprint.

First, go to the Hierarchy panel and select the Quit button object. Delete this button, as we will not need to present an option to quit during the round transitions. Next, click on the Restart button object and rename it to Begin Round. Click on the Text object (nested underneath the button object) and in the Details panel, change the text from You Win! to Begin Round. Finally, move this button to the lower-middle part of the canvas.

After that, select and delete the You Win! text block object. From the Palette panel, search for and drag down a new Horizontal Box object. Name this box Round Display and check the Size To Content property. Back in the Palette panel, search for a Text object, and then drag two of them down to the Hierarchy panel, placing them both on top of the Round Display object we created.

Select the first of these Text objects, and then look at the Details panel. Change the Text field to Round, including the space. Also, change the font size to 150. Now, select the other Text object. Change its font size to 150 as well, and change its Text field to any two-digit number. Finally, select the Round Display parent object again, and then resize the box until both the round text and the two-digit number can be seen fully. Place this object above the Begin Round button on the canvas. The final result of this layout should resemble the following screenshot:

Now, we need to add behavior to this screen. Because the Begin Round button is merely a renamed version of the old Restart button, and we want the functionality of reloading the level to remain the same, we can leave this button alone. The additional binding behavior we need is to adjust the round number to match the round stored in the current save file. To start this process, click on the numbered text object, which is shown as 10 in the preceding screenshot, and then click on the Bind button next to the Text field in the Details panel. Next, click on the Create Binding option.

Our goal for this binding is to extract the current round from the saved game and show it on the screen in the form of text. The nodes used to accomplish this can be seen in the following screenshot:

The current round is accessible through the Save Game Instance variable attached to our player character, so we must first cast to that Blueprint to extract the save game information. Attach a Cast To FirstPersonCharacter node to the initial Get Text 0 node, and then connect the output execution pin of that node to Return Node that concludes this binding. Now, drag the Object input pin of the casting node out, and attach it to a Get Player Character node.

With the player character referenced, we drag a wire from the As First Person Character output pin and attach it to a GET Save Game Instance node. Then, we attach the output pin of this node to a GET Current Round node. With this information in hand, we can convert the data to text. If we attach the output pin of the GET Current Round node to the Return Value input pin of Return Node, then a To Text (Int) translation node will be created for us automatically. Compile and save the RoundTransition Blueprint to finish your work here.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset