programming my sounds into my game

4
Michael Hughes 02/06/2015 Programming My Sounds into my Game In order to program sounds in to my game, I first needed to add the sound files to my game maker project. This is done by right clicking the “Sounds” Asset folder on the left hand side then clicking the “Create Sound” Option, it then opens a pop up window that allows you to import .WAV or .MP3 sound files to gamemaker. It also lets you select a name for the sound, Control the Volume and Edit the sound if you have the neccassary external software. Other options that can be changed are also the Attributes like Uncompressed or Compressed – Streamed. Aswell as the Bit rate, Sample rate, either 8 or 16 bit and the device the sounds are playing from for instance mono and stereo. After checking all of these settings, I then went on to browse my sound library for each file. Selecting the sounds To program my sounds into my game, I was required to browse each of the sound assets I had gathered, to do this I navigated to my REAPER media folder to find the sounds I have downloaded. I then played

Upload: mike-hughes

Post on 13-Aug-2015

25 views

Category:

Career


0 download

TRANSCRIPT

Michael Hughes 02/06/2015

Programming My Sounds into my Game

In order to program sounds in to my game, I first needed to add the sound files to my game maker project. This is done by right clicking the “Sounds” Asset folder on the left hand side then clicking the “Create Sound” Option, it then opens a pop up window that allows you to import .WAV or .MP3 sound files to gamemaker. It also lets you select a name for the sound, Control the Volume and Edit the sound if you have the neccassary external software. Other options that can be changed are also the Attributes like Uncompressed or Compressed – Streamed. Aswell as the Bit rate, Sample rate, either 8 or 16 bit and the device the sounds are playing from for instance mono and stereo. After checking all of these settings, I then went on to browse my sound library for each file.

Selecting the sounds

To program my sounds into my game, I was required to browse each of the sound assets I had gathered, to do this I navigated to my REAPER media folder to find the sounds I have downloaded. I then played each of the sounds to ensure they worked in gamemaker and put them into the “Sounds” Folder by clicking “OK”.

Michael Hughes 02/06/2015

Programming the sounds into my game

To actually make the sounds work, I was required to use a line of code to make sure they played when I wanted them too, I began using the main music for the game, I decided to place this in the Player Create Event because when the player is created, it will play the music for the game automatically.

The line of code is: audio_play_sound(soundID, Priority, loop); “soundID” “Priority” and “loop” can be changed around.

This is the method that plays the sound, it tells the game to play this sound whenever the event is triggered, for instance in my game, I made the code trigger when the player is created.

The “soundID” is the name of the sound, so whatever the sound was named when I selected them is what went in here, in this case “Game_Theme_level_1”was the soundID because that is what it is called.

The priority is set to a number, it isn’t as important as the other variables but it is still useful, depending on how high the number is, this sound would take priority over other sounds with lower numbers.

This is either “true” or “false” and this determines whether the sound will play again once it finishes.

Michael Hughes 02/06/2015

I used this piece of code for every single sound, although I put them in different places so they would work. I repeated this process so I added a total of 4 sounds into my game.

Jumping Sound

Next level Sound

Game over Sound

Michael Hughes 02/06/2015

Trap Sound