Game Development Reference
In-Depth Information
With this connection, perform the next step if the player has swiped over the current blue-
print (which must have a collider and physics) with one finger. Then, you can add
Cus-
tom Event
and call it
Process Chopping
, and connect its call to
OnInputTouchEnter
and that emulates a successful swipe.
After calling
Process Chopping
, it is time to add to the score. If you haven't made a
fruit-
sGame
blueprint yet, go ahead and build an empty one with an empty
Custom Event
called
Add Score
, so that you can manage its call. Alternatively, you can add this part
later when you finish adding the
fruitsGame
blueprint. There are so many ways to com-
municate between blueprints, and those ways are used according to the blueprint types.
And as we are going to communicate between two normal blueprints that are based on the
actor's class, the best way to do this is by searching and casting.
1. First, let's add a new variable of the type
fruitsGame_C
, which is the
fruit-
sGame
blueprint you have already made and left almost empty. Name it
fruit-
sGameManager
.
2. Then, you can use the
Get All Actors Of Class
node to look for all of the avail-
able actors of the selected
Actor Class
in the current level. Then, do a small
ForEachLoop
between them, and finally, run
Cast To fruitsGame
and apply the
found one into the
fruitsGameManager
variable you created earlier.
3. Finally, call the
AddScore
function from the
fruitsGameManager
variable
(which is the blueprint we found while using
Get All Actors Of Class
).
Search WWH ::
Custom Search