Summary

In this chapter we learned about Unity’s trigger system and how it allows us to react to the player’s actions during runtime. We used the information to create pit trigger volumes to catch falling players and a system of checkpoints through which we can respawn them.

A number of Prefabs and scripts were created to support a collectible system for the game, and we briefly discussed some vector math for dealing with distance and contact angles. We also learned how to instantiate Prefabs so that we can spawn collectibles and other objects during runtime.

Last, we added a tracking script to the player so that we can see the value of all coins collected. This script will be hooked into the GUI in Chapter 10, “Creating the Menus and Interface ...

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.