Object inherit code of another object

Hi, the title must be not clear,
But I have 2 players model
(same animation etc… just a color swap bc I as heard, GDEVELOP doesn’t handle that)

I want that when I pick Up “Obj_1” the “Player” Swap with “Player2” but keep the same code
How can I manage to “infuse” the Player code to the Player2 ?

Use object groups and variables. Something like this:
If the variable move of object_group is True (Object variable) Then
Allow moving object_group

Whenever its the turn of obj1 then
Change the variable move of obj1 to True
Change the variable move of obj2 to False
Whenever its the turn of obj2 then
Change the variable move of obj2 to True
Change the variable move of obj1 to False

Both obj1 and obj2 should be in the group object_group

I’m not 100% sure of what you’re after, so correct me if I’ve got it wrong. Do you want Player and Player2 to behave the same way, but just look different (as you wrote, like a different colour)?

If so, does changing the player’s tint help at all?

If tint isn’t the way to go, then you should look into using just one player object, but having the animations for both players in it.

So, say you have a run, idle and jump animation for both Player and Player2, then rename the Player animations to run1, idle1 and jump1, and then add the animations from Player2 into Player and name them run2, idle2 and jump2.

Keep track of which player is being used with object variable (name it player_number). Then, for example, set the run animation with "Set animation of Player to "run" + Player.VariableString(player_number)".