Thomas Doukinitsas
INTERACTIVITY: Audio and Score Text

INTERACTIVITY: Audio and Score Text

To start off we created a quick script to destroy our explosion prefabs after they've exploded


Next it's time to add some audio to our game. This is done with an audio source component since we have a 2D game


We added these to our explosions, and chose "play on awake" to play the sounds as soon as the explosions are spawned in

Now for our bolts it's a bit different as we have to trigger them using a script. This is done using a simple "audio.Play ();" line after the bolts are instantiated

Also we added some background music to the GameControler gameobject.

Another thing that we did was to add some score text. We did this using a GUIText component on an empty gameObject.


We added some further lines of code to the GameController and DestroyByContact to refrence the text and set up the first bit of the score code.



then we just had to trigger the event in the DestroyByContact code

Lastly we duplicated the GUIText layers twice for the restart and game over text


also we finished up the code with triggers and custom functions



Unknown

Some say he’s half man half fish, others say he’s more of a seventy/thirty split. Either way he’s a fishy bastard.

0 comments: