Unit 73- Criteria 4: Programming Sounds Into a Video Game.
Unit 73 Criteria 4: Programming Created Sounds Into A Game.First, open GameMaker and open a new project.
Open the game project you wish to add sounds to. First I am goingto add a shooting sound to my game, so when I click space bar toshoot, the game with automatically play a chosen sound.
Once it loads and is finished and open, Click on ‘Create New Sound’ at the top of thescreen. This is going to be my sound.
Once this menu loads, Rename the sound to something relevant to what the purpose of thesound is going to be, make sure it is a clear, simple name so you will remember what it does.I am going to call it ‘Shoot_Noise’ Now click ‘Load Sound’ and find your chosen sound.
Click ok when you are happy with the chosen sound, and sound name. Ifit is for background music, be sure to mark the ‘Background Music’ tab. Iam happy with my chosen settings, so I will click ok.
It will create a new Sound in the drop down ‘Sound’ menu. This will now be used to create thein game sound, or sounds. See how it shows the name you chose? That is why it is importantto name it something simple, as when you start to add lots of sounds it could get confusing.
Now, Im going to click on the main player controller, the object that is wanting to shoot. I amgoing to right click, and click on ‘Properties’.
When the new menu comes up, you want to click ‘Add Event’, and chosethe command that best suits your game. For me, Space Bar is shoot, sowhen Space Bar is pressed, my sound will play.
Once you have the right command, now we are going to chose what action you want totake place when the command is used. I am going to click on ‘Play sound’ so when I clickthe space bar, the sound of my choice, out of the drop down menu will play.
Right click on the action, and click ‘Edit Values’. A new menushould appear, asking us which sound we want to be played whenthe command is used.
We are going to click the little icon next to the menu, and chose our sound, again, this iswhy simple names are important for your sounds/ objects. I am going to chose the‘Shoot_Noise’ Sound out of the menu.
Once that is complete, hover over the action to make sure it all looks ok, before clickingok, and Running the game to test your new sound(s).
I ran my game in normal mode, and the sounds worked perfectlywithout problems. When I pressed Space Bar, the sound played, andthe character shot.
Next we are going to add a new sound like we did earlier, but with a different soundfile and name, for when the bullet, hits the enemy. Due to the fact that my gamebeing set in space, and my character is in a space ship, I went for a futuristic noiseto keep with the feel of the game. I named the sound ‘Rock_Hit’. Again, a simplename.
Once done and your sound shows in the dropdown menu like earlier, you are going to rightclick your bullet object. Click ‘Properties’ and once again create an event. I am going to choose‘Collision’. I am going to link it to the enemy Parent object, in my case, the big Meteorite. Thismeans when the bullet hits the object when playing, I can make it do anything I want. I want itto play the new sound I have just added, so again, ‘Play sound’ and click on the new sound.
This is me choosing the correct sound from the menu.
Again, hover over the action and event to double check what you have done looksalright, before clicking ok, and running the game to test the sound.
Now run the game and check your work is correct and working, ifnot, double check what changes you made to make sure everythingis in place.
Now we are going to add a background music onto our game. First find yourbackground music sound from the ‘create sound’ option like earlier.
Here is me choosing my background music for my game. Do not forget to tick the‘Background Music’ box before clicking ok.
Be sure to save regularly to avoid any work loss if anything goes astray.
Again, create another new sound, and name it something along the lines of ‘Start’. I amnow adding a quick noise indicating the start of the game, to warn players that the game isabout to begin.
Click on the main character object again, and add a ‘Create’ event. Thendrag ‘Play sound into the side box, choose your new sound, and click ok.
Once again, run your game to check if your work, actually works!
For the last time, create a new sound, and name it something along the lines of‘Destroy’ for when the meteorites get destroyed. Click create sound, choose thesound you wish to use, and click ok.
What we need to do now, is click on the meteorite objects, and create a newevent, for when the meteorites are destroyed. Click on ‘Play sound’ again, and add inthe sound you want to use. Again, double check the work before clicking ok, andchecking your work.
When you run the game, you should have a game, will sounds thatautomatically play when you shoot, hit objects, destroy objects, startthe game, and even background music