To make a water balloon, let’s start by making a duplicate of the PlayOnGrab script. We will name it WaterBalloon, which will splash when it hits a player.
PLAY SOUND ON GRAB precedes this tutorial
Bring over the When Colliding With Player event and drag the Play Sound Codeblock to the new event. We can then delete the old Event. We have a splash sound, now we should add a visual effect. You can find Play Visual Effect on the Actions tab, and we will also need to create another object variable called VisualEffect. Drag the VisualEffect pill over. Congrats, our script is done.
Let’s group our water balloon, sound effect, and visual effect together. Make sure to leave the property panels open on the effects. Now we can attach the WaterBalloon script and reference the effects.
Because we want the object to collide with players, we need to go to the More tab and change the Collision Event from Nothing to Players. Now when we throw the water balloon at our friends, it splashes and plays a sound effect.
In the last part of this series we are going to take these water balloons to the next level.