Game Development Reference
In-Depth Information
To have the aliens change direction as they get close to the screen bounds, we will
use two game objects positioned at the right and left sides of the swarm. The first
alien that collides with any of the bounds will make the entire swarm change its dir-
ection and also lower their height with regards to the player's ship.
1. Create a Cube GameObject and name it LeftBound . Put it at coordinates
X = -20 , Y = 5 , Z = 15 and set its scale to X = 1 , Y = 100 , Z = 8 . Also check the
Is Trigger option in its Box Collider component in the Inspector panel as
shown in the following screenshot:
2. We also need to use a tag to check the collisions of the aliens with the
bounds, so it is time to provide a brief explanation about what tags are. As
usual, we suggest you to refer to the Unity documentation to delve deeper
into this topic.
3. As the name suggests, tags are labels that can be attached to game objects
to identify them when specific events occur. In our case, we know that the
Search WWH ::




Custom Search