9. Creating Hazards and Crafting Difficulty

We’ve been building this game one piece at a time, carefully fitting pieces together and building it up as we go. We understand how the player moves, and we’ve used Unity’s trigger system to implement several backbone elements of the game. With this knowledge under our belt, we can now focus on expanding our game with some new elements in the form of hazards. We can then use these hazards as building blocks to craft challenging scenarios through which the player must navigate.

In this chapter we will create our first enemy and discuss a way in which to deal damage to the player. We’ll create a system for placing moving platforms and then expand on that system to create a flying enemy type. Finally, ...

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.