The player character is the visual representation of what the user will input to the device. In the game we're creating, it will be quite simple. Our character will be designed to perform only three things: change its direction based on the swipe input of the user, collide with pickups in the world, and collide with obstacles in the world.
The swipe direction will determine the direction the character will move and with how much force it will move. The collision with pickups will add to a collection of points for the user. Also, the collision with obstacles will "kill" the character and end the game.
A character is a GameObject that has Rigidbody
attached to it. Rigidbody
is a component in Unity that will give the character simple physics and things such as gravity and collision. This means that Rigidbody
also allows the character to collide with the world and with other GameObjects collision "touch" boxes.