Game Development Reference
In-Depth Information
The next step is to provide the bullets fired by aliens with a behavior, since, as it is,
the AlienBullet prefab doesn't do very much. In the next step we need to pro-
gram the behavior of the bullets fired by aliens.
1. Create another script with name ControlAlienBullet . The script is
mostly like the one controlling the PLBullet prefab, with the difference that
it moves in the opposite way, from top to bottom of the screen. This time we
also check collisions with the player's ship rather than aliens and with the
barriers, which we will discuss in more detail in the next chapter.
2. Finally, we need to manage the consequence of the bullet hitting the player's
ship. We will take care of this in another section of this tutorial, when we dis-
cuss the final touches to be added to the prototype. For now, we are fine with
a simple log message telling that the game is over!
3. The following code is to be put in the ControlAlienBullet script:
function Start () {
}
Search WWH ::




Custom Search