0 votes

enter image description here
So I'm just trying to make a coin disappear when I walk over it and also play a sound. So here is what happens.

func onCoinbodyentered(body):
$coinsound.play()
emitsignal("coincollected")

With this code the coin doesn't disappear but the sound plays.

func onCoinbodyentered(body):
$coinsound.play()
emitsignal("coincollected")
queue_free()

With this code the coin disappears but the sound doesn't play.

func onCoinbodyentered(body):
$coinsound.play()
emitsignal("coincollected")

func oncoinsoundfinished():
queue
free()

And finally with this code both the sound plays and the coin disappears but with a huge problem of the coin disappearing after 4 seconds for some reason, even with the length of the sound only being 1 second long. I just want the coin to disappear instantly with the coin sound playing at the same time.

in Engine by (15 points)

Please log in or register to answer this question.

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.