Is it possible to grab all nodes from another scene that are in a group? I'm basically trying to find all nodes in a group called "Enemy" in the world scene. Once they're all found I want to then choose a random one and grab its texture for UI sprite.
The errors I'm getting:
Attempt to call function 'getnodesin_group' in base 'null instance' on a null instance.
It's also saying that world.tscn isn't being found. So maybe I'm not under standing how to grab nodes from another scene correctly?
Can anyone point me in the right direction or tell me where I'm going wrong? I'm new to GODOT.
onready var ammobar = get_node("TextureProgress")
onready var bounty = get_node("Panel/Bounty")
# class member variables go here, for example:
# var a = 2
# var b = "textvar"
var bounty_Ended = true
onready var enemies = get_node("res://world.tscn").get_nodes_in_group("Enemy")
var amount = get_parent().ammo
if(bounty_Ended == true):
bounty.Texture = enemies.rfind(rand_range(1,5))
bounty_Ended = false