Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | CakeLover |
I’m trying to reset the value of a variable after the animation is complete like this:
extends Node2D
var testing=false
func _ready():
var ani_player=$AnimationPlayer
ani_player.play("ani_2")
ani_player.connect("animation_finished",self,"set",["testing",false])
but for some reason it gives the error:
E 0:00:00.479 emit_signal: Error calling method from signal
‘animation_finished’: ‘Node2D(Main.gd)::set’: Method expected 2
arguments, but called with 3… <C++ Source> core/object.cpp:1242 @
emit_signal()
which makes no sense I’m passing 2 variables ["testing",false]
why does it keeping getting a third one?
am I missing something?
it is not connection, check out your receiving function. You had it expect 2 arguments like
func set(x,y)
but something calls more upon emitting. Propably it calls private arguments AND additional ones You introduced in connection
Inces | 2022-12-15 21:04
The animation_finished
Signal has its own argument that also gets passed along hence the 3 arguments
Additionally its argument always gets passed along first
Wakatta | 2022-12-16 01:41