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 – flying asteroids

The first objects we will be avoiding in our infinite space will be asteroids:

  1. To make the asteroids work, we will first need to make the player ship's rotation and speed available for the asteroids to use. To do this, we need to create a new script and call it PlayerShip.
  2. Again, this script starts with a group of variables. The first is the speed of the player's ship. The asteroids and other objects in the space will use it to move around the player. The second variable will hold a reference to the TiltSteering script that we created earlier. This will give us access to the ship's rotational speed. The last variable is a static variable that will hold a reference to the instance of this script that exists in the ...

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