How can I make a node clone a scene in the map

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Parkurist

I have a tree and I want it to drop wood on the ground by cloning the wood scene in the map scene when its health drops under 0, right before it deletes itself by queue_free()

I think you should look into instancing.

exuin | 2021-04-25 17:10

thanks, it helped

Parkurist | 2021-04-26 16:22

Yep.

export(PackedScene) var wood


func handle_input():
    ##put your logic here
    var w = wood.instance()
    $tree.add_child(w)
    ## do whatever you want

Mrpaolosarino | 2021-04-27 13:59