call is just the method used to call other methods, not very usefull tbh, you can call the method directly.
node.call("method")
is identical to node.method()
call_deferred()
is instead more useful, as it will call a method only during idle time (meaning it will wait till "normal" code execution will be finished, and then call the requested method)
i'm not 100% sure why the docs tells you to call the method do
using this complex form, instead of simply calling $Child.do()
.
The use i can think of is controlling which method to trigger by the use of a string, eg:
in the child node:
var method_name=""
func _process(delta):
if method_name!="":
call(method_name)
func Test1():
print("hello")
func Test2():
print("world")
in the parent node:
var x
x="Test1"
$Child.method_name=x
with this kind of structure you can control which method will be called during the process of the child, by changing the value of the string x.
In this case it will print "hello" at every process frame.