Book Image

Building a Game with Unity and Blender

Book Image

Building a Game with Unity and Blender

Overview of this book

In the wake of the indie game development scene, game development tools are no longer luxury items costing up to millions of dollars but are now affordable by smaller teams or even individual developers. Among these cutting-edge applications, Blender and Unity stand out from the crowd as a powerful combination that allows small-to-no budget indie developers or hobbyists alike to develop games that they have always dreamt of creating. Starting from the beginning, this book will cover designing the game concept, constructing the gameplay, creating the characters and environment, implementing game logic and basic artificial intelligence, and finally deploying the game for others to play. By sequentially working through the steps in each chapter, you will quickly master the skills required to develop your dream game from scratch.
Table of Contents (16 chapters)
Building a Game with Unity and Blender
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Player inputs and character movements


We are now done constructing the basic user interface. Now, let's move on to player inputs and character movements! A game character, especially the one who gets controlled by the player, usually contains tons of different states, such as idling, running, attack, and so on, which changes frequently based on the mix of player inputs and other conditions, such as health point, timer, and so on.

The following is an example of a basic character structure displayed in a flow chart:

In Unity, there are many ways to move an object or a character, such as adjusting the variables of the transform directly, or applying force to a rigid body, or using a navigation mesh agent to automatically calculate the shortest path, and so on. In this case, we would need to use the character controller instead, which can be found at Component | Physics | Character Controller. After adding the character controller component to your game character, we can start writing the code...