You are previewing Unity 5.x 2D Game Development Blueprints.
O'Reilly logo
Unity 5.x 2D Game Development Blueprints

Book Description

Explore the features of Unity 5 for 2D game development by building three amazing game projects

About This Book

  • Explore the 2D architecture of Unity 5, and the tools and techniques for developing 2D games

  • Discover how to use Unity’s 2D tools, including Sprites, physics, and maps, to create different genres of games

  • Practical tutorial on the intermediate and advanced development concepts in Unity 5 to create three interesting and fully functional games

  • Who This Book Is For

    If you've got the basics of 2D development down, push your skills with the projects in this hands-on guide.Diversify your portfolio and learn the skills needed to build a range of awesome 2D game genres.

    What You Will Learn

  • Explore and understand the vital role of sprites in 2D games

  • Move, animate, and integrate sprites into a 2D platform game

  • Set up User Interfaces (UIs) to keep track of the progress through the games

  • Apply 2D Physics to improve gameplay believability

  • Learn the foundation of Level Design and how to quickly create 2D Maps

  • Discover NPC design, event triggers, and AI programming

  • Create an epic strategy game, challenging all the skills acquired in the book

  • In Detail

    Flexible, powerful, and full of rich features, Unity 5 is the engine of choice for AAA 2D and 3D game development. With comprehensive support for over 20 different platforms, Unity boasts a host of great new functions for making 2D games. Learn how to leverage these new options into awesome 2D games by building three complete game projects with the Unity game tutorials in this hands-on book.

    Get started with a quick overview of the principle concepts and techniques needed for making 2D games with Unity, then dive straight in to practical development.

    Build your own version of Super Mario Brothers as you learn how to animate sprites, work with physics, and construct brilliant UIs in order to create a platformer game. Go on a quest to create a RPG game discovering NPC design, event triggers, and AI programming.

    Finally, put your skills to the test against a real challenge - designing and constructing a complex strategy game that will draw on and develop all your previously learned skills.

    Style and approach

    This is a practical and easy-to-follow guide that starts with the basics and gradually delves into the process of creating 2D games. With step-by-step instructions on how to build three games, followed by a detailed explanation of each example, you will understand the concepts not just in theory, but also by applying the knowledge you gain in practice.

    Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at If you purchased this book elsewhere, you can visit and register to have the code file.

    Table of Contents

    1. Unity 5.x 2D Game Development Blueprints
      1. Unity 5.x 2D Game Development Blueprints
      2. Credits
      3. About the Authors
      4. About the Reviewers
        1. Why subscribe?
        2. Free access for Packt account holders
      6. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Downloading the color images of this book
          3. Errata
          4. Piracy
          5. Questions
      7. 1. Sprites
        1. 2D mode
        2. Custom packages
        3. Dealing with sprites
          1. Importing sprites
          2. The Sprite Renderer component
          3. The Sprite Editor
        4. Our character makes its first steps
        5. Summary
      8. 2. Animations
        1. Animating sprites
          1. Automatic clip creation
          2. Manual clip creation
        2. The Animator
        3. The game
        4. Summary
      9. 3. Physics
        1. 2D physics
          1. Rigid bodies
          2. Colliders 2D
            1. Box Collider 2D
        2. Letting the character move
          1. Adjusting the Platformer 2D controller
          2. Defining a physical shape for the character
          3. Improving the Animator
            1. Testing the character movement
        3. Building a cool level
        4. Summary
      10. 4. Level Design
        1. Tiled for 2D level design
        2. Approaching UI
        3. Game handler
        4. Adding enemies
        5. Summary
      11. 5. Creating Our Own RPG
        1. Role-Playing Games
        2. Getting ready
        3. Importing the level
        4. Slicing the sprites for our hero
        5. Creating our hero
        6. Dressing up our hero
        7. Giving the power of movement to our hero
        8. Animating the hero
        9. Summary
      12. 6. AI and Pathfinding
        1. Pathfinding
        2. AStar Algorithm in Unity
          1. A tool for Unity
          2. Setting up the tool
        3. Using pathfinding for enemies
          1. Shaping our soldier
          2. Giving intelligence to the soldier
          3. Final notes
        4. Summary
      13. 7. Tower Defense Basics
        1. Tower Defense games
        2. Getting ready
        3. Setting up the scene and creating the map
        4. Bullets
          1. Creating the bullet prefab
          2. Scripting the bullet
        5. Towers
          1. Creating the tower prefab
          2. Scripting the towers
        6. Enemies
          1. Creating the enemy prefab
          2. Scripting the enemies
            1. Moving along the designed path
            2. Detecting towers' bullets
        7. Summary
      14. 8. User Interface for the Tower Defense Game
        1. Getting ready
        2. Designing the UI
        3. Creating a lives counter
          1. Creating and placing the lives counter
          2. Scripting the lives counter
        4. Implementing a money system
          1. Creating and placing the money counter
          2. Scripting the money counter
        5. The tower seller
          1. Creating and placing the tower seller
          2. Scripting the tower seller
          3. Finishing the tower seller
        6. Upgrading the towers
          1. How it works
          2. Creating and placing the tower menu
          3. Scripting the tower menu
          4. Finalizing the tower menu
        7. Summary
      15. 9. Finishing the Tower Defense Game
        1. Getting ready
        2. Waypoints for enemies
          1. Getting the waypoint coordinates
          2. Implementing waypoints in the Game Manager
          3. Passing waypoints to the enemies
        3. Integrating the UI into the game
          1. Integrating the Lives Counter
          2. Integrating the Money Counter
        4. Placing the towers
          1. Allowed areas
          2. Scripting the placement script
          3. Final tweaking of the Tower prefab
        5. Creating an enemy spawner
        6. Finishing the gameplay
          1. Winning conditions
          2. Losing conditions
        7. Upgrading towers
          1. Finishing the TowerScript
          2. Final adjustments to the TowerMenuScript
        8. Practice makes perfect
        9. Summary
        10. Goodbye