Code:
If image doesn’t work:
func _clear_sprites():
for i in l_sprites:
i.visible = false
l_sprites is a list of all the sprites I want to clear. They are all Sprite2D’s.
I’m working on an indie game in Godot 4, and I’m attempting to create a function which hides every sprite in a list (I have a lot of sprites). This is giving me an error of: "Invalid set index ‘visible’ (on base: ‘Nil’) with value of type ‘bool’. Last time I checked, Sprite2D nodes do have the property of visible, which is a boolean. How would I get rid of this error?