O'Reilly logo

Learning 2D Game Development with Unity®: A Hands-On Guide to Game Creation by James A. Henley, Matthew Johnson

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

Player Scripts

This section contains the final scripts that are used to control the player’s movement along with tracking health, coins, and similar values. You’ll find the following scripts here:

Image Listing A.1: The PlayerController Script

Image Listing A.2: The PlayerStats Script

Listing A.1 The PlayerController Script

#pragma strictprivate var Constants : Constants = new Constants();@HideInInspectorpublic var isFacingRight : boolean = true;@HideInInspectorpublic var isGrounded : boolean = false;@HideInInspectorpublic var ...

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