The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

0 votes

I am trying to send a signal on contact with my player and a coin that updates the coin amount. Here is the code for the collision with the player

func onCoinareaentered(area):
if area.isingroup("player"):
I connected the signal coinget to this function

func onCoincoingetn():
coins += 1
It doesn't update the counter, but I tried similar code with a timer instead

func onTestTimertimeout():
coins += 1

and that code worked. Any way how to make it work with the signal?

Godot version 3.5.1
in Engine by (17 points)

How are you connecting the signal?

I instanced the coin scene under my main scene then connected the signal to that main scene's script

Did you connect the onConinareaenteered(area) to the area_entered signal?

If the emit() is not working, I guess the func onCoinareaentered is not called.

The function is being called though, because the hide() works so I don’t know if the signal isn’t being emitted or what.

Well, if onConareaentered() is called, emitsignal("coinget") shouldn't be the problem. Then is probably the signal "coin_get" having a connection issue.

1 Answer

–1 vote
func onCoincoinget():
     coins += 1

you got an extra letter "n" added there, i think it's disconnecting your signal

by (23 points)

I made a typo when typing the code I think, there isn't and n there in the actual code
here is what I'm currently using

func onCoincoinget():
coins += 1

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.