0 votes

Hola es posible que un emisor envie una señal a un hermano?
Como hago referencia a un nodo hermano ya instanciado para indicarle que ejecute su metodo mediante connect?

var pelota=load("res://pelota-Football/pelota.tscn")
.....
connect("patear",pelota,"aumentar_velocidad")

Me da el siguiente error:
E 0:00:12.341 emitsignal: Error calling method from signal 'patear': 'PackedScene::aumentarvelocidad': Method not found..
core/object.cpp:1257 @ emit_signal()
jugador.gd:25 @ _input()

¿porque busca el metodo en PackedScene?

Gracias!

in Engine by (20 points)

1 Answer

+1 vote
Best answer

I think what you need is:

pelota.connect ("patear", self, "aumentar_velocidad")

because the signal is emmited from pelota. And you need a function in your current script

func aumentar_velocidad():
by (719 points)
selected by

The signal is emmited from jugador :

emit_signal("patear")

jugador is nodo brother

Where is func aumentar_velocidad

The function aumentar_velocidad is on the pelota.
I solved it by creating a main node, pelota parent and jugador and connecting them as follows in main.gd:

func ready():
#conecto señales entre nodos
$"RigidBody mundo/jugador".connect("patear",$"RigidBody mundo/pelota","aumentar
velocidad")

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.