2D animations, my player needs to move like a real person not more like a cube skating on surfaces.
With sprites, animations have a few basic steps.
We must use a sprite sheet and we must make sure that its subdivision is correct. To do this we just open the sprite editor and go to modify the division into cells so that it is homogeneous.
Now we need to create our animation with the created sprites and manage the transitions between the animations.
Now let’s look at just the motion animations. Idle, move and jump.
The part about creating animations is the same for all three. Once we have selected the sprite of our player and created the folder where we are going to save them. We just have to drag the sprites into the Animation panel and set the Sample Rate as we like.
Every time we create a new animation it is inserted into the Animator panel.
As we have already seen other times before moving on to the code, we must manage transitions and create the parameters that we need to pass from one animation to another.
Moving on to the code, I managed the movement of the player separately from the management of the animations.
In one script we manage the real movement of the game object, in the second script, there are public methods that guide the transitions between the animations that are properly called when needed by the main script.