O'Reilly logo

Unity 2D Game Development by Dave Calabrese

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Not missing the ground

What we are going to do now is make the player register whenever they have landed on a platform. To do this, we will work with colliders that allow us to be certain not only of when we land, but also what we land on.

Tip

We could have checks that verify whether the player is moving vertically or not, and then automatically set the landing state based on the vertical movement state. However, this has a number of drawbacks including being less flexible than the method described on the following pages, and if the player slows down enough in mid-air to not be moving for a moment, the game could actually register that they landed! So instead, we will work with colliders, which allow us to be certain of when we land and what we ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required