Increasing the enemy target goal

Our next goal is to take advantage of the data we can store in the save file to change the gameplay for the player as they progress. We will do this by extracting the current round from the save file and multiplying the number of enemies that need to be defeated in order to complete a round by a new multiplier variable we will create. This is shown in the following screenshot:

Begin by creating a new variable in the My Blueprint panel, and then rename it to RoundScaleMultiplier. Change its Variable Type to Integer, and then set the default value to a low number, such as 2. With a multiplier of 2, each round will add two more enemies that need to be defeated before the player can progress to the next round.

Now that we have a multiplier variable, we will multiply it with the current round information stored in the save file, and then use the result for TargetGoal. First, drag a wire from the Save Game to Slot node's output execution pin, and then attach it to a SET Target Goal node. Also, connect the output execution pin of the SET Save Game Instance node that ends the loading sequence to the same SET Target Goal node so that both the save object creation and save object loading branches end on the same node.

Next, drag a wire from one of the SET Save Game Instance nodes' output pins, and then attach it to a GET Current Round node. Attach the output pin of this node to an Integer * Integer node. Then, drag the RoundScaleMultipler variable onto the bottom input pin of the newly created Integer * Integer node. Finally, attach the output pin of this node to the input Target Goal pin of SET Target Goal. Even though these nodes are connected to our save system, scaling the target goal is a relatively independent Function that happens to trigger in the same Event. As such, select all four nodes that you just created and give them their own comment box in order to leave you with a reminder of their purpose.

The final step for establishing our game initialization logic is to reconnect the HUD creation and drawing nodes to the sequence we have just concluded. Connect the output execution pin of the SET Target Goal node to the Create HUD Widget node's input execution node, as seen in this screenshot:

We already have the initialization needed for the round-based system. Now, we need a transition screen to be shown between rounds.

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

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