Time for action – flying asteroids
The first objects we will be avoiding in our infinite space will be asteroids:
- 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
. - 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 ...
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.