September 2010
Beginner
384 pages
8h 49m
English
In The Break-Up, our falling objects were larger, and they fell through a smaller vertical range. Now that there's no ground to hit and the sky's the limit, we should tweak a few lines of code in our EnemyShip Script (formerly the FallingObject Script). Double-click the EnemyShip Script and roll up your sleeves:
if(transform.position.y < 0)
if(transform.position.y < -4)
This allows the enemy ship to reposition itself when it moves off the bottom edge of the screen, instead of when it hits the non-existent ground plane at y:0.
transform.position.y = 50;
transform.position.y = 71;
When the EnemyShip is repositioned, cranking up its y value will start it just above the top edge of the screen.
Read now
Unlock full access