So now we have a game in which we have a penguin that can fly and jump with a rocket fire particle system effect. Also, we have a basic environment of snow backgrounds in the scene as well. In this section, we will learn about how we to make the penguin move throughout an endless generated level and how the camera will always be focused on the penguin.
Let's start by making our penguin move in a forward direction. To do that, open the file PenguinController.cs
created in Chapter 1, Introduction to Android Game Development with Unity3D. This file is contained in the Scripts
folder of the Assets
directory. Add the forward speed public field in the class, as shown in the following code:
public float forwardMovementSpeed = 3.0f;
Recall that adding any public field results in the addition of a property in the script's game object, as shown in the Inspector
panel in the following screenshot:
Figure 2.19 Forward Movement speed field in the Inspector...