Time for action – using the boost effect

We will only be making a single script in this section. It will move the tank in a similar manner to the ChassisControls script we created in the last chapter. The difference is, we won't have to hold down a button for the boost to work. Let's get to it.

  1. Start by creating a new script and calling it TurboBoost.
  2. To start the script off, we need four variables. The first is a reference to CharacterController. We need this for movement. The second is how fast we will be moving while boosting. The third is how long, in seconds, we will be boosting. The last is used internally for whether or not we can boost and when we should stop.
    public CharacterController controller; public float boostSpeed = 50; public float ...

Get Unity Android Game Development by Example Beginner's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.