How to do Characher map in Godot e.g. change between characters or their body parts in the game

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

Hi

Using Spriter Pro and Construct 2/3 you set up a characher map. With the characher map you can setup multiple characters to use the same animation and even swap parts of their bodies to allow the play to customies the look of their player.
Links to to tutorials are below.

How can I do this in Godot?
Please, can someone point me resourses or tutories in how this could do in Godot.

A constust 2 user trying to move to Godot.
Henry

:bust_in_silhouette: Reply From: Pitanov V.V.

Create a resource with sprites on different parts of the body.

Make a character script tools.
Change dynamically his body parts.

class_name CharResource
    const body = [ preload(res://body1.png),preload(res://body2.png),preload(res://body3.png), ]
    const head = [...]
    const hand = [...]
    ...

tools
class_name MyCharacter
export(Resource) var res = CharResource.new()
export(int,0,2) var body_idx = 0 setget body_idx_set
func body_idx_set(val : int) -> void :
    body_idx = val
    get_node("Body").texture = res .body[body_idx]

export(int,0,2) var head_idx = 0 setget head_idx _set
func head_idx _set(val : int) -> void :
    head_idx  = val
    get_node("Head").texture = res .head[head_idx ]

export(int,0,2) var hand_idx = 0 setget hand_idx _set
func hand_idx _set(val : int) -> void :
    body_idx = val
    get_node("Hand").texture = res .hand[hand_idx ]

example struct object:
Node2D
±Head
±Body
±Hand