Unity 2017 2D Game Development Projects

Book description

Build classic arcade, shooter and platform games with Unity 2D toolset

About This Book

  • Leverage the amazing new functionalities of the latest Unity 2017 2D toolkit.
  • Learn to create 2D characters, animations, fast and efficient game play experiences while keeping your games very lightweight
  • Create engaging games that enable you to perform intergalactic warfare and also fun games similar to temple run and so on.

Who This Book Is For

If you are interested in creating your very own 2D games from scratch, then this book will give you all the tools you need to succeed. No C# knowledge is required, all you need is basic coding and scripting knowledge. Whether you are completely new to Unity or have used Unity before and would like to learn about the new 2D features of Unity, this book is for you.

What You Will Learn

  • Work with Unity 2017's new 2D workflow and create a 2D scene
  • Set the scene with different types of backgrounds, either static or dynamically using a tileset
  • Bring your character to life through simple animations
  • Understand the core concepts of programming by creating basic code that controls a character and destroys an enemy
  • Create buttons and game controls by using code snippets for input detection
  • Develop three 2D games from genres such as classic arcade, space shooter, and platformer games
  • Add audio and feedback and deploy your games

In Detail

2D games are everywhere! Timeless and popular, 2D games represent a substantial segment of the games market. The Unity engine has revolutionized the gaming industry, by making it easier for game developers to create quality games on a budget. If you are looking for a guide to create 2D games using Unity 2017, look no further. With this book, you will learn all the essentials of 2D game development by creating three epic games in a step-by-step manner throughout the course of this book.

The first game will have you collecting as many cakes as possible. The second will transport you to outer space to traverse as far as possible while avoiding enemy spaceships. The last game will have you running and jumping across platforms to collect coins and other exotic items.

Throughout all these three games, you will create characters, make them move, and create some enemies. And then, of course, write code to destroy them!. After showing you the necessities of creating a game, this book will then help you to porting the game to a mobile platform, and provide a path to publish it on the stores.

By the end of this book, you will not only have created three complete great games, but be able to apply your knowledge to create and deploy your own games.

Style and approach

Build three great games from scratch, and learn all about Unity 2017's 2D toolset

Publisher resources

Download Example Code

Table of contents

  1. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Download the color images
      3. Conventions used
    4. Get in touch
      1. Reviews
  2. Press Start
    1. Atoms of games
    2. Different approaches to games
    3. The game design process
      1. Workflow
        1. Concept development
        2. Design and prototyping
        3. Implementation
        4. Testing
        5. Iteration
        6. Finalizing
      2. A-Team
    4. Developing 2D games
      1. X, Y, and Z-axis
        1. Full 3D
        2. Orthographic (3D)
        3. 2D with 3D graphics, also known as 2.5D
        4. Full 2D
        5. 2D with a perspective camera
    5. The Unity Engine
      1. Downloading Unity
    6. An overview of built-in features in Unity
      1. Creating a new 2D project in Unity
      2. A brief overview of the Unity User Interface (UI)
      3. The main components of the UI in Unity
        1. Hierarchy Window
        2. Scene View
        3. Game View
        4. Inspector window
        5. Console window
        6. Project Window
      4. Customizing the workspace
        1. Hotkeys to keep in mind
      5. Asset Workflow
        1. Primitive and placeholder objects
        2. Images
        3. 3D model files
        4. Meshes and animations
        5. Audio files
      6. Naming conventions for assets (and in general)
      7. Importing into Unity
      8. Special folders
        1. Assets
        2. Editor
        3. Editor default resources
        4. Plugins
        5. Gizmos
        6. Standard Assets
        7. StreamingAssets folder
        8. Resources
        9. Hidden Assets
    7. Preparing for the projects in this book
      1. Project 1 - Angel Cakes
      2. Project 2 - intergalactic shooter: Quark
      3. Project 3 - RETROformer
    8. Summary
  3. Working with Assets
    1. An overview of collecting games
      1. Key features of collecting in games and things to keep in mind
      2. What will you learn in the remainder of this chapter?
    2. Textures and Sprites
    3. Sprite Render
    4. Sprite Editor
      1. How to use the Sprite Editor
    5. Sprite Packer
    6. Sprite Creator is your friend when you have no assets
    7. Setting up the Angel Cakes project
      1. Folder setup
      2. Importing assets into the engine
      3. Configuring assets for the game
      4. 9-slicing Sprites
    8. Best practices
      1. Textures
        1. Maximizing the space that you have
      2. Scaling
      3. Naming
    9. Summary
  4. Let’s Make Some Prefabs
    1. Basics of audio and sound FX in Unity
      1. Listening to the physics behind sound
    2. Importing audio
      1. Audio Listener
      2. Audio Source
      3. Choosing sounds for background and FX
        1. Happy
        2. Sad
        3. Retro
    3. Integrating background music in our game
    4. Creating the Angel and the PlayerController
    5. A brief overview of Unity's physics system
      1. Rigidbody
      2. Colliders
    6. Assembling the Angel
      1. Tagging the player
      2. Creating the Script
      3. Enforcing components
      4. Exposing variables in the inspector
      5. From the player input to a new position in the world
    7. Moving the character to the new position
      1. Testing the PlayerController
    8. Collectable system
      1. Setting up the Angel Cakes
      2. Enforcing components, again!
      3. Triggering cake
      4. Testing the cake collectable system so far
    9. Prefabs for our Game Objects
      1. Creating the Prefab for the player and the cake
    10. Building the Map
    11. Summary
  5. It’s about U and I
    1. Overview of the UI
    2. Designing the user interface
      1. Programming the user interface
    3. Four types of UI
      1. Diegetic
      2. Non-diegetic
      3. Spatial
      4. Meta
    4. Usability and function
    5. UI is not UX
    6. Designing UIs for games
      1. Feedback
      2. Be bold, not ambiguous
      3. Keep it simple, consistent, and focused
      4. Ergonomics: devices, hardware, and gestures
      5. Multi-device design
      6. Meaning and integrity
      7. Goals
      8. Enjoyment
      9. Test
    7. Introduction to the UI system in Unity
    8. Building UIs in Angel Cakes
      1. Scripting a UI and integrating with the collection systems
      2. Importing a new font
      3. Setting up the UI
      4. Programming the scoring system
      5. Increasing the score when the player collects a cake
    9. Creating a Game Over Screen
      1. Scripting the Game Over Screen
    10. Last tweaks
    11. Testing
      1. More kinds of cakes
      2. Adding more levels
      3. Adding animations
      4. Devils
    12. Summary
  6. Freeze! Creating an Intergalactic Shooter
    1. An overview of game #2
      1. Overview of shooting games
        1. First-Person
        2. Third-Person
        3. Top-down
    2. Designing game #2
    3. Setting up the project for game #2
      1. Importing assets for the space shooter
      2. Organizing the project
    4. Introduction to the animation system
      1. Concepts of Sprite animations
      2. Generating the animations from the sprites
      3. Adding a state behavior for destroying the explosion
      4. Saving the explosion as a prefab
    5. Summary
  7. No One Is Alone Forever
    1. Creating a shooting system
    2. Player controller
      1. Requirements of the player controller
      2. Creating the script
      3. Moving the player
      4. It's time to shoot
      5. That explosion was bad
        1. Testing the explosion
    3. Enemy controller
      1. Requirements of the enemy controller
      2. Creating the enemy controller
      3. New variables for the enemy controller
      4. Modifying the movement
      5. Shooting deadly bullets
    4. Alternative enemy controller
      1. Creating the second enemy controller
      2. Changing the aiming system
    5. Shooting with passion
      1. Creating a bullet prefab
      2. Creating a bullet controller
        1. Enforcing components
        2. Exposing variables in the Inspector
        3. Getting the reference to the rigidbody
        4. Auto-destroying the bullet
        5. Moving the bullet
        6. Hit spaceships
    6. Exercises
    7. Summary
  8. Getting Serious About Gameplay
    1. Building the UI
      1. Setting up the UI
      2. Creating the lives counter
      3. Creating the star score counter
    2. Building an infinite scrolling map
      1. Repeating the background
      2. Falling stars and planets
      3. Rotating satellites
    3. Creating the prefabs
    4. Including power-ups
    5. Spawning system
      1. Coroutines
      2. Creating spawning points
      3. Scripting the spawning system
    6. Testing the game
    7. Exercises
    8. Other things you could consider adding to the game
      1. Timer
      2. Increase the speed
      3. Combos
      4. Bosses and waves
    9. Summary
  9. Building a Tilemap and Importing it into Unity
    1. Platforming games
    2. Side-scrolling
    3. Infinite scrolling/endless runner
    4. Overview of the project for game #3 - RETROformer
    5. Creating tiles
    6. Introduction to the program - Tiled and Tiled2Unity
      1. Mini-map
    7. Changing level properties
      1. Adding colliders to our tiles
    8. Importing tilesets into Unity with Tiled2Unity
    9. Post-Tiled2Unity 
    10. Summary
  10. Look, It Moves
    1. Advanced animations
      1. A short recap of the animation system
    2. Setting up the sprite sheet for the animations
    3. Creating the animations from the sprite sheet
    4. Building the Animation State Machine
    5. Summary
  11. Let’s Get Physical
    1. Physics Material 2D
    2. Building the panda hero
    3. Moving the panda
      1. The control scheme
        1. The Movement Component
        2. Setting up the Movement Component
    4. Player Controller
    5. Summary
  12. Don’t Forget to Save!
    1. Save and load systems
      1. Creating a save/load system in Unity
        1. PlayerPrefs
        2. PlayerPrefs functions
        3. Variables to save in RETROformer
      2. Building the save/load system for our game
      3. Refining the save and load system
    2. Jump pads
      1. Creating the Jump Pad
    3. Wrapping up gameplay
      1. Creating the user interface
      2. Water zones
      3. Winning zone
    4. Enhancing the environment
    5. Testing
    6. Summary
  13. The Nature of Export
    1. Implementing mobile input for the game
      1. MovingController
      2. JumpController
    2. Exporting the game
      1. For Android
        1. Preparing an Android Unity project
    3. Summary
  14. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think

Product information

  • Title: Unity 2017 2D Game Development Projects
  • Author(s): Lauren S. Ferro, Francesco Sapio
  • Release date: January 2018
  • Publisher(s): Packt Publishing
  • ISBN: 9781786460271