O'Reilly logo

Unity Android Game Development by Example Beginner's Guide by Thomas Finnegan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required