|Topic was automatically imported from the old Question2Answer platform.
I followed a tutorial some time ago about a dash where you create a trail effect by instantiating a PackedScene containing a Sprite2D node. This has it’s own script and in my player script, I get the input direction of the dash. But to change the frame, I need to send a frame value from my Player.gd to this script called dashobject.gd. So this is usually done with signals afaik but I haven’t done a whole lot with custom signals and I think this is where my problem lies.
In my Player.gd script I have:
@export var dashobject : PackedScene
signal send_frame(frame : int)
if dash_dir == Vector2(1, -1):
func _on_send_frame(frame : int):
return frame(don't know if this is necessary)
I expect I can do this in reverse by adding and connecting the signal in the dashobject rather than the player but there’s something about the code that wrong that I just can’t see. Also I don’t really understand how to use the value received from the signal in the dashobject script. If there’s another method to achieve the same result, I’d be happy to hear it. Thanks in advance!