+1 vote

Hey guys, how do i add a sound into the tittle screen?

in Engine by (20 points)

1 Answer

0 votes

If by title screen you mean the boot splash screen, then it's not possible afaik.
If you mean the main scene - first scene that starts after the boot splash and for sure can imitate the title screen or game intro etc. - you have to add sampleplayer/streamplayer/etc. node to the scene, import some audio samples (if it's longer music, you would probably want to stream it from filesystem) that you want to play (wav or ogg) and start playing from code. Sample playing code may looks for example like this:

get_node("sampleplayer").play("audiosample")
by (717 points)

Thanks :).

And yes i mean the main scene.

in "audiosample" i need put the extension of the file too ?

No, just the name that you used in the import.
If you are not sure how some simple things work in GDScript , it's always good to open one of the example/demo projects (if you need sound check the one that uses sounds etc.) to check how the real code looks there. It's always the fastest way to learn, at least for me ;)

oh thanks for remembering me about the exemples i really forget this

Let me share just one more tip with you then. It was really an ice breaker when I could not find the answers on how something should work.
You go to github.com where Godot code and many other godot projects are and you use github's search. For example, when you want to see examples of how to use SamplePlayer, you search for: SamplePlayer language:GDScript

Github will let you search within: Repositories, Code, Commits, Issues, Wikis and Users. You of course click on Code in the upper search summary menu... and voila, you see all the places in all projects written in GDScript that are on Github, that use SamplePlayer in their code. You may even download each project and run it in Godot to see how the code works.

Really thanks again :).

Go start search there before asking here now

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.