GameMakerHelpBlog

Tuesday, April 10, 2007

Adding sound

Hi

Here is a script to add sound without errors that sound don't exist

first make a sound name it sound0

Then add this code ( you can change the extention if you need to)

[code]obj=music event=any except for step or draw
LoadGameName = "";
LoadGameName = get_open_filename("Saved Games (*.mp3)*.mp3", "");
if (LoadGameName != "")
{
if (string_copy(LoadGameName, string_length(LoadGameName) - 3, 4) != ".mp3")
{
LoadGameName = LoadGameName + ".mp3";
}
s=sound_replace(sound0,LoadGameName,3,true);
sound_play(sound0)
}
[/code]

Labels:

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home