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.
I’m new to this area.
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?
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.
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
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.
- idle psn
- moving to the obj
- collided with obj
- 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.
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:
- Now, in the events, you’re going to use this to apply animations
Player animation name to =
Player.Variable(CurrentPlayer) + Player.Variable(State)
Player is moving:
State to = “
Player is colliding with
CurrentPlayer to = “
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!