Hi, new to Godot. My first game is a simple mobile game where the player is an apple falling out of a tree and has to dodge branches to reach the bottom. There are 3 different sized branches small medium and large. I have a branch coming up the screen and when it gets off-screen a collision is scripted to queue_free the branch and spawn a new one in the same starting position. It works great but now I need to figure out how to make that branch spawn as either a large, medium, or small branch randomly. All the tutorials or forum posts I found were just dealing with spawning in a random position. I need it to spawn in a constant position but a random sprite. That made sense. Thank you.
Here's the code for the collision that deletes and spawns a new sprite if that helps:
`extends Area2D
var Wall = preload("res://branch_large.tscn")
func respawn():
var Wall_instance = Wall.instantiate()
Wall_instance.position = Vector2(0,1472)
get_parent().call_deferred("add_child",Wall_instance)
func _on_area_2d_body_entered(body):
if body.name == "branchLarge":
body.queue_free()
await get_tree().create_timer(1).timeout
respawn()
`