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 the Camera

At the moment, our camera follows the player’s movements perfectly. Every small movement is reflected in the camera’s position, and that feels a bit harsh. To create a smoother feel, we’re going to provide a bounding box within which the camera won’t react to the player’s movement.

Fortunately for us, Unity actually has just such a script available as part of one of their Project downloads. We’re going to make use of that one here:

1. Select the Main Camera GameObject.

2. Click the Add Component button and choose New Script.

3. Name the script “CameraFollow” and ensure that the language is set to CSharp.

4. In the Project Browser, select the newly created script and move it to the _scripts folder.

5. Double-click the script ...

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