Topic was automatically imported from the old Question2Answer platform.
Asked By
X
Hello there. Im making a MetroidVania and i would like than the Player turn into a Mause. The mause is already programed, but, How i remplace the node of the Player with the node of the Mause? Any help is welcome.
Hi and thank you for answer me.
I tried your method (changing a few things) and it worked fine for the player to become a mouse, but when I use it backwards it gave me the following error:
Parser Error: Can’t preload resource at path: res://Objets/Player/Player.tscn
There is the code:
func TurnIntoAHuman():
old_node = Player
var nextNode = preload("res://Objets/Player/Player.tscn")
var new_node = nextNode.instance()
parent.remove_child(old_node)
parent.add_child(new_node)
new_node.name = old_node.name
new_node.position = old_node.position