Book Image

Unity 2D Game Development Cookbook

By : Claudio Scolastici
Book Image

Unity 2D Game Development Cookbook

By: Claudio Scolastici

Overview of this book

<p>Unity is a powerful game development engine that provides rich functionalities to create 2D and 3D games.</p> <p>Unity 2D Game Development Cookbook is a practical guide to creating games with Unity. The book aims to serve the purpose of exploring problematic concepts in Unity for 2D game development, offering over 50 recipes that are easy to understand and to implement, thanks to the step-by-step explanations and the custom assets provided. The practical recipes provided in the book show clearly and concisely how to do things right in Unity. By the end of this book, you'll be near "experts" when dealing with Unity. You will also understand how to resolve issues and be able to comfortably offer solutions for 2D game development.</p>
Table of Contents (15 chapters)
Unity 2D Game Development Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Preparing the character sprites


In this recipe, we will see how the individual sprites belonging to a character are prepared for keyframe animation.

Getting ready

We are going to create an entirely new character for this recipe, so start by creating a new scene in your Unity project.

Next, import the keyframe_anim PNG image we have provided with the contents of this book to the Sprites folder located in Assets. We've done this many times so far. The image contains the blocks to actually build up two characters, an orc and a knight. We will use the knight for this recipe, and once you have learned the process, you can make the orc or even mix the two characters to get something original!

How to do it...

  1. Select the PNG image you just imported. Then set Texture Type to Sprite and Sprite Mode to Multiple in the Inspector window, as shown in the following screenshot:

  2. Click on the Sprite Editor button to open Sprite Editor.

  3. Use the Slice menu, which is set to Automatic, to slice the image into its individual...