how to detect if a node has exited screen-viewport and delete it as it does?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By ANiK3T

I wish to spawn background sprites in continuous order so that BG seems infinite.
I’ve now learned to spawn the sprite and have it make a transition on screen, I’m just left with how can i delete it as the sprite automatically exits the scene.
(using Godot3)
tried it with visibility notifier and visibilty enabler but got these errors

0:00:00:0685 - Error calling method from signal ‘visibilitychanged’: ‘Sprite(SpriteMove.gd)::onSpritevisibility_changed’: Method not found.
Type:Error
Description:
Time: 0:00:00:0685
C Error: Error calling method from signal ‘visibilitychanged’: ‘Sprite(SpriteMove.gd)::onSpritevisibilitychanged’: Method not found.
C Source: core/object.cpp:1202
C Function: emitsignal

0:00:12:0193 - Error calling method from signal ‘viewportexited’: ‘Sprite(SpriteMove.gd)::onVisibilityEnabler2Dviewport_exited’: Method not found.
Type:Error
Description:
Time: 0:00:12:0193
C Error: Error calling method from signal ‘viewportexited’: ‘Sprite(SpriteMove.gd)::onVisibilityEnabler2Dviewportexited’: Method not found.
C Source: core/object.cpp:1202
C Function: emitsignal

here’s SpriteMove.gd

extends Sprite

var vel = Vector2(1, 0)

func _ready():
    #print(get_position())
    set_process(true)

func _process(delta):
    set_position(get_position() + vel)

func _on_VisibilityNotifier2D_screen_exited():
    queue_free()
    print("Deleted")
:bust_in_silhouette: Reply From: Zylann

The (two?) signals expect the methods onSpritevisibility_changed and onVisibilityEnabler2Dviewport_exited on your SpriteMove.gd, but I see none of these in your script. Instead you only defined _on_VisibilityNotifier2D_screen_exited.