Book Image

Unity 4 Game Development HOTSHOT

By : Jate Wittayabundit
Book Image

Unity 4 Game Development HOTSHOT

By: Jate Wittayabundit

Overview of this book

<p>Immerse yourself in the world of high-end game design by partaking in challenging missions. Start off by working with the Sprite Mode, then learn the basics of creating a UI system for an RPG, and work your way through the game virtually embodying your greatest hero or heroine.</p> <p>Every project is designed to push your Unity skills to the limit and beyond. You will start by creating a 2D platform game with the new 2D sprite feature and move on to the Unity GUI system. Then, you will create a 3D character and make it move. By the end of this book, you will know how to post the player's score to the hi-score board.</p>
Table of Contents (19 chapters)
Unity 4 Game Development HOTSHOT
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating a character control script


In this step, we will create a script that controls our character's movements such as forward and backward movements, turning left or right, and other actions such as jumping and falling by using the CharacterController component and the OnAnimatorMove() function.

Tip

We can also use the Rigidbody and CapsuleCollider components instead of CharacterController. However, in this book, we want to show the example of using CharacterController because there are many convenient functions to use to control the character such as Move(), collisionFlags (checking where the character is collided), and slopeLimit (the character can move up on the slope by a limited degree). If we use Rigidbody and CapsuleCollider, we have to create those functions ourselves.

Engage thrusters

Now, we will create the script to control our character. Perform the following steps:

  1. We will create the CharacterControl script that will control our entire menu; go to Assets | Create | Javascript...