Exercises

1. Finish up the Scene, adding elements such as grass, clouds, and props. Remember to set the position with the Snap Settings tool, and set the priorities for the sprites.

2. Set the Sorting Layers in the master Prefabs themselves in the _prefabs folder. This will ensure that all instances we add to our Scene carry them over.

3. Let’s add some simple collision for our ground GameObjects. Select grassMid and grassCliffRight in the _prefabs folder.

4. In the Inspector, click the Add Component button and select Physics 2D > Box Collider. This will add a Collider Component for our ground sprites that our Player GameObject will then be able to interact with.

5. The colliders are added, but centered to the pivot of our GameObjects. We need ...

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.