Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | BreamkillerX |
I have a node that I need to duplicate randomly on the map every 10 or so seconds.
Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | BreamkillerX |
I have a node that I need to duplicate randomly on the map every 10 or so seconds.
Reply From: | exuin |
Not tested, but try this:
var node_path = preload("res://path_to_node.tscn")
func _ready():
randomize()
func make_node():
# Call this function every 10 or so seconds using a timer
var node = node_path.instance()
add_child(node)
node.position = Vector2(rand_range(min_x, max_x), rand_range(min_y, max_y))