Adding Behaviors for the Barrel Actor
The Barrel actor should act like a powder keg and explode when it collides with the Skeleton actor. To do this, first we need to add the shortcut to add a gravity motion behavior, just like we did with the Skeleton and Security actors. Next, we want to add a disappear behavior based on a collision event to make any Skeleton actors that fall on the barrel disappear.
Adding the Gravity Shortcut for the Barrel Actor
As we did previously, select the shortcut "run and jump by pressing keys (side view)" and delete all of the newly added behaviors except for Gravity and DisappearOnSceneLeave, as shown in Figure 2-60. This will make the barrel fall automatically using gravity from the platform upon which they've been placed (as previously shown in Figure 2-22).

Figure 2-60. Deleting all but the Gravity and default disappear behaviors for the Barrel actor
Adding the Disappear Behavior
Like we've done before, add a new disappear behavior and set the behavior's collision event to be between "Myself (the current instance of Barrel)" and the Skeleton actor. Keep the default of all sides for the collision checked so that the default event is as shown in Figure 2-61.

Figure 2-61. Setting the disappear behavior event for the Barrel
Next, we need to define which actors ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access