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

Multiple sprites


Though sprites can consist of a single image, they generally require many. In traditional sprite animation, animation clips are obtained by displaying several images in a sequence, each representing a stage (or keyframe) of the complete animation. These groups of images in sequence are referred to as spritesheets and they are the building blocks of sprite animation.

In the following recipe, we show you how to set a Multiple Mode Sprite Texture to create a cycle that shows our 2D sprite walking.

Getting ready

You should have already imported both the sprites we provided during the previous lesson, so do it now if you haven't.

How to do it...

  1. Move to the Project panel and access the Sprites folder. Now select 2D_walk to access the image properties in the Inspector window.

  2. Set Texture Type to Sprite as we did before, but this time, set Sprite Mode to Multiple, as this sprite contains several steps of the walking cycle. You can refer to the following screenshot:

  3. To open the Sprite...