0 votes

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.

in Engine by (75 points)

1 Answer

+1 vote

You can right click on the player and select change type. Image Link
you can look at this post on how to change the node type through code: https://godotengine.org/qa/53473/how-do-i-change-a-nodes-type-via-script

by (29 points)

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()
    new_node.name = old_node.name
    new_node.position = old_node.position

How can i solved this?

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.