Task 7 Programming My Sounds Into my Game

This is how I programmed sounds into my game;

Game Music;




To start with I put my game music into this game. First of all I pressed 'Add Event' then I went to 'System' then clicked on ' On start of layout'. After this I clicked 'Add Action' then 'Audio' and 'Play' then choose my 2D Computer Game Music and gave it a tag for later use.

Victory Sound;





The next thing I did was making it so I could complete this game. I created a Global Variable and named it 'EnemyCount = 12' then made it so when 'Enemy' is 'Destroyed' it will subtract 1 from this Global Variable. When the Global Variable reaches 0 it will then play the 'Victory' sound then immediately adds on back to the Global Variable to prevent it from looping the sound then it restarts the layout.


Player Death Sound;

Then I moved onto my Player Death sound which is triggered by making it so when 'Player' is 'On collision with Enemy' 'Player' 'Destroys'. When the player dies it 'Plays' the death audio then it 'Restarts the layout'.







Game Music Fix;

Due to me having this death sound and then it leads to the layout being restarted it caused the game music to loop. To fix this I had to make it so 'On end of layout' the tag I used when placing the game music into the game in the first place which was 'soundtrack'. I had to use this tag when I clicked on 'Set Mute'. This fixed my problem.





Player Bullet;

To add the Player Bullet sound I went to the Event Sheet and there was a pre-built event that I added to. I added the part where it says 'Audio' 'Play Player Bullet'.







Enemy Destroyed;




All I needed to program this sound in is on 'Enemy' 'Destroyed' then 'Audio' 'Play' then I choose my Enemy getting hit sound and changed the dB to -10 as I don't want it to loud.

Video;