Skip to Main Content
Learning 2D Game Development with Unity®: A Hands-On Guide to Game Creation
book

Learning 2D Game Development with Unity®: A Hands-On Guide to Game Creation

by Matthew Johnson, James A. Henley
December 2014
Beginner content levelBeginner
384 pages
11h 15m
English
Addison-Wesley Professional
Content preview from Learning 2D Game Development with Unity®: A Hands-On Guide to Game Creation

Cleaning Up Player Death

At the moment, our death sequence is a bit buggy, but that’s about to change. Now that our camera is divorced from the Player GameObject, we can have a little bit of fun with our death sequence.

We’re going to keep the force effect, but we’ll have the player fall through the world instead of colliding with it afterward. We’ll also have the camera stop tracking the player during this. The force effect doesn’t make sense if the player falls into a pit, so we’ll address that as well.

Let’s make some adjustments to the PlayerIsDead() function of the PlayerStats script, as shown in Listing 11.8.

Listing 11.8 Changes to the PlayerStats Script

public bool isDead = false;private float deathTimeElapsed; ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Game Development with MonoGame: Build a 2D Game Using Your Own Reusable and Performant Game Engine

Game Development with MonoGame: Build a 2D Game Using Your Own Reusable and Performant Game Engine

Louis Salin, Rami Morrar
Game Development Projects with Unreal Engine

Game Development Projects with Unreal Engine

Hammad Fozi, Gonçalo Marques, David Pereira, Devin Sherry

Publisher Resources

ISBN: 9780133523416Purchase book