Rogue-like pick up character in-game

Hello!
I’m trying to make a pick up character system. When a player collided with an object (in the case of an in game character), the player’s character changes with the person they encountered.
I use a template of “Conviction of gun dude desktop” as a basis.
On the Internet I found two videos regarding this, but nowhere in them is it explained accurately and consistently.

PS
I’m new to this area.

1 Like

Hi there! Welcome to the community
Could you be more specific, please? I couldn’t understand what is needed exactly
Maybe you could say how do you want it to happen in your game?

1 Like

Ok. I will try to explain you.
You have like a special level where you can make upgrades, buy items or change the character you play with. Changing the character should be done in the following way.
1.The player goes to the character he wants to play with
2.The player collided with the character (object) 3.When the player collided the player’s character changes to that character who’s he collided with.

Like this:

Hmmmm
I think of a way it can work:

  • You got multiple player objects
  • Create an object group, and add every player object in there
  • Every player object should have the “top-down movement” behavior
    ====
  • At the beggining at the scene, disable every top-down movement behavior on all players except the one that should be the “default” one
  • Then, when the current player collides with the player object group, disable the top-down movement behavior from the current player and enable this behavior on the collided player object

Should be simple enough, if I couldn’t explain it very well then tell me and I’ll try again

1 Like

My idea is to do it only with the animation. For example, in the game I have 3 characters in total, which means that in the player’s object there will be animations for these 3 characters and when you collided the object changes the player’s animation.

Example

  1. idle psn
  2. moving to the obj
  3. collided with obj
  4. changing the player animation from 1 to 3; the object for the blue guy with which it collided the player is deleted from the scene and spawn another obj for the black one.

but I don’t know how to do it in practice with the tools of Gdevelop.

1 Like

Ooooh I understand! Well, that can be made very easily:

  • Create 2 new variables in the player object; One for the current player value; Other for the current animation/state value
  • Then, change all the animations’ names to a common format, something like:
    [Blue/Red/Black][Idle/Moving/Collided]
    (Example: BlueMoving, RedIdle, BlackCollided)
  • Now, in the events, you’re going to use this to apply animations

Always:

Set Player animation name to = Player.Variable(CurrentPlayer) + Player.Variable(State)

If Player is moving:

Set Player variable State to = “Moving

If Player is colliding with BluePlayerChangingObject:

Set Player variable CurrentPlayer to = “Blue

As a reminder, these are just examples of how you would apply this solution to your game
Make the changes however needed, and that should be it!