Creating Point and Click Games with Escoria

Music and sound effects

Referring to the Godot Engine book, importing and playing sound is quite simple in Godot. But there are a few things to take care of:

  1. sounds effects could be in wav format to avoid uncompressing effort and avoid delays
  2. music can be in mpc, ogg or opus
  3. try to delete silences at the beginning and at the end of the samples
  4. to speed up sound playing you can stick to 44Khz mono rate, eventually 44khz stereo if it is important to your game. The game will be much smaller in size and play drastically faster.
If needed, Audacity is free GPL software that can be used to convert and enhance sounds before importing them in Godot.

Background music

Background music is a good way to improve the design of your world.

To add background music to your game, verify that res://main.scn contains globals/bg_music.scn as a child of telon.

insert background music in point and click game

To launch music, you have 2 main ways.

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 the Autoplay property in the Inspector too.

autoplay background music in godot escoria

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:

set_state bg_music "res://scenes/intro-game/sounds/asianoriental2.ogg"
Make sure you use only stream formats for bg music, like ogg, mpc or opus. Wav won't work here !

To change a music to another, just reuse the set_state with another resource 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

Sound effects are made to give a better feedback to action as well as giving the game more realism. Most of the sound effects you’ll need will be played while picking or using an object, or when a dialog happens (voicing). Because there can often be animations while 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 wanted the good_bamboo to play a sound on pick-up, we should do the following.

  1. Edit the good_bamboo.tscn file.
  2. Add a SamplePlayer Node.
  3. In the Inspector, modify the Samples property to create a New SampleLibrary and press > to enter the library to load sample files in wav format:
    adding sound sample in godot
  4. Then select animation node, create an animation and name it whatever you want, for example pick_up.
  5. Keeping the animation panel open, select the SamplePlayer node, go to Play property when you can select you sample from the list.
  6. You have to click on the little key right of the Play property to add it to the animation. If Godot asks for adding a track, just answer create.
    using sample sound in animation
  7. You can add this way as many animation as you have sounds to play in your item.
  8. The last thing is to declare the animation when you want the sound to be used. You could use set_state command, but we can preferably use anim global_id animation_name or 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.