Game Development Reference
In-Depth Information
4. Since we want this clip to be played when the player's ship shoots, we will
add the requested code to play this audio file in the ControlShip script.
5. Add the following line into the Update() function, inside the press spacebar
event:
//play shooting audio fx
audio.Play();
6. This is the updated Update() function of the ControlShip script:
function Update () {
//is the player pressing right button?
if(Input.GetKey("right") &&
transform.position.x<25)
{
Search WWH ::




Custom Search