0 votes

here is my current code;

func _on_start_button_pressed(): $CenterContainer/VBoxContainer/boom.play() yield($CenterContainer/VBoxContainer/boom, "finished") get_tree().change_scene(next_world)

that currently plays the sound and waits until the sound has finished playing before moving onto the next scene, which isn't a big issue but I want it to play the sound as the scene changes. I'm new to Godot engine, so thanks for the help!

Godot version 3.4.2
in Engine by (12 points)
edited by

Add a script to autoload. do it from there

1 Answer

0 votes

Yield is "pausing" code until the requirement is true, in this code - "finished"
So you will have to remove yield so it will be synchronous.
However, idk how it will work when changing scene, but you should try it out yourself

by (30 points)
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 Frequently asked questions and 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 [email protected] with your username.