+2 votes

I'm making a 2D game, and I want to add step sounds to the walking animation. Can I do that with key-frames inside the animation tab, so that the sounds correspond to the animation? I tried to use the AudioStreamPlayer but it doesn't seem to work at all.

asked Jan 22, 2019 in Engine by Fupicat (68 points)

As far I know, you can call functions in the animationplayer. Add a call function track and populate it with keys triggering a function that play the sound in certain periods.

I never knew that! Gonna test this right now.

This worked very well! Thank you so much.

You're welcome.
: )

1 Answer

+1 vote

Totally possible. I created an animation with text being typed out accompanied by keyboard sound.

Typing Animation

  1. Create an AudioStreamPlayer and an AnimationPlayer.
  2. Click the AnimationPlayer to open the Animation tab
  3. Click + Add Track > Audio Playback Track
  4. Right-click on the track > Insert Key
  5. Click on the keyframe you've just created
  6. Load the sound file into the Stream property (That's it!)
  7. You might want to save it as a .tres so you can drag-n-drop it onto the track
  8. Or you can just copy it
answered Jan 23, 2019 by Dlean Jeans (3,911 points)

I don't see "Audio Playback Track" anywhere in the Add Track menu.
enter image description here

It's only available in Godot 3.1, I forgot.

That's OK, I've already found an answer. Thanks, anyway!

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.