Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | ANiK3T |
Hi, I’m new to godot engine and was trying to make a flappy bird clone for learning.
I plan to instantiate the background sprite from right going to left such that the speed at which sprite moves and the interval between instancing its copies make the background seem infinite. As of collecting the out of view sprites i came across scripting docs and found
func _on_Visibility_screen_exited():
and
queue_free()
tried to test it but it didn’t work, (the node tab for sprite only shows Visibility_Changed() function only)
so my queries are:
- how to instantiate sprite backgrounds?
- how to manage their interval of instantiating such that they seem continous. (I’ve kept the sprite speed to 1)?
- how do i code the sprite’s script such that it deletes itself when exiting the view?
I’m using Godot v3, the root node is a sprite and scene contains no other node.
so far i’ve only manged to make the sprite move by the code:
extends Sprite
var vel = Vector2(1, 0)
func _ready():
set_process(true)
func _process(delta):
set_position(get_position() + vel)