Preparing the Pit Trigger Volume
We’ll create our base pit trigger in much the same way that we created our base checkpoint trigger, albeit with a different script since we probably don’t want to checkpoint the player as they plummet to their doom:
1. Create an empty GameObject and name it “Pit.”
2. Select a recognizable icon, such as a red circle, to make it easier to find again in the future.
3. Click Add Component and choose Physics 2D > Box Collider 2D.
4. Click the “Is Trigger” property to set it to true.
5. Drag the Pit GameObject under a Scene containing a pit in the Hierarchy.
6. Adjust the size and position of the Box Collider 2D so that it’s under the pit in a fashion similar to that shown in Figure 8.2.
Get Learning 2D Game Development with Unity®: A Hands-On Guide to Game Creation now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.