how to switch between two character?

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

before game start we can choose between two player,
character 1 - male
then we can choose
-male cloth
-male hair
and more

character 2 - female
then we can choose
-female cloth
-female hair
and more

should i make 2 scene male and female like this:
enter image description here

then switch between two scene?

or there other way to do it? can i find tutorial or tips to make it happen?

:bust_in_silhouette: Reply From: Zylann

For character customization, I would have a single Character scene with all the common things a character should have, and then customize its children based on which gender you choose and which appearance. For example, if male has different sprite, I just change the texture property of the sprite. If the animations are different, I play different animations. I would not recomment creating a scene for both because you will end up duplicating your efforts, as character customization extends combinations way beyond gender (unless there is something fundamentally different in your game between male and female). However, you can create child scenes if that makes customization easier.

thank you very much,
i wonder, how should i transform>position for each gender
for example, if male have position(10 , 10), and female (20,20) ,
1- for every frame i have different position(x,y).

  • how to do it code?

when you say play different animation, you meant by :
1 switch between $male_player_animation and female
enter image description here

2 or swtich this one:
move_right become
male_move_right and female_move_right
enter image description here

sorry for my broken eng and thanks

potatobanana | 2019-03-08 15:08

I don’t understand what you mean about position, why would gender affect position of the character? And why every frame? Ideally once the character is finished to customize there should be no need to worry about transforms unless they play a role in the game.

For animations, it’s up to you to decide which one you prefer. In one case you decide which AnimationPlayer to use, in the other case you decide which prefix to add when playing animations by name.
I would tend to prefer the node approach because this way you can keep only one after selecting gender, and later the animation code no longer has to check if it’s male or female since animations can have the same name for the same actions. Character customization can open a lot of combinations to handle, so it’s good to minimize the amount of work and re-use things with conventions as much as possible.

Zylann | 2019-03-08 18:32

sorry for late reply
what i meat ,is possible to set hair position (like image below) in code
enter image description here

thank you very for your advice, yeah use node make more sense, thank you this tips really helpful

potatobanana | 2019-03-10 12:14