sexta-feira, 13 de maio de 2016

BP Compendium 2: Arrays


The use of Arrays allows grouping of variables of the same type. Creating an Array in Blueprints is very simple. Create a new variable and select the desired type. Beside the type of the variable there is an icon that must be clicked to make the variable an Array. After compiling the Blueprint it is possible to add in the Array elements with default values, as in the images below:

In this example was created the Array "LevelsBonus" that keeps the extra scores that the player will receive when completing the levels. Each element of the Array represents a level. Note that the first element of an Array has the index zero.

The actions below show how to add the extra score on the player's score. The integer variable "CurrentLevel" represents the current level of the game and is used as the Array index to get the extra score equivalent to the current level.

Click to enlarge

The main actions related to an Array are:

  • Get: Returns the element that is in the position specified by the index used.
  • Length: Returns the number of Array elements.
  • Add: Add a new element at the end of the Array.
  • Insert: Inserts a new element at the position specified by the index used.

Click to enlarge

Table of Contents