Referring to the Godot Engine book, importing and playing sound is quite simple in Godot context. But there are a few things to take care of :
Background music is a good way to improve the design of your world.
To add background music to your game, verify main.scn contains globals/bg_music.scn as a child of telon.
To launch to music, you have 2 choices depending on the way you want it to happen.
If you want the music to be played automatically, change the globals/bg_music.tscn by adding a stream path to the stream node. You have to activate autoplay property in Inspector too.
To control the music changes on event, use the
set_state to bg_music command when you want to load a new music and give the file path in local system :
Take care to use only stream formats for bg music, like ogg, mpc or opus. Wavs won't work here !
set_state bg_music "res://scenes/intro-game/sounds/asianoriental2.ogg"
To change a music to another, just reuse the set_state with another ressource path.
To stop the music, use
set_state bg_music off.
Keep in mind that the state of the object will be saved to the savegame, so this music setting will be restored when a game is loaded.
Sound effects are made to give a better feedback to action as well as giving the game more reality. Most sound effects you’ll need will happen while picking or using object, or even when a dialog happen as dubbing. Because there can often be animations in the same time the sound plays, Escoria uses those animations too. If you don’t have any, you will have to set one for each sound.
For example, if we’d want the good_bamboo play sounds when picking it we should do the following.
set_statecommand, but we can preferably
use anim global_id animation_nameor
cut_scene global_id animation_name. In our case, we would get :
anim good_bamboo pick_up
Il y a une erreur de communication avec le serveur Booktype. Nous ne savons pas actuellement où est le problème.
Vous devriez rafraîchir la page.