System Scripts

This section contains the final script, the Constants Script, which is used to store our constant values.

Listing A.22 The Constants Script

#pragma public class Constants{// PLAYER PREFSpublic var PREF_COINS : String = "Coins";public var PREF_CURRENT_LEVEL : String = "CurrentLevel";// SCENE NUMBERSpublic var SCENE_LEVEL_1 : int = 6;public var SCENE_LEVEL_2 : int = 2;public var SCENE_LEVEL_3 : int = 3;public var SCENE_GAME_OVER : int = 1;public var SCENE_GAME_WIN : int = 4;public var SCENE_TITLE : int = 5;// PLAYER MOVEMENT VALUESpublic var playerMaxSpeed : float = 7.0;public var playerJumpForce : float = 850.0;public var playerGroundCheckRadius : float = 0.2f;public var animSpeed : String = "Speed"; ...

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.