How can i make a machanic where i could change character 1 to character 2 and still can change to character 1 in 2d?

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

You kmow like that genshin impact character change mehcanic,i dont know how to do it and i need some guidence,im a starter and i wana learn,but is it possible to make such a mechanic?

:bust_in_silhouette: Reply From: exuin

I don’t play Genshin Impact so I just looked it up right now, but swapping out party members should be easy enough. You can store your party members in an Array and when the player changes them just swap out the items of the array.

Is it possible if you can show a little bit of an example of the coding?

Dandevuni | 2021-02-27 01:06

Can you describe the system for me? So I know what exactly you’re trying to do?

exuin | 2021-02-27 01:39

How do i say this… Like you could change to another character and you can control that character that you chose,but when you dont wana use the character,theres one sepesific button where you pressed it,it chage to character 1 into the character 2 ,both have its own unique skills,then you can change to character 1 back like scrolling to pick which character you wana play,damn its hard for me to explain

Dandevuni | 2021-02-27 01:53

Okay that sounds a bit complicated. What part exactly do you need help with?

exuin | 2021-02-27 02:10

Maybe this wouldnt make you feel confused,like changing item/weapon,but insted of item,its the character,i think like changing kinamaticbody 1 to kinamadicbody 2 and you can change to kinamaticbody 1 back

Dandevuni | 2021-02-27 02:26

Oh, okay you want to change the child nodes.

So the first thing you want to do is to organize your scenes correctly. So each character will be its own scene. character_1.tscn, character_2.tscn… You will have to store the paths to the characters somewhere. A path will look like “res://characters/character_1.tscn”. When the player switches characters, use the queue_free() function to delete the current character node (character_1.queue_free()) and then add the character_2 node as a child of the same node as the character_1 node.

I think you should probably also look up tutorials on character select screens with Godot if that helps.

exuin | 2021-02-27 02:53