The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

0 votes

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")
in Engine by (14 points)

1 Answer

0 votes

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.

by (29,360 points)
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 Frequently asked questions and 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 [email protected] with your username.