Game Development Reference
In-Depth Information
5. We also need the PLShip Prefab to be added with a BoxCollider component
with the Is Trigger flag checked in order to have the collisions with the bullet
being detected. The following screenshot should help you do that:
6. Add the ControlAlienBullet script to the AlienBullet Prefab and if you
test the project now, you should have the aliens randomly fire at the player.
Check that the player's ship is destroyed and the Game Over log is correctly
displayed upon collision between the alien bullet and the player's ship.
7. Also remember that you can tweak the firing rate of the aliens by modifying
the InvokeRepeating instruction or the probability that the doFire()
function is called in the AlienShoot script.
This ends the second part of the tutorial, where we added the basic functionality to
our Space Invaders prototype. Right now, in the Scripts folder of the Project panel
you should have the following scripts:
AlienShoot
BoundCollision
ControlAlienBullet
ControlPLBullet
ControlShip
ControlSwarm
The Prefabs folder should contain the following prefabs:
Search WWH ::




Custom Search